Skip to content

Migrate ReferencingServers to ReferencingWorkloads on remaining CRDs #4491

Closed

Description

@ChrisJBurns

Summary

RFC-0023 specifies a structured referencingWorkloads list with kind and name fields on shared configuration CRD status, rather than plain []string. PR #4483 migrated MCPOIDCConfig to the new WorkloadReference type. The same migration is needed for the remaining three CRDs.

CRDs to migrate

CRD File Current field
MCPToolConfig cmd/thv-operator/api/v1alpha1/toolconfig_types.go:80-83 ReferencingServers []string
MCPExternalAuthConfig cmd/thv-operator/api/v1alpha1/mcpexternalauthconfig_types.go:715-718 ReferencingServers []string
MCPTelemetryConfig cmd/thv-operator/api/v1alpha1/mcptelemetryconfig_types.go:62-64 ReferencingServers []string

Target state

Each CRD should use the WorkloadReference type (already defined in mcpoidcconfig_types.go):

type WorkloadReference struct {
    Kind string `json:"kind"` // MCPServer, VirtualMCPServer, MCPRemoteProxy
    Name string `json:"name"`
}

Field rename: ReferencingServers []string → ReferencingWorkloads []WorkloadReference

Controllers to update

For each CRD, the corresponding controller builds and compares the referencing list:

  • ToolConfigReconciler (toolconfig_controller.go) — updateReferencingServers() method
  • MCPExternalAuthConfigReconciler (mcpexternalauthconfig_controller.go) — updateReferencingServers() method
  • MCPTelemetryConfigReconciler — equivalent method

Each needs to build WorkloadReference structs with explicit Kind instead of plain server name strings.

Pattern to follow

See the MCPOIDCConfig migration in PR #4483 for the exact pattern:

  • findReferencingServers → findReferencingWorkloads returning []WorkloadReference
  • Watch handlers compare ref.Kind == "MCPServer" && ref.Name == server.Name instead of ref == server.Name
  • Deletion protection message uses "ReferencedByWorkloads" reason

Notes

  • This is a breaking change to the CRD status schema (status fields are not part of the API contract for clients, but tooling that reads status will need updates)
  • The WorkloadReference type is shared — defined once in mcpoidcconfig_types.go, reusable by all CRDs
  • CRD manifests, deepcopy, and API docs need regeneration after the change

Activity

  1. added
    enhancement
    on Apr 1, 2026
  2. added
    go
    kubernetes
    api
    on Apr 1, 2026
  3. added 3 commits that reference this issue on Apr 3, 2026
    ea7e3ad
    2f98143
    5627dcb
  4. added 3 commits that reference this issue on Apr 4, 2026
    4935779
    865b730
    23f102a
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

    apienhancementgokubernetesoperator

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions