Skip to main content
Glama

configmap_update

Update existing ConfigMaps in Kubernetes namespaces to modify configuration data for applications and services.

Instructions

Update an existing ConfigMap in the specified namespace.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ConfigMap name data: The new data to update in the ConfigMap

Returns: Status of the update operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
namespaceYes
nameYes
dataYes

Implementation Reference

  • The core handler implementation for the 'configmap_update' tool. It reads the existing ConfigMap, updates its data, and replaces it using the Kubernetes CoreV1Api. Decorated with @mcp.tool() for registration and other utilities.
    @mcp.tool()
    @use_current_context
    @check_readonly_permission
    def configmap_update(context_name: str, namespace: str, name: str, data: dict):
        """
        Update an existing ConfigMap in the specified namespace.
    
        Args:
            context_name: The Kubernetes context name
            namespace: The Kubernetes namespace
            name: The ConfigMap name
            data: The new data to update in the ConfigMap
    
        Returns:
            Status of the update operation
        """
        core_v1: CoreV1Api = get_api_clients(context_name)["core"]
        configmap = core_v1.read_namespaced_config_map(name=name, namespace=namespace)
        configmap.data = data
        updated_configmap = core_v1.replace_namespaced_config_map(name=name, namespace=namespace, body=configmap)
        return {"name": updated_configmap.metadata.name, "status": "Updated"}
  • The @mcp.tool() decorator registers the configmap_update function as an MCP tool.
    @mcp.tool()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bourbonkk/k8s-pilot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server