Skip to content

Cherry-pick #4396 and #4493: Fix cert reissuance on SAN mismatch [v1.40]#4542

Open
rene-dekker wants to merge 5 commits intorelease-v1.40from
ci-1954
Open

Cherry-pick #4396 and #4493: Fix cert reissuance on SAN mismatch [v1.40]#4542
rene-dekker wants to merge 5 commits intorelease-v1.40from
ci-1954

Conversation

@rene-dekker
Copy link
Member

Summary

Test plan

  • go test ./pkg/controller/certificatemanager/... — 27/27 pass
  • go test ./pkg/controller/compliance/... — pass

🤖 Generated with Claude Code

rene-dekker and others added 5 commits March 12, 2026 16:28
…d not actually test the replacement functionality.
The issuer identity check at the end of getKeyPair used exact match
against TigeraOperatorCAIssuerPrefix, but legacy operator CAs use
the format "tigera-operator-signer@<timestamp>". This caused valid
legacy certs to be misidentified as BYO, skipping SAN revalidation.

Fixes the calico-apiserver TLS failure after the namespace migration
from calico-apiserver to calico-system in v3.31, where the cert had
SANs for the old namespace but was never reissued.
Use 365-day cert durations instead of 1-hour so tests actually exercise
the code paths past the 30-day grace period check. Also use
legacyWithClientKeyUsage (with legacySecretName) in the existing "does
replace a legacy secret" test so it hits line 504 instead of bailing
out early on invalid key usage. Remove the separate validLegacyCASecret
test since the existing test now covers the scenario properly.
The test intended to simulate a user-supplied cert but passed nil as
the CA, which creates an operator-signed cert via DefaultOperatorCASignerName.
With the HasPrefix fix, this cert is now correctly identified as
operator-signed and reissued instead of preserved. Use a real non-operator
CA (test.MakeTestCA) to properly simulate BYO behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants