Skip to content

Add SPIFFE file bundle source - #6759

Merged
jhrozek merged 1 commit into
mainfrom
spiffe-v2-01-bundle-file-source
Oct 14, 2026
Merged

jhrozek merged 1 commit into
mainfrom
spiffe-v2-01-bundle-file-source

Conversation

@jhrozek

@jhrozek jhrozek commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The embedded auth server will verify SPIFFE X.509-SVIDs and JWT-SVIDs against a trust bundle that has to stay current as SPIRE rotates its signing keys, so it needs a way to load a bundle. In the supported topology the auth server pod holds no identity of its own (no Workload API socket, SVID or private key): SPIRE publishes its bundle to a ConfigMap (the v1.15 k8s_configmap BundlePublisher plugin) and the auth server mounts that ConfigMap read-only.
  • Adds the file bundle source: a bundle_source of type: file naming a mounted JWKS trust-bundle document, in RunConfig and in the CRD (configMapName / configMapKey). The operator projects the referenced ConfigMap key into a per-domain directory.
  • Adds the live loader (pkg/authserver/spiffe_bundle_source.go). It polls the file every 30 seconds rather than using fsnotify, because a ConfigMap-mounted file is updated through a kubelet symlink swap that inotify on the mounted path often misses. A failed reload is logged and the last good bundle is kept.
  • bundle_endpoint and workload_api stay declared but have no loader. file is the only source with a deployment story in this stack.

Part of #6199. Related: #6201.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

Built and vetted this commit (task build, go vet on pkg/authserver and cmd/thv-operator). task gen and task docs leave no diff. Loader and CRD validation tests are included in the diff and run in CI.

API Compatibility

  • This PR does not break the v1beta1 API, OR the api-break-allowed label is applied and the migration guidance is described above.

The change is additive: file is added to the bundleSource.type enum, with a new optional file field and a CEL rule that it is set if and only if type is file.

Does this introduce a user-facing change?

No. RunConfig.Validate() still rejects any non-empty spiffe_trust_domains, so nothing can be deployed with this yet. It lands the config shape and the loader that later PRs wire in.

Special notes for reviewers

  • This is the bottom of a stack. The PR that follows (TLS listener config and X.509 authority capability) is based on this branch.
  • About 1,100 of the added lines are non-generated Go and docs, mostly the loader and its tests. The rest is generated CRD, SDK and swagger output.
  • The loader is deliberately not connected to authentication here, which is why the startup rejection stays in place.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.93365% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.50%. Comparing base (d6660c0) to head (0e4e08b).

Files with missing lines Patch % Lines
pkg/authserver/spiffe_bundle_source.go 70.23% 50 Missing ⚠️
pkg/authserver/spiffe_trust.go 77.77% 4 Missing ⚠️
cmd/thv-operator/pkg/controllerutil/authserver.go 96.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6759      +/-   ##
==========================================
- Coverage   79.51%   79.50%   -0.01%     
==========================================
  Files         814      815       +1     
  Lines       82534    82737     +203     
==========================================
+ Hits        65623    65777     +154     
- Misses      16906    16955      +49     
  Partials        5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jhrozek
jhrozek force-pushed the spiffe-v2-01-bundle-file-source branch from 351e5b5 to 38b57a1 Compare October 7, 2026 19:06
@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Oct 7, 2026
@jhrozek
jhrozek force-pushed the spiffe-v2-01-bundle-file-source branch from 38b57a1 to 3ef4f21 Compare October 7, 2026 19:48
@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Oct 7, 2026
@jhrozek
jhrozek force-pushed the spiffe-v2-01-bundle-file-source branch from 3ef4f21 to c703e55 Compare October 7, 2026 20:08
@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Oct 7, 2026

@ChrisJBurns ChrisJBurns left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multi-agent consensus review

The file-bundle source is cohesive and well tested overall. One Kubernetes admission mismatch should be addressed: the CRD currently permits several ConfigMap keys that Kubernetes itself rejects.

Finding Consensus Severity
Match Kubernetes' full ConfigMap-key validation 9/10 Low

@jhrozek
jhrozek force-pushed the spiffe-v2-01-bundle-file-source branch from c703e55 to c9a00f2 Compare October 13, 2026 08:53
@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Oct 13, 2026
The embedded auth server verifies SPIFFE X.509-SVIDs and JWT-SVIDs
against a trust bundle that must stay current as SPIRE rotates its
signing keys. The supported deployment topology keeps the auth server
pod unidentified: SPIRE publishes its trust bundle to a Kubernetes
ConfigMap (the SPIRE v1.15 k8s_configmap BundlePublisher plugin), and
the auth server mounts that ConfigMap read-only rather than holding a
Workload API socket, an SVID, or a private key of its own. Each
attested client workload keeps its own separate Workload API socket
for its own credential.

Add the file bundle source: a RunConfig/CRD bundle_source of type
"file" naming a mounted JWKS trust-bundle document, and a live loader
that polls it every 30 seconds (polling rather than fsnotify, since a
ConfigMap-mounted file updates via a kubelet symlink swap that
inotify on the mounted path frequently misses). The operator projects
the referenced ConfigMap key into a per-domain directory.
@jhrozek
jhrozek force-pushed the spiffe-v2-01-bundle-file-source branch from c9a00f2 to 0e4e08b Compare October 13, 2026 09:49
@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Oct 13, 2026
@jhrozek
jhrozek merged commit 7529e47 into main Oct 14, 2026
48 checks passed
@jhrozek
jhrozek deleted the spiffe-v2-01-bundle-file-source branch October 14, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL Extra large PR: 1000+ lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants