feat: support loading the serving certificate from a pre-provisioned Secret - #2
Draft
psasidhar wants to merge 1 commit into
Draft
feat: support loading the serving certificate from a pre-provisioned Secret#2psasidhar wants to merge 1 commit into
psasidhar wants to merge 1 commit into
Conversation
…Secret istio-csr generates its own serving CSR via pkiutil.GenCSR(), which produces a DNS-only CSR with no URI SAN. Issuers that derive the signing identity from a SPIFFE URI SAN (e.g. an Athenz issuer, where the URI carries the domain and service to request from the CA) cannot sign such a CSR, so the serving certificate cannot be issued through the configured issuerRef at all. This adds an alternative: two new flags, --serving-certificate-secret-name and --serving-certificate-secret-namespace, tell istio-csr to skip generating its serving CSR and instead load tls.crt / tls.key / ca.crt from a pre-provisioned Secret (e.g. maintained by a cert-manager Certificate resource, which allows full control of the CSR contents including URI SANs). The Secret is re-read on the rotation schedule so renewals by cert-manager are picked up. The --serving-dns-names requirement is relaxed in Secret mode, where DNS SANs are embedded in the pre-provisioned certificate. Default behavior is unchanged when the flags are not set. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Sasi Palaka <palakas@yahooinc.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
istio-csr generates its own serving CSR internally via
pkiutil.GenCSR(), which produces a DNS-only CSR — no URI SAN. Issuers that derive the signing identity from a SPIFFE URI SAN cannot sign such a CSR. In our case, athenz-issuer parsesspiffe://<trust-domain>/ns/<namespace>/sa/<service-account>to determine the Athenz domain/service to request from ZTS; with no URI SAN the serving-certificate request fails outright, and istio-csr cannot obtain its gRPC serving cert through the configuredissuerRef.What
Two new flags let istio-csr skip generating its serving CSR and instead load the serving certificate from a pre-provisioned Secret (e.g. maintained by a cert-manager
Certificateresource, which gives full control of CSR contents including URI SANs):Changes by file:
pkg/tls/tls.go— newloadFromSecret()path: readstls.crt/tls.key/ca.crtfrom the named Secret and returns thetls.Certificatedirectly.fetchCertificate()takes this path when--serving-certificate-secret-nameis set; the originalGenCSR()path is unchanged otherwise. The Secret is re-read on the existing rotation schedule, so renewals performed by cert-manager are picked up automatically.cmd/app/options/options.go— the two flags, plus a relaxation of the--serving-dns-namesnon-empty validation: in Secret mode the DNS SANs are embedded in the pre-provisioned certificate, so requiring the flag would force dead configuration.cmd/app/app.go— passes the existing Kubernetes client intotls.NewProvider()soloadFromSecret()can call the Secrets API.Default behavior is fully unchanged when the flags are not set.
Usage
Status
loadFromSecret()and the option validation, docs for the new flags.🤖 Generated with Claude Code