Skip to content

Add cni-plugins init container to calico-node DaemonSet#4819

Open
caseydavenport wants to merge 5 commits into
tigera:masterfrom
caseydavenport:casey-cni-plugins-init
Open

Add cni-plugins init container to calico-node DaemonSet#4819
caseydavenport wants to merge 5 commits into
tigera:masterfrom
caseydavenport:casey-cni-plugins-init

Conversation

@caseydavenport
Copy link
Copy Markdown
Member

Pair with the new `calico/cni-plugins` image from projectcalico/calico (calico#12794). After the mono-image consolidation, `calico/calico` no longer ships the upstream CNI plugin binaries baked into `/opt/cni/bin`. On platforms that don't pre-populate the host CNI bin dir, `install-cni` finds nothing to copy and pods depending on `host-local`, `portmap`, `loopback`, `tuning`, or `flannel` break.

This change adds a `cni-plugins` init container ahead of `install-cni` that runs the new image. Both share a `cni-plugins-stage` emptyDir; the cni-plugins entrypoint copies the binaries into it, and install-cni mounts the same emptyDir at `/opt/cni/bin` so its existing walk picks them up unchanged. No change to install-cni's behavior.

Description

  • `pkg/components`: `ComponentCalicoCNIPlugins` (OSS, `calico/cni-plugins`) and `ComponentTigeraCNIPlugins` (enterprise, `tigera/cni-plugins`), with the version templates and config yamls updated to match.
  • `pkg/render/node.go`: resolves the cni-plugins image based on variant, adds the `cni-plugins-stage` emptyDir, renders the init container ordered before install-cni, and adds the staging mount at `/opt/cni/bin` on install-cni.
  • `pkg/render/node_test.go`: covers the new container, mount, ordering, and OSS / Enterprise image selection.

Depends on the calico PR landing and producing a dev tag of `calico/cni-plugins` (and `tigera/cni-plugins` for enterprise). Until then, image pulls for the init container will fail.

```release-note
NONE
```

Calico no longer ships the upstream CNI plugin binaries baked into the
combined image. Pair the new calico/cni-plugins image (from projectcalico/calico)
with an init container ahead of install-cni that copies the binaries
into a shared emptyDir mounted at /opt/cni/bin on install-cni. The
install code's existing /opt/cni/bin walk picks them up unchanged.

- pkg/components: add ComponentCalicoCNIPlugins and ComponentTigeraCNIPlugins,
  wire them through the version templates and config files.
- pkg/render/node.go: resolve the cni-plugins image based on variant, add
  the cni-plugins-stage emptyDir volume, render the cni-plugins init
  container ordered before install-cni, and mount the staging volume at
  /opt/cni/bin on install-cni.
- pkg/render/node_test.go: cover the new init container, mount, ordering,
  and OSS / Enterprise image selection.
Adds Installation.Spec.CNI.InstallMode with values All (default) and
CalicoOnly. CalicoOnly skips the cni-plugins init container, the
shared emptyDir, and the install-cni /opt/cni/bin mount, leaving only
Calico's own binaries to be installed. For environments where the host
already provides the upstream plugins (kind, certain managed node
images), avoiding the extra image pull + init step is the right call.

Also adds cni-plugins to the CalicoNodeDaemonSetInitContainer name
enum so users can set resource overrides on the new container.
@caseydavenport caseydavenport marked this pull request as ready for review May 20, 2026 18:17
@caseydavenport caseydavenport requested a review from a team as a code owner May 20, 2026 18:17
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.

2 participants