Skip to contentSkip to conversation

containerd: make cni_networking conditional

PATCH In review [email protected] 2 participants 4 messages May 28, 2025 – Jun 11, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 containerd: make cni_networking conditional

From: Changqing Li <[email protected]>

make cni_networking conditional, when k3s, k8s is enabled, the
networking configuration will be provided by the orchestration package,
containerd-cni is not needed. This is for fix the following error:
PACKAGE_CLASSES = "package_deb"
do_rootfs failed with error:
dpkg: error processing archive /path/to/oe-rootfs-repo/corei7-64/./kubernetes-cni_v1.32.0+git0+5fe148234f_release-r0.deb (--unpack):
trying to overwrite '/etc/cni/net.d/cni-containerd-net.conflist', which is also in package containerd-cni v2.0.5-r0

Refer [1], "--no-force-overwrite" is set for dpkg, so above error occurred.

[1] https://git.openembedded.org/openembedded-core/commit/?id=cb95ba079960411775c57ab864d266e15a6292d1

---
 recipes-containers/containerd/containerd_git.bb      | 2 +-
 recipes-core/packagegroups/packagegroup-container.bb | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
recipes-containers/containerd/containerd_git.bb +1 -1
index c683fbeb..def7591a 100644
@@ -102,4 +102,4 @@ 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.conflist"
-inherit cni_networking
+inherit_defer ${@bb.utils.contains_any('DISTRO_FEATURES', 'k3s k8s', '', 'cni_networking', d)}
recipes-core/packagegroups/packagegroup-container.bb +1 -1
index f5e20344..8cbcf28e 100644
@@ -69,7 +69,7 @@ RDEPENDS:packagegroup-oci = " \
 RDEPENDS:packagegroup-containerd = " \
     virtual-containerd \
     packagegroup-cni \
-    containerd-cni \
+    ${@bb.utils.contains_any('DISTRO_FEATURES','k3s k8s','','containerd-cni',d)} \
     nerdctl \
     tini \
 "
Signature · 1 line
2.34.1
#1 lore raw

In message: [meta-virtualization][walnascar][master][PATCH] containerd: make cni_networking conditional

Quoted 9 lines · on 28/05/2025 Changqing Li via lists.yoctoproject.org wrote:

From: Changqing Li <[email protected]>

make cni_networking conditional, when k3s, k8s is enabled, the
networking configuration will be provided by the orchestration package,
containerd-cni is not needed. This is for fix the following error:
PACKAGE_CLASSES = "package_deb"
do_rootfs failed with error:
dpkg: error processing archive /path/to/oe-rootfs-repo/corei7-64/./kubernetes-cni_v1.32.0+git0+5fe148234f_release-r0.deb (--unpack):
trying to overwrite '/etc/cni/net.d/cni-containerd-net.conflist', which is also in package containerd-cni v2.0.5-r0

We shouldn't need to do this to fix the package install. Whether we need to do it to make sure networking configurations don't conflict is a separate question (and one that we need more information to decide on).

The design of the cni_networking is to allow co-existence of packages that need to configure cni networking. So we don't have to do what you've tried to do in this patch.

Let's rename the files referenced in CNI_NETWORKING_FILES to something more specific to the kubernetes packages and then they can both be installed at the same time.

That's one patch.

If you can show me that the two networking configurations being installed at the same time cause issues, we can then do the coordination betwen the packages similarly to what you are doing here in a second, separate patch.

Bruce

Quoted 48 lines

Refer [1], "--no-force-overwrite" is set for dpkg, so above error occurred.

[1] https://git.openembedded.org/openembedded-core/commit/?id=cb95ba079960411775c57ab864d266e15a6292d1

---
 recipes-containers/containerd/containerd_git.bb      | 2 +-
 recipes-core/packagegroups/packagegroup-container.bb | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
recipes-containers/containerd/containerd_git.bb +1 -1
index c683fbeb..def7591a 100644
@@ -102,4 +102,4 @@ 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.conflist"
-inherit cni_networking
+inherit_defer ${@bb.utils.contains_any('DISTRO_FEATURES', 'k3s k8s', '', 'cni_networking', d)}
recipes-core/packagegroups/packagegroup-container.bb +1 -1
index f5e20344..8cbcf28e 100644
@@ -69,7 +69,7 @@ RDEPENDS:packagegroup-oci = " \
 RDEPENDS:packagegroup-containerd = " \
     virtual-containerd \
     packagegroup-cni \
-    containerd-cni \
+    ${@bb.utils.contains_any('DISTRO_FEATURES','k3s k8s','','containerd-cni',d)} \
     nerdctl \
     tini \
 "
Signature · 11 lines
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9261): https://lists.yoctoproject.org/g/meta-virtualization/message/9261
Mute This Topic: https://lists.yoctoproject.org/mt/113339575/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
#2 lore raw
Quoted 27 lines · Bruce Ashfield

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

In message: [meta-virtualization][walnascar][master][PATCH] containerd: make cni_networking conditional

Quoted 9 lines · on 28/05/2025 Changqing Li via lists.yoctoproject.org wrote:

From: Changqing Li<[email protected]>

make cni_networking conditional, when k3s, k8s is enabled, the
networking configuration will be provided by the orchestration package,
containerd-cni is not needed. This is for fix the following error:
PACKAGE_CLASSES = "package_deb"
do_rootfs failed with error:
dpkg: error processing archive /path/to/oe-rootfs-repo/corei7-64/./kubernetes-cni_v1.32.0+git0+5fe148234f_release-r0.deb (--unpack):
trying to overwrite '/etc/cni/net.d/cni-containerd-net.conflist', which is also in package containerd-cni v2.0.5-r0

We shouldn't need to do this to fix the package install. Whether we need to do it to make sure networking configurations don't conflict is a separate question (and one that we need more information to decide on).

The design of the cni_networking is to allow co-existence of packages that need to configure cni networking. So we don't have to do what you've tried to do in this patch.

Let's rename the files referenced in CNI_NETWORKING_FILES to something more specific to the kubernetes packages and then they can both be installed at the same time.

Quoted 8 lines

That's one patch.

If you can show me that the two networking configurations being installed at the same time cause issues, we can then do the coordination betwen the packages similarly to what you are doing here in a second, separate patch.

Bruce

Hi, Bruce

Sorry,  I did not notice this mail before.

According to kubernetes doc:

"If there are multiple CNI configuration files in the directory, the kubelet uses the configuration file that comes first by name in lexicographic order."

Now,  both containerd-cni and kubernetes-cni use name cni-containerd-net.conflist.

How about keep containerd-cni use name cni-containerd-net.conflist, and let kubernetes-cni use 00_cni-containerd-net.conflist, so that configuration in kubernetes-cni

will be used if both package installed?

Regards

//Changqing

Quoted 46 lines
Quoted 46 lines

Refer [1], "--no-force-overwrite" is set for dpkg, so above error occurred.

[1]https://git.openembedded.org/openembedded-core/commit/?id=cb95ba079960411775c57ab864d266e15a6292d1

---
  recipes-containers/containerd/containerd_git.bb      | 2 +-
  recipes-core/packagegroups/packagegroup-container.bb | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
recipes-containers/containerd/containerd_git.bb +1 -1
index c683fbeb..def7591a 100644
@@ -102,4 +102,4 @@ 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.conflist"
-inherit cni_networking
+inherit_defer ${@bb.utils.contains_any('DISTRO_FEATURES', 'k3s k8s', '', 'cni_networking', d)}
recipes-core/packagegroups/packagegroup-container.bb +1 -2
index f5e20344..8cbcf28e 100644
@@ -69,7 +69,7 @@ RDEPENDS:packagegroup-oci = " \
  RDEPENDS:packagegroup-containerd = " \
      virtual-containerd \
      packagegroup-cni \
