Skip to content

Add k8s.get operation for retrieving resources and extracting fields #6

Description

@Cali0707

Description

Add a k8s.get operation to retrieve Kubernetes resources and extract specific fields. This is the most commonly needed operation across the mcpchecker kube-mcp-server example tasks, required by 8+ tasks for verification purposes.

Current bash tasks use patterns like:

  • kubectl get deployment web-app -o jsonpath='{.status.availableReplicas}'
  • kubectl get pods -l app=nginx -o jsonpath='{.items[0].status.containerStatuses[0].restartCount}'
  • kubectl get pvc storage-pvc -o jsonpath='{.spec.volumeName}'

Requirements

  • Support retrieving a single resource by name and namespace
  • Support retrieving resources by label selector
  • Support an expect block for inline verification (similar to HTTP step pattern)
  • Return resource data in outputs for potential use in subsequent steps (output referencing is handled separately)

Example Usage

Inline verification with expect:

- k8s.get:
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: web-app
      namespace: scale-test
    expect:
      fields:
        - path: status.availableReplicas
          equals: 2

Acceptance Criteria

  • Can retrieve a resource by apiVersion, kind, name, and namespace
  • Can filter resources using label selectors
  • Supports expect.fields for inline field assertions (path, equals, type, match, exists)
  • Handles not-found errors gracefully
  • Operation is documented in extension manifest

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions