Skip to content

[release-v1.42] Install CRDs for the overlay-merged variant - #5361

Draft
vishnuramakrishnan-tigera wants to merge 1 commit into
release-v1.42from
vishnu/fix-crd-variant-overlay-v1.42
Draft

vishnuramakrishnan-tigera wants to merge 1 commit into
release-v1.42from
vishnu/fix-crd-variant-overlay-v1.42

Conversation

@vishnuramakrishnan-tigera

Copy link
Copy Markdown

Description

Bug fix for release-v1.42 (Calico Enterprise v3.23.x). When the Enterprise variant is set only in the overlay Installation, 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 updateCRDs ahead 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 the overlay merge, so updateCRDs gets default's own variant. On AKS that is Calico, while the rest of the reconcile uses the merged TigeraSecureEnterprise. The Enterprise components deploy and every tigerastatus is 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 ("updateCRDs installs CRDs for the overlay-merged variant"), but that PR is a large refactor and was not backported.

This change reads overlay before 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 that overlay read.

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:

v3.22.8 after upgrade (all tigerastatus green)
CRDs Enterprise Calico (written by the operator)
NetworkPolicy egress rule destination: {domains: [example.com], ports: [80,443]} destination: {ports: [80,443]}
curl example.com / google.com / github.com 200 / blocked / blocked 200 / 200 / 200
FelixConfiguration flowLogsCollectTcpStats, dnsLogsFlushInterval set gone
NetworkSet allowedEgressDomains, ClusterInformation cnxVersion set gone

The DNS policy "allow only example.com" became "allow 80/443 to anywhere". The data is not deleted, only pruned on read. Patching default to spec.variant: TigeraSecureEnterprise restores the Enterprise CRDs and the fields. Enforcement only recovered after restarting calico-typha.

Tests

  • New specs in core_controller_test.go (the fake component handler context). The first has default at Calico and overlay at TigeraSecureEnterprise, and asserts that the Enterprise-only licensekeys.crd.projectcalico.org CRD 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.
  • Not yet run on a cluster with a built image. Validating needs an operator image from this branch on an AKS-managed cluster upgraded via the overlay.

Affects only clusters with an overlay Installation that sets the variant. release-v1.43 has the same ordering and needs the same fix. release-v1.40 merges the overlay before updateCRDs and 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

Fixes the operator installing Calico CRDs instead of Calico Enterprise CRDs when the Enterprise variant is set in the 'overlay' Installation (as on AKS clusters upgraded from AKS-managed Calico), which caused Enterprise-only fields such as policy domains and FelixConfiguration settings to be dropped.

For PR author

  • Tests for change.
  • If changing pkg/apis/, run make gen-files
  • If changing versions, run make gen-versions

For PR reviewers

A note for code reviewers - all pull requests must have the following:

  • Milestone set according to targeted release.
  • Appropriate labels:
    • kind/bug if this is a bugfix.
    • kind/enhancement if this is a a new feature.
    • enterprise if this PR applies to Calico Enterprise only.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 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 overlay Installation 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

@vishnuramakrishnan-tigera
vishnuramakrishnan-tigera marked this pull request as draft October 21, 2026 22:05
@danudey danudey modified the milestones: v1.42.7, v1.42.8 Oct 27, 2026
@danudey danudey modified the milestones: v1.42.8, v1.42.9 Nov 10, 2026
@danudey danudey modified the milestones: v1.42.9, v1.42.10 Nov 19, 2026
@danudey danudey modified the milestones: v1.42.10, v1.42.11 Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-not-required enterprise Feature applies to enterprise only kind/bug Something isn't working release-note-required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants