Repository navigation
[release-v1.42] Install CRDs for the overlay-merged variant - #5361
Draft
vishnuramakrishnan-tigera wants to merge 1 commit into
Draft
vishnuramakrishnan-tigera wants to merge 1 commit into
vishnuramakrishnan-tigera wants to merge 1 commit into
Conversation
updateCRDs ran with the 'default' Installation's own variant, before the 'overlay' Installation was merged in (the ordering from #4882). The AKS upgrade from Calico sets the Enterprise variant only in 'overlay', so the operator installed the Calico CRDs over the Enterprise ones and the API server pruned every Enterprise field (FelixConfiguration settings, policy domains, NetworkSet allowedEgressDomains, ClusterInformation cnxVersion). Read 'overlay' before the CRD update and pass the merged variant, keeping the CRD update ahead of persisting defaults. Master fixed this as part of #5131.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The reviewed implementation and regression tests address the overlay-specific CRD selection bug without unresolved blocking issues.
No open issues 🎉
What changed in this PR
Fixes CRD selection for release-v1.42 installations where the Calico Enterprise variant is configured only in the overlay Installation, preventing Enterprise-only fields from being pruned.
Changes:
- Reads and merges the
overlayInstallation before updating CRDs. - Selects CRDs using the overlay-merged product variant while preserving CRD-before-defaults ordering.
- Reuses the overlay lookup during reconciliation.
- Adds regression tests for Enterprise overlay configuration and default Calico behavior.
| File | Description |
|---|---|
pkg/controller/installation/core_controller.go |
Selects CRDs using the overlay-merged product variant and reuses the fetched overlay. |
pkg/controller/installation/core_controller_test.go |
Verifies Enterprise CRDs are installed for an Enterprise overlay and Calico CRDs remain selected without one. |
Review effort: Lite
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.
Description
Bug fix for release-v1.42 (Calico Enterprise v3.23.x). When the Enterprise variant is set only in the
overlayInstallation, the operator installs the Calico CRDs over the Enterprise ones. The API server then prunes every Enterprise field. The documented AKS upgrade from AKS-managed Calico sets the variant this way.#4882 (cherry-pick of #4881) moved
updateCRDsahead of writing defaults back. That ordering is intentional: an older served CRD could otherwise reject newly defaulted values. But it also moved the call ahead of theoverlaymerge, soupdateCRDsgetsdefault's own variant. On AKS that isCalico, while the rest of the reconcile uses the mergedTigeraSecureEnterprise. The Enterprise components deploy and everytigerastatusis green, but the CRDs are the Calico ones. The bug is in v1.42.1 through v1.42.6. Master fixed it as part of #5131 ("updateCRDsinstalls CRDs for the overlay-merged variant"), but that PR is a large refactor and was not backported.This change reads
overlaybefore the CRD update and passes the overlay-merged variant (utils.OverrideInstallationSpec, the same merge the controller applies later). The CRD update stays ahead of persisting defaults. The existing overlay merge reuses thatoverlayread.Impact seen on a real cluster. AKS-managed Calico was upgraded to Calico Enterprise v3.22.8 (operator v1.40.16), then to v3.23.3 (operator v1.42.6) following the docs AKS steps:
tigerastatusgreen)destination: {domains: [example.com], ports: [80,443]}destination: {ports: [80,443]}flowLogsCollectTcpStats,dnsLogsFlushIntervalallowedEgressDomains, ClusterInformationcnxVersionThe DNS policy "allow only example.com" became "allow 80/443 to anywhere". The data is not deleted, only pruned on read. Patching
defaulttospec.variant: TigeraSecureEnterpriserestores the Enterprise CRDs and the fields. Enforcement only recovered after restartingcalico-typha.Tests
core_controller_test.go(the fake component handler context). The first hasdefaultatCalicoandoverlayatTigeraSecureEnterprise, and asserts that the Enterprise-onlylicensekeys.crd.projectcalico.orgCRD is written. It fails without this change and passes with it. The second has no overlay, and asserts that only the Calico CRDs are written.go test ./pkg/controller/installation/... ./pkg/controller/utils/...passes.overlay.Affects only clusters with an
overlayInstallation that sets the variant. release-v1.43 has the same ordering and needs the same fix. release-v1.40 merges the overlay beforeupdateCRDsand is unaffected.Calico Enterprise also needs tigera/calico-private#14821, which fixes the AKS upgrade manifest's missing ServiceAccount. That PR is a draft until this lands, because it makes this code path reachable.
AI assistance: Claude Code wrote the change and the tests and ran them. I reviewed it and am responsible for it.
Release Note
For PR author
make gen-filesmake gen-versionsFor PR reviewers
A note for code reviewers - all pull requests must have the following:
kind/bugif this is a bugfix.kind/enhancementif this is a a new feature.enterpriseif this PR applies to Calico Enterprise only.