Repository navigation
Closed
Labels
enhancementNew feature or requestNew feature or requestkubernetesItems related to KubernetesItems related to Kubernetesoperatortelemetry
Description
Description
Implement the controller for MCPTelemetryConfig following the same pattern as the MCPOIDCConfig controller. The controller handles validation, config hash computation, finalizer management, reference tracking with structured WorkloadReference, and deletion protection.
Controller Responsibilities
- Finalizer management:
mcptelemetryconfig.toolhive.stacklok.dev/finalizer - Validation: Validate spec (endpoint requires tracing or metrics, sensitive header overlap with plaintext headers, empty names/keys)
- Config hash: SHA-256 hash of spec for change detection
- Reference tracking: Scan MCPServer for
spec.telemetryConfigRef.name == this.name. Store asstatus.referencingWorkloads[]with sharedWorkloadReference{Kind, Name}(namespace is implicit) - Deletion protection: Block finalizer removal while
referencingWorkloadsis non-empty - Status conditions: Set
Validcondition based on spec validation - Watches: MCPServer via
EnqueueRequestsFromMapFuncto update reference tracking
Status Structure
type MCPTelemetryConfigStatus struct {
Conditions []metav1.Condition `json:"conditions,omitempty"`
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
ConfigHash string `json:"configHash,omitempty"`
ReferencingWorkloads []WorkloadReference `json:"referencingWorkloads,omitempty"`
}
// WorkloadReference is shared across CRDs (defined in mcpoidcconfig_types.go)
type WorkloadReference struct {
Kind string `json:"kind"` // MCPServer, VirtualMCPServer, MCPRemoteProxy
Name string `json:"name"`
}Phase 2 Enhancements (follow-up PRs)
Readycondition (requires Secret resolution for sensitiveHeaders)- Secret watches for sensitiveHeaders change detection
- Cascade annotations on referencing workloads
- MCPRemoteEndpoint reference tracking (when CRD lands)
Acceptance Criteria
- Controller registered and reconciles MCPTelemetryConfig resources
- Finalizer lifecycle matches MCPOIDCConfig pattern
-
status.referencingWorkloadstracks MCPServer references with shared WorkloadReference (Kind + Name) -
status.configHashcomputed from spec - Deletion blocked while references exist
- Watches registered for MCPServer
- RBAC markers added
- Unit tests cover happy path, error paths, validation, reference tracking, deletion protection
- Integration tests cover reference lifecycle and deletion protection
- All tests pass
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestkubernetesItems related to KubernetesItems related to Kubernetesoperatortelemetry
Activity
ChrisJBurns commentedon Apr 2, 2026
Implemented in #4487. Controller handles validation, config hash, finalizer management, reference tracking with shared WorkloadReference, and deletion protection.