configmap_update
Modify Kubernetes ConfigMap data within a specified namespace using context-specific inputs. Ensures accurate updates to configuration settings across clusters managed by k8s-pilot MCP server.
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
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| data | Yes | ||
| name | Yes | ||
| namespace | Yes |
Implementation Reference
- tools/configmap.py:73-93 (handler)The handler function for the 'configmap_update' tool. It reads an existing ConfigMap, updates its data field with the provided dictionary, and replaces it in the Kubernetes cluster using the CoreV1Api. Decorated with @mcp.tool() for registration, @use_current_context to set the context, and @check_readonly_permission for access control.@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"}