Skip to content

[release-v1.42] Default generated CNI config to cniVersion 1.0.0; add spec.cni.specVersion - #5125

Merged
caseydavenport merged 1 commit into
tigera:release-v1.42from
sridhartigera:cni-specversion-v1.42
Jul 30, 2026
Merged

caseydavenport merged 1 commit into
tigera:release-v1.42from
sridhartigera:cni-specversion-v1.42

Conversation

@sridhartigera

Copy link
Copy Markdown
Contributor

Cherry-pick of #5090 (fd37da0) to release-v1.42 (operator branch for Calico v3.32). Fixes Calico-on-OpenShift 4.23+ (#4969, projectcalico/calico#12965): multus requires the primary-CNI delegate config at cniVersion >= 0.4.0.

Conflict notes: test fixtures on this branch don't have the newer InstallMode field (kept SpecVersion only); dropped master-only netkit device_type render tests that were swept in as diff context. make gen-files re-run on this branch — no drift. pkg/render, pkg/controller/installation (incl. CEL CRD tests via envtest), and pkg/controller/utils all pass.

Review flag for release owners: as on master, unset/Auto resolves to 1.0.0 on all platforms, and this backport adds the spec.cni.specVersion field to the Installation CRD in a patch release. If you'd prefer the more conservative z-stream shape (no CRD field, or Auto→1.0.0 only on OpenShift), say so and I'll adjust. The field does provide the 0.3.1 escape hatch that a bare default-change would lack.

Upgrade safety: existing attachments replay their original cniVersion at DEL (runtime-cached config); all supported runtimes accept 1.0.0 (containerd >= 1.6 / CRI-O >= 1.24); validated live on GCP + GA OpenShift 4.18 upgrade paths and OpenShift 5.0.0-ec.3 (heals the multus crash).

Release note:

On upgrade, the operator-generated CNI config now declares cniVersion 1.0.0 (previously 0.3.1), required for multus compatibility on OpenShift 4.23+. A new Installation field, spec.cni.specVersion, allows pinning a version (including 0.3.1) or leaving it operator-managed (Auto).

🤖 Generated with Claude Code

…rsion (tigera#5090)

* Render CNI config with cniVersion 1.0.0 (was 0.3.1)

The generated CNI config's cniVersion has been pinned to 0.3.1 since
the early days for maximal backwards compatibility. OpenShift 4.23
bumps multus to a top-level cniVersion of 1.1.0, and multus rejects
delegates below 0.4.0, crash-looping and leaving nodes NotReady
(projectcalico/calico#12965, tigera#4969).

Move the default to 1.0.0 for all platforms:
- Every supported container runtime accepts 1.0.0 configs
  (containerd >= 1.6 / CRI-O >= 1.24).
- Calico and its bundled chained plugins (portmap, bandwidth, tuning)
  have supported spec 1.0.0 for years; the calico KDD test lane runs
  it permanently.
- Existing attachments are unaffected on upgrade: the runtime replays
  each attachment's original cniVersion at DEL.

Validated on OpenShift 5.0.0-ec.3 (multus at 1.1.0: fixes the crash;
install completes) and GA OpenShift 4.18 (multus at 0.4.0: no
regression, hostPort/portmap verified) with stock Calico images.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add spec.cni.specVersion to configure the generated CNI config version

New optional field on the Installation CR controlling the "cniVersion"
declared in the operator-generated CNI config. Auto (the default) lets
the operator choose - currently 1.0.0 - and may be raised in future
operator versions as older container runtimes fall out of support.
Explicit values (0.3.1, 0.4.0, 1.0.0) pin the version for environments
where a chained CNI plugin or container runtime requires one. 1.1.0 is
deliberately not offered yet: the bundled third-party CNI plugins
(portmap et al) top out at spec 1.0.0.

The field is only valid with spec.cni.type: Calico, since that is the
only mode in which the operator generates a CNI config.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Address review: clarify defaulting comment, add defaulting/validation tests

- Simplify the fillDefaults comment on the CNI spec version.
- defaults_test: assert specVersion defaults to Auto for Calico CNI and
  stays unset for other CNI plugins.
- validation_test: split the specVersion test into explicit allow
  (Calico) and reject (non-Calico) cases.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit fd37da0)
@caseydavenport
caseydavenport merged commit d50874c into tigera:release-v1.42 Jul 30, 2026
4 checks passed
@sridhartigera
sridhartigera deleted the cni-specversion-v1.42 branch July 31, 2026 00:01
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