-    containerd-cni \
+    ${@bb.utils.contains_any('DISTRO_FEATURES','k3s k8s','','containerd-cni',d)} \
      nerdctl \
      tini \
  "
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9261):https://lists.yoctoproject.org/g/meta-virtualization/message/9261 Mute This Topic:https://lists.yoctoproject.org/mt/113339575/1050810
Group Owner:[email protected] Unsubscribe:https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
Quoted 51 lines · Changqing Li

On 6/5/25 10:29, Bruce Ashfield wrote:

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

In message: [meta-virtualization][walnascar][master][PATCH] containerd: make cni_networking conditional on 28/05/2025 Changqing Li via lists.yoctoproject.org wrote:

From: Changqing Li <[email protected]> <[email protected]>

make cni_networking conditional, when k3s, k8s is enabled, the
networking configuration will be provided by the orchestration package,
containerd-cni is not needed. This is for fix the following error:
PACKAGE_CLASSES = "package_deb"
do_rootfs failed with error:
dpkg: error processing archive /path/to/oe-rootfs-repo/corei7-64/./kubernetes-cni_v1.32.0+git0+5fe148234f_release-r0.deb (--unpack):
trying to overwrite '/etc/cni/net.d/cni-containerd-net.conflist', which is also in package containerd-cni v2.0.5-r0

We shouldn't need to do this to fix the package install. Whether we need to do it to make sure networking configurations don't conflict is a separate question (and one that we need more information to decide on).

The design of the cni_networking is to allow co-existence of packages that need to configure cni networking. So we don't have to do what you've tried to do in this patch.

Let's rename the files referenced in CNI_NETWORKING_FILES to something more specific to the kubernetes packages and then they can both be installed at the same time.

That's one patch.

If you can show me that the two networking configurations being installed at the same time cause issues, we can then do the coordination betwen the packages similarly to what you are doing here in a second, separate patch.

Bruce

Hi, Bruce

Sorry, I did not notice this mail before.

According to kubernetes doc:

"If there are multiple CNI configuration files in the directory, the kubelet uses the configuration file that comes first by name in lexicographic order."

Quoted 10 lines

Now, both containerd-cni and kubernetes-cni use name cni-containerd-net.conflist.

How about keep containerd-cni use name cni-containerd-net.conflist, and let kubernetes-cni use 00_cni-containerd-net.conflist, so that configuration in kubernetes-cni

will be used if both package installed?

That would be a fine solution!

Bruce

Regards

Quoted 52 lines

//Changqing

Refer [1], "--no-force-overwrite" is set for dpkg, so above error occurred.

[1] https://git.openembedded.org/openembedded-core/commit/?id=cb95ba079960411775c57ab864d266e15a6292d1

---
 recipes-containers/containerd/containerd_git.bb      | 2 +-
 recipes-core/packagegroups/packagegroup-container.bb | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
recipes-containers/containerd/containerd_git.bb +1 -1
index c683fbeb..def7591a 100644
@@ -102,4 +102,4 @@ 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.conflist"
-inherit cni_networking
+inherit_defer ${@bb.utils.contains_any('DISTRO_FEATURES', 'k3s k8s', '', 'cni_networking', d)}
recipes-core/packagegroups/packagegroup-container.bb +1 -2
index f5e20344..8cbcf28e 100644
@@ -69,7 +69,7 @@ RDEPENDS:packagegroup-oci = " \
 RDEPENDS:packagegroup-containerd = " \
     virtual-containerd \
     packagegroup-cni \
-    containerd-cni \
+    ${@bb.utils.contains_any('DISTRO_FEATURES','k3s k8s','','containerd-cni',d)} \
     nerdctl \
     tini \
 "
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9261): https://lists.yoctoproject.org/g/meta-virtualization/message/9261
Mute This Topic: https://lists.yoctoproject.org/mt/113339575/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II