Skip to content

Add SPIRE and operator deployment integration for SPIFFE client auth #6205

Open

Description

@jhrozek

Description

Provide the supported Kubernetes deployment and credential-delivery path: SPIRE
issues rotating SVIDs over the Workload API, and the operator declares trust
domains, enabled methods and client associations through the CRD.

Without this the epic is a library change nobody can deploy. It is also where
the "no static secret" claim is actually cashed out — the workload must obtain
both credential types with no private-key file and no OAuth client secret
anywhere in the manifest.

Scope

  • Add v1beta1 CRD and controller wiring.
  • Configure trust domains, enabled authentication methods, client associations,
    TLS, bundle sources, scopes, resources and audiences.
  • Support referenced Secrets, ConfigMaps, SPIFFE Bundle Endpoints and Workload
    API sockets as appropriate to each field.
  • Provide a supported SPIRE Server and Agent deployment.
  • Define node and workload attestation, and workload registration entries.
  • Obtain rotating X.509-SVIDs and trust bundles through the Workload API.
  • Obtain audience-specific JWT-SVIDs whose audience exactly matches the ToolHive
    authorization-server issuer.
  • Support bundle and credential rotation without application restart.

API version and enforcement

Two things to get right rather than inherit:

API version. The spiffee-authserver branch's CRD work is on v1alpha1
MCPExternalAuthConfig, but the trustedIssuers / inboundGrants surface this
epic extends is v1beta1. Reusing that surface resolves the drift; porting the
v1alpha1 work forward re-creates it.

Three-layer enforcement. Mirror the pattern already used for inbound trust:
CEL admission rules on the CRD, a Go mirror in the controller for the rules CEL
cannot express (cross-entry uniqueness in particular), and a runtime registry
build at authserver startup. Each layer is deliberately redundant — CEL is the
cheapest failure point, the Go mirror catches stored objects that bypassed
admission, and the runtime build is the backstop.

One existing gap in that pattern is worth not repeating: the runtime
registry build is gated on ID-JAG grants being present, so a
token-exchange-only deployment has no runtime backstop at all and relies
entirely on the first two layers. The SPIFFE equivalent should be gated on its
own configuration being present, not on an unrelated grant.

Acceptance criteria

  • The operator rejects incomplete or contradictory SPIFFE configurations at
    admission time where CEL can express the rule, and during reconciliation
    otherwise.
  • The operator reconciles relevant Secret, ConfigMap and bundle-source changes.
  • A SPIRE-attested workload obtains both supported SVID types with no static
    OAuth client secret.
  • No private-key file is required on the SPIRE Workload API path.
  • X.509-SVID and JWT-SVID rotation work without restarting the workload or the
    authorization server.
  • The cert-manager CSI implementation is documented only as an optional
    compatibility or development path, with its different attestation and RBAC
    properties made explicit.

Dependencies

  • Sub-issue 5 (OAuth grants and discovery integration)
  • The v1beta1 trustedIssuers / inboundGrants CRD surface (unpushed,
    xaa-spike-1)

Related

  • Part of the SPIFFE client-authentication epic

Activity

  1. added
    enhancement
    go
    on Aug 5, 2026
  2. added
    needs-triage
    on Aug 5, 2026
  3. removed
    needs-triage
    on Aug 5, 2026
  4. jhrozek commented on Aug 13, 2026

    @jhrozek
    ContributorAuthor

    Reuse from the spiffee-authserver branch: medium to high for scaffolding, but note it is the cert-manager path, not SPIRE.

    deploy/spiffe-poc/setup.sh stands up a working kind cluster end to end: cert-manager with the built-in approver disabled, a self-signed root promoted to a CA ClusterIssuer, approver-policy with a server-cert policy, and cert-manager-csi-driver-spiffe configured with sourceCABundle so workloads get ca.crt alongside tls.crt and tls.key. SVIDs are 1h. The manifests under deploy/spiffe-poc/demo/manifests are a complete working environment including a Keycloak deliberately rooted in a different CA.

    SPIRE is not on the branch at all. docs/spiffe-poc/future-directions.md has a rough sketch (replace buildTLSConfig's LoadX509KeyPair and ReadFile with workloadapi.NewX509Source, add a Workload API socket path to the runner config, drop the CSI volumes) but it was never implemented or tested.

    Three things not to carry over:

    The v1alpha1 CRD models the trust anchor as ClientCASecretRef, one Secret and one key, mounted with subPath. subPath mounts never receive Secret updates from kubelet, so that shape cannot support a rotating bundle even in principle. The bundleSource union added in #6200 replaces it.

    buildTLSConfig calls LoadX509KeyPair on every handshake to get serving-cert rotation. It works, but it is disk I/O per connection and the branch itself flags it as a shortcut.

    Trust bundle distribution in the PoC is a one-shot kubectl create configmap in a shell script. Nothing reconciles it.

    Useful detail for the design: workloadapi.X509Source implements both x509svid.Source and x509bundle.Source, so a SPIRE-attested deployment can serve the auth server's own certificate and its trust bundles from one connection. #6201 only needs workloadapi.BundleSource, so leave the seam wide enough to widen here.

  5. jhrozek commented on Oct 21, 2026

    @jhrozek
    ContributorAuthor

    Merged so far: #6500 (2714d76) adds spiffeTrustDomains and inboundGrants.spiffeClientAuth to the CRDs with CEL validation, #6501 (720209d) documents them, and #6759 (7529e47) adds the file bundle source to the CRD, which mounts a ConfigMap key. There is no SPIRE deployment or Workload API path yet.

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

    authenticationauthorizationenhancementgo

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions