configmap_create
Generate and deploy ConfigMaps in Kubernetes by specifying context, namespace, name, and data, enabling centralized configuration management across multiple clusters.
Instructions
Create a ConfigMap in the specified namespace.
Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ConfigMap name data: The data to store in the ConfigMap
Returns: Status of the creation operation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| data | Yes | ||
| name | Yes | ||
| namespace | Yes |
Implementation Reference
- tools/configmap.py:27-51 (handler)The main handler function for the 'configmap_create' tool. It creates a new Kubernetes ConfigMap in the specified namespace using the provided data. Decorated with @mcp.tool() for automatic registration and schema inference, @use_current_context for context management, and @check_readonly_permission for access control.@mcp.tool() @use_current_context @check_readonly_permission def configmap_create(context_name: str, namespace: str, name: str, data: dict): """ Create a ConfigMap in the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ConfigMap name data: The data to store in the ConfigMap Returns: Status of the creation operation """ from kubernetes.client import V1ConfigMap, V1ObjectMeta core_v1: CoreV1Api = get_api_clients(context_name)["core"] configmap = V1ConfigMap( metadata=V1ObjectMeta(name=name), data=data ) created_configmap = core_v1.create_namespaced_config_map(namespace=namespace, body=configmap) return {"name": created_configmap.metadata.name, "status": "Created"}
- server/server.py:10-10 (registration)Import statement that loads the tools.configmap module, triggering the execution of @mcp.tool() decorators to register the 'configmap_create' tool (and others in the module). Called within load_modules().import tools.configmap # noqa: F401