From e2c3d012f98574e7097ea35335ae4a3719c6ddac Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Tue, 29 Oct 2024 14:38:31 +0000 Subject: containerd: add cni-networking configuration When running a containerd-only stack, we need a CNI configuration to be available. When running containerd as part of something like K3S, we expect the orchestration package will provide that configuration. This commit makes a containerd-cni package available that contains a starting point configuration. Signed-off-by: Bruce Ashfield --- .../containerd/containerd/cni-containerd-net.conf | 24 ++++++++++++++++++++++ recipes-containers/containerd/containerd_git.bb | 5 +++++ 2 files changed, 29 insertions(+) create mode 100644 recipes-containers/containerd/containerd/cni-containerd-net.conf diff --git a/recipes-containers/containerd/containerd/cni-containerd-net.conf b/recipes-containers/containerd/containerd/cni-containerd-net.conf new file mode 100644 index 00000000..ca434d6f --- /dev/null +++ b/recipes-containers/containerd/containerd/cni-containerd-net.conf @@ -0,0 +1,24 @@ +{ + "cniVersion": "0.4.0", + "name": "containerd-net", + "plugins": [ + { + "type": "bridge", + "bridge": "cni0", + "isGateway": true, + "ipMasq": true, + "promiscMode": true, + "ipam": { + "type": "host-local", + "subnet": "10.88.0.0/16", + "routes": [ + { "dst": "0.0.0.0/0" } + ] + } + }, + { + "type": "portmap", + "capabilities": {"portMappings": true} + } + ] +} diff --git a/recipes-containers/containerd/containerd_git.bb b/recipes-containers/containerd/containerd_git.bb index f30d05a4..5f106a67 100644 --- a/recipes-containers/containerd/containerd_git.bb +++ b/recipes-containers/containerd/containerd_git.bb @@ -9,6 +9,7 @@ SRCREV = "19430264c19b8bd9f940101ec71d52ab2d2e54d5" SRC_URI = "git://github.com/containerd/containerd;branch=main;protocol=https;destsuffix=git/src/github.com/containerd/containerd/v2 \ file://0001-Makefile-allow-GO_BUILD_FLAGS-to-be-externally-speci.patch \ file://0001-build-don-t-use-gcflags-to-define-trimpath.patch \ + file://cni-containerd-net.conf \ " # Apache-2.0 for containerd @@ -98,3 +99,7 @@ COMPATIBLE_HOST = "^(?!(qemu)?mips).*" RDEPENDS:${PN} += " ${VIRTUAL-RUNTIME_container_runtime}" +## This may need to be made conditional on K3S or similar being +## configured in the distro, since we may have collisions. +CNI_NETWORKING_FILES ?= "${UNPACKDIR}/cni-containerd-net.conf" +inherit cni_networking -- cgit v1.2.3-54-g00ecf