Skip to content

Default new installs to v3 CRD mode when the cluster supports it - #4973

Merged
caseydavenport merged 7 commits into
tigera:masterfrom
caseydavenport:casey-v3-crd-default
Jul 23, 2026
Merged

Default new installs to v3 CRD mode when the cluster supports it#4973
caseydavenport merged 7 commits into
tigera:masterfrom
caseydavenport:casey-v3-crd-default

Conversation

@caseydavenport

@caseydavenport caseydavenport commented Jun 26, 2026

Copy link
Copy Markdown
Member

Makes a brand-new operator-managed install default to v3 CRD mode (projectcalico.org/v3 served directly by CRDs, no aggregation API server) when the cluster can support it. Existing and upgraded clusters are unaffected - if Calico v1 CRDs are already present, the install stays in API-server mode.

The default only flips on a greenfield cluster (no Calico CRDs of either kind yet) that serves MutatingAdmissionPolicy, which v3 mode relies on to default policy types (Kubernetes 1.32+). On older clusters a greenfield install stays on the API server. An admin can still opt a new install back to API-server mode by applying the v1 CRDs before creating the Installation.

This is the operator-only piece of CORE-12574. The Helm and manifest defaults, and the docs updates, are tracked separately. libcalico-go's detection is deliberately left unchanged - components only run after the operator has installed the CRDs, so the existing rule resolves correctly once one set is present.

New installs on Kubernetes clusters with MutatingAdmissionPolicy support enabled now default to serving the projectcalico.org/v3 API directly via CRDs instead of through the aggregated API server. Existing and upgraded clusters are unaffected.

The protected tier list changed upstream (kube-admin/kube-baseline ->
adminnetworkpolicy/baselineadminnetworkpolicy). Regenerated with
make gen-versions to clear the validate-gen-versions dirty-check.
v3 mode relies on a MutatingAdmissionPolicy to default policy types. Every path
that concludes v3 - an existing v3 install, the CALICO_API_GROUP override, and a
converged datastore migration - now errors out if the cluster can't serve MAP
instead of running degraded. Greenfield installs still fall back to v1.

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.

Pull request overview

Updates the operator’s API-group selection logic so brand-new installs default to projectcalico.org/v3 CRD mode when the cluster serves MutatingAdmissionPolicy (required for v3-mode defaulting), while keeping existing/upgraded installs in v1 / aggregation API-server mode.

Changes:

  • Add MutatingAdmissionPolicy-based gating to v3 CRD-mode selection, including an explicit error when v3 is required but MAP isn’t served.
  • Add unit tests covering the v1/v3/MAP decision matrix and discovery-based selection.
  • Extend API server rendering tests to ensure the aggregated APIService isn’t registered when aggregation isn’t required, and update the enterprise “protect built-in tiers” admission policy tier list/comments.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
pkg/apis/version.go Implements MAP-aware v3/v1 selection logic, with helpers to make discovery and decision logic testable.
pkg/apis/version_test.go Adds unit tests for v3/v1/MAP decision logic and discovery-driven selection.
pkg/render/apiserver_test.go Adds rendering tests ensuring the APIService registration is omitted when aggregation isn’t required (including Enterprise case where Deployment remains).
pkg/imports/admission/enterprise/protect-builtin-tiers.yaml Updates protected tier list and clarifies Enterprise tier behavior in v3-mode admission policy.

Comment thread pkg/imports/admission/enterprise/protect-builtin-tiers.yaml
Comment thread pkg/imports/admission/enterprise/protect-builtin-tiers.yaml
Comment thread pkg/apis/version.go Outdated
Comment thread pkg/apis/version.go Outdated
Comment thread pkg/apis/version.go Outdated
Comment thread pkg/apis/version.go Outdated
Comment thread pkg/apis/version.go Outdated
UseV3CRDS builds the clients and hands them to useV3CRDs, which the tests
exercise with fakes. Discovery errors while looking for MutatingAdmissionPolicy
are now only tolerated when partial.
@caseydavenport
caseydavenport merged commit 3b4caa6 into tigera:master Jul 23, 2026
6 checks passed
@caseydavenport
caseydavenport deleted the casey-v3-crd-default branch July 23, 2026 21:18
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.

4 participants