Skip to content

MCPTelemetryConfig CRD — Types, Controller, and Tests #4249

@ChrisJBurns

Description

@ChrisJBurns

As a platform engineer managing observability infrastructure,
I want to define telemetry configuration once in an MCPTelemetryConfig resource,
so that all MCP servers share consistent collector endpoints and sampling settings without duplication.

Size: L
Dependencies: None
Labels: operator, api, telemetry

Context

Telemetry configurations (collector endpoint, sampling rate, headers) are duplicated across MCPServer resources. This story creates a dedicated MCPTelemetryConfig CRD with a nested structure matching RFC THV-0023.

The CRD uses nested openTelemetry and prometheus sub-objects (not a flat inline embedding of telemetry.Config), with a conversion layer that maps the nested CRD fields to the flat telemetry.Config at runtime.

Target Structure

spec:
  openTelemetry:
    enabled: true
    endpoint: otel-collector:4318
    headers: {}
    sensitiveHeaders: []
    resourceAttributes: {}
    tracing:
      enabled: true
      samplingRate: "0.1"
    metrics:
      enabled: true
  prometheus:
    enabled: true
status:
  referencingWorkloads:
    - kind: MCPServer
      name: server-a
  configHash: "sha256:..."
  conditions:
    - type: Valid
      status: "True"

Acceptance Criteria

  • MCPTelemetryConfig CRD uses nested openTelemetry/prometheus structure per RFC THV-0023
  • serviceName excluded from shared config (per-server via MCPTelemetryConfigReference)
  • Headers uses map[string]string
  • sensitiveHeaders field supports SecretKeyRef for credential headers
  • resourceAttributes replaces customAttributes for shared OTel resource attributes
  • Status tracks observedGeneration, configHash, referencingWorkloads (structured), and conditions
  • Controller follows MCPOIDCConfig pattern (finalizer, ref tracking, deletion protection)
  • CRD manifest included in operator-crds Helm chart
  • Conversion layer maps nested CRD types to flat telemetry.Config
  • Unit tests cover types, controller reconciliation, and sensitive header handling
  • Integration tests cover cross-CRD reference lifecycle and deletion protection
  • Example YAML in examples/operator/mcp-servers/mcpserver_fetch_otel.yaml

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions