Skip to content

Migrate ReferencingServers to ReferencingWorkloads on remaining CRDs #4491

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 []stringReferencingWorkloads []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:

  • findReferencingServersfindReferencingWorkloads 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

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

    apiItems related to the APIenhancementNew feature or requestgoPull requests that update go codekubernetesItems related to Kubernetesoperator

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions