pv_update
Update PersistentVolume metadata (e.g., labels) in Kubernetes clusters via the k8s-pilot MCP server. Specify context, PersistentVolume name, and new labels to manage resource configurations efficiently.
Instructions
Update an existing PersistentVolume's metadata (e.g., labels).
Args: context_name: The Kubernetes context name name: The PersistentVolume name labels: New labels to apply to the PersistentVolume
Returns: Status of the update operation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| labels | Yes | ||
| name | Yes |
Implementation Reference
- tools/pv.py:82-101 (handler)The pv_update tool handler: reads the existing PersistentVolume, updates its labels via patch, and returns the updated status and labels.@mcp.tool() @use_current_context @check_readonly_permission def pv_update(context_name: str, name: str, labels: dict): """ Update an existing PersistentVolume's metadata (e.g., labels). Args: context_name: The Kubernetes context name name: The PersistentVolume name labels: New labels to apply to the PersistentVolume Returns: Status of the update operation """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] pv = core_v1.read_persistent_volume(name=name) pv.metadata.labels = labels updated_pv = core_v1.patch_persistent_volume(name=name, body={"metadata": {"labels": labels}}) return {"name": updated_pv.metadata.name, "status": "Updated", "labels": updated_pv.metadata.labels}
- tools/pv.py:82-82 (registration)Registers the pv_update tool using the @mcp.tool() decorator.@mcp.tool()