Skip to content

MCPOIDCConfig CRD — Types, Controller, and Tests #4248

Description

@ChrisJBurns

As a platform engineer managing multiple MCP servers with the same identity provider,
I want to define OIDC configuration once in an MCPOIDCConfig resource and reference it from multiple workloads,
so that I can update issuer settings in one place instead of duplicating config across every MCPServer.

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

Context

OIDC configurations are defined inline in multiple CRDs (MCPServer, MCPRemoteProxy, VirtualMCPServer). Platform teams managing 10+ MCPServer resources with the same OIDC provider must duplicate the full config in each resource. A single issuer URL change requires updating every resource.

This story extracts shared OIDC configuration into a dedicated reusable CRD following the pattern established by MCPExternalAuthConfig.

Acceptance Criteria

  • MCPOIDCConfig CRD is defined with inline, configMapRef, and kubernetesServiceAccount variants
  • CEL validation enforces exactly one variant is set (no type discriminator field)
  • Status tracks observedGeneration, configHash, referencingServers, and standard conditions
  • Controller adds finalizer on first reconciliation
  • Controller tracks referencing workloads in status.referencingServers
  • Controller blocks deletion while references exist (finalizer pattern)
  • Controller cascades config changes to referencing workloads via annotation (toolhive.stacklok.dev/oidcconfig-hash)
  • Controller sets Ready condition based on config validation
  • Controller emits Warning event when duplicate audiences are detected across referencing workloads
  • CRD manifest is generated and included in operator-crds Helm chart
  • Unit tests cover type validation, controller reconciliation, finalizer logic, cascade, and audience uniqueness
  • Integration tests in cmd/thv-operator/test-integration/ cover cross-CRD reference lifecycle, cascade reconciliation, and deletion protection

Activity

  1. added
    enhancement
    kubernetes
    size/L
    on Mar 19, 2026
  2. added
    api
    on Mar 19, 2026
  3. added 8 commits that reference this issue on Mar 31, 2026
    5d18b9d
    a9f564c
    12aaae9
    15ce90c
    28370f6
    708647e
    2b042d6
    0ff46ab
  4. added a commit that references this issue on Apr 1, 2026
    b9307b1
  5. added 4 commits that reference this issue on Apr 1, 2026
    c1be0e6
    cd948c6
    129c9bb
    059629c
  6. added a commit that references this issue on Apr 2, 2026
    862f9b8
  7. ChrisJBurns commented on Apr 3, 2026

    @ChrisJBurns
    CollaboratorAuthor

    Closing — all core acceptance criteria are implemented. The configMapRef variant was intentionally omitted (not needed). Audience uniqueness warning (#4260) will be tracked separately as a future enhancement. Remaining annotation-based cascade was implemented via status hash instead, which is functionally equivalent.

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

    apienhancementkubernetesoperatorsize/L

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions