feat: add Gateway certificateRefs to builtin nameReference config#6162
feat: add Gateway certificateRefs to builtin nameReference config#6162anneheartrecord wants to merge 1 commit into
Conversation
Adds a fieldSpec so the builtin nameReference transformer updates Gateway listeners' tls.certificateRefs[].name when the referenced Secret is renamed by namePrefix, nameSuffix, or secretGenerator hash suffixing. The fieldSpec is scoped to group gateway.networking.k8s.io so it only matches the Gateway API resource and not unrelated CRDs named Gateway. Mirrors the existing Ingress spec/tls/secretName entry. The example transformer config README is kept in sync via the LINT.IfChange directive. Signed-off-by: anneheartrecord <charlescheng@rezona.ai>
|
Welcome @anneheartrecord! |
|
Hi @anneheartrecord. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: anneheartrecord The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@anneheartrecord: GitHub didn't allow me to request PR reviews from the following users: knverey. Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What this does
Adds a
fieldSpecto the builtinnameReferencetransformer config (api/internal/konfig/builtinpluginconsts/namereference.go) under theSecretkind so the transformer updates a Gateway listener'sspec/listeners/tls/certificateRefs/namewhen the referenced Secret is renamed (bynamePrefix,nameSuffix, orsecretGeneratorhash suffix).The fieldSpec is scoped to group
gateway.networking.k8s.ioso it only matches the Gateway API resource and not unrelated CRDs namedGateway(e.g. Istio'sgateway.networking.istio.io). It mirrors the existingIngressspec/tls/secretNameentry just above it.Why
When a TLS cert Secret is produced by
secretGenerator(which appends a content hash) or renamed by prefix/suffix, a referencingGateway'scertificateRefs[].nameis left pointing at the original name, breaking the reference. This matches the motivating use case in the issue.Changes
api/internal/konfig/builtinpluginconsts/namereference.go: add the Gateway certificateRefs fieldSpec.examples/transformerconfigs/README.md: keep the documented builtin config in sync (enforced by theLINT.IfChange/LINT.ThenChangedirective on the const).api/krusty/namereference_test.go: addTestNameReferenceGatewayCertificateRefs, an integration test that uses asecretGenerator+ aGatewayreferencing the secret viacertificateRefs, and asserts the reference is updated to the hashed Secret name.Testing
go test ./krusty/ -run TestNameReferenceGatewayCertificateRefspasses. The test fails before the const change (the Gateway'scertificateRefs.namestaystls-certificatewhile the Secret becomestls-certificate-8gkh55dgdg) and passes after.Fixes #6161