Resolve the product variant once at startup - #5131
Open
caseydavenport wants to merge 10 commits into
Open
Conversation
The operator runs as a single variant for the lifetime of the process, and restarts when the Installation asks for a different one.
Reuses the informer the controllers already have for Installation instead of opening a second watch with a hand-built REST client.
Drops the hand-rolled client-go informer and its unstoppable goroutine. The shared cache isn't filtered, so the handler matches on name and namespace.
The installation controller no longer reboots the operator; the variant watch handles that. Missing Enterprise CRDs now fail at startup with a message rather than degrading on every reconcile.
It reports whether the cluster serves the Calico Enterprise APIs, which is no longer the same question as whether to start those controllers.
Controller registration and reconcile decisions use the variant the process booted as. GetInstallationSpec no longer returns the status variant, the enterprise-CRD-exists option is gone, and fillDefaults defaults to the process variant so main and the installation controller agree.
EnterpriseCRDsExist meant the enterprise CRDs were present, not that the operator ran as Enterprise. The mainline and pool suites install Calico.
caseydavenport
commented
Jul 31, 2026
caseydavenport
commented
Jul 31, 2026
updateCRDs read the spec variant before the overlay was merged in, so an overlay that set the variant would get the wrong CRD set.
The bootstrap flag now only ever selects which CRDs to install. Splits the non-blocking lookup out so the variant watch shares it.
Brian-McM
reviewed
Jul 31, 2026
| waiting = true | ||
| } | ||
|
|
||
| select { |
Contributor
There was a problem hiding this comment.
I wonder if it would be more effective to add a watch instead of poll, since we require a change to happen if the variant isn't set.
Member
Author
There was a problem hiding this comment.
Yeah, I looked at that. The problem is ordering: this runs before mgr.Start(), so there's no informer to hang a watch off yet, and building a standalone one means a second client plus its own cache for what is a one-shot wait. It's also two objects, since effectiveVariant merges the overlay in. A 2s poll that ends the moment an Installation lands felt like the better trade.
Pass the variant to the CSR controller like every other controller does, rather than a bool.
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.
The operator decides which variant it is running in four places: the
--variantflag, Enterprise CRD discovery, the Installation spec, and the Installation status. The one gating most controllers is CRD discovery, which is not what the user set and stays true after a downgrade because the CRDs outlive the variant change.This resolves the variant once from the Installation before any controller starts, and restarts the operator from a single watch when it changes. Design: https://github.com/tigera/designs/pull/89 (CORE-13240).
Description
mainfrom the Installation, merging the overlay, and passed to controllers as one optionGetInstallationSpecno longer returns the status variant, so controllers cannot re-derive it--variantflag is now bootstrap-only and validated; an unrecognised value used to be treated as Calico, which installs the wrong CRDs for the bootstrap-crds path where nothing runs afterwards to correct themupdateCRDsinstalls CRDs for the overlay-merged variant. It read the spec variant before the overlay was merged in, so an overlay that set the variant got the wrong CRD set.fillDefaultsdefaults to the process variant instead of hardcoding Calico, so it andmaincannot disagreeBehaviour changes worth calling out:
fillDefaultsoverrode it to Calico.Also fixes a latent ImageSet bug. During an Enterprise install the status variant lags the spec, so controllers asked for a
calico-ImageSet.GetImageSetonly errors when an ImageSet with the matching prefix exists, so on a cluster carrying onlyenterprise-<version>it found nothing, returned no error, and the components deployed with built-in image tags. Air-gapped clusters fail to pull; everyone else silently gets floating tags instead of the digests they pinned.