Skip to content

fix: derive k8s secret name from bundle folder instead of CN prefix - #178

Merged
danielewood merged 3 commits into
mainfrom
fix/post-merge-trust-anchor-followups
Mar 19, 2026
Merged

fix: derive k8s secret name from bundle folder instead of CN prefix#178
danielewood merged 3 commits into
mainfrom
fix/post-merge-trust-anchor-followups

Conversation

@danielewood

Copy link
Copy Markdown
Collaborator

Summary

  • Fix Kubernetes secret metadata.name to use the bundle export folder name instead of the CN-derived prefix, so the secret name matches the directory it lives in

Context

When a bundle name is configured, the export folder correctly uses that name, but the K8s secret metadata.name was still derived from the certificate's Common Name. For example, a bundle named my-service would export to my-service/ but the k8s.yaml inside would have metadata.name: example.com instead of metadata.name: my-service.

Test plan

  • Existing go test ./... passes (verified by pre-commit)
  • CI passes

🤖 Generated with Claude Code

When a bundle name is configured, the export folder uses that name but
the Kubernetes secret metadata.name was still derived from the
certificate CN. This mismatch meant the secret name inside k8s.yaml
didn't match the directory it lived in.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 19, 2026 00:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adjusts bundle export so Kubernetes TLS secret metadata.name aligns with the configured bundle export folder name (instead of being CN-derived), improving consistency between generated k8s.yaml and its containing directory.

Changes:

  • Derive Kubernetes secret metadata.name from the sanitized bundle folder name.
  • Update CHANGELOG.md to record the fix under ## [Unreleased].
  • Bump modernc.org/sqlite dependency (and corresponding go.sum entries).

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

File Description
internal/certstore/export.go Switches K8s secret naming to use the bundle folder value passed to the writer.
go.mod Updates modernc.org/sqlite version requirement.
go.sum Updates checksums to match the sqlite version bump.
CHANGELOG.md Adds an Unreleased “Fixed” entry documenting the secret-name change.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread internal/certstore/export.go
Comment thread internal/certstore/export.go
Comment thread internal/certstore/export.go
Comment thread go.mod
danielewood and others added 2 commits March 18, 2026 19:35
The K8s secret metadata.name now uses the bundle folder name directly.
Bundle names in YAML configs are validated against DNS-1123 subdomain
rules at parse time, with errors that include the file path and line
number of the offending value.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The DNS-1123 regex allowed up to 253 chars (subdomain limit) when a
single label is capped at 63 chars per RFC 1123. Also update
architecture.md to reflect new ValidateK8sSecretName helper and
bundleconfig DNS-1123 validation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@danielewood
danielewood merged commit 346b933 into main Mar 19, 2026
15 checks passed
@danielewood
danielewood deleted the fix/post-merge-trust-anchor-followups branch March 19, 2026 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants