From 534e8b6ed7016aff57794dd66645556f5994d151 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Thu, 2 Mar 2023 15:49:48 -0500 Subject: [PATCH] conf: introduce container configuration values From the configuration file itself: These variables represent groupings of functionality in the CNCF landscape. In particular, they are areas where there is a choice between more than one implementation or an area where abstraction is beneficial. The contents of the variables are are runtime components that recipes may use for RDEPENDS. Build dependencies are not typically flexible, so do not currently have DEPENDS equivalents for the components (i.e. DEPENDS on runc versus crun). Distro features such as kubernetes or other container stacks can be used to set different defaults for these variables. Note: these are "global" values, since they represent choices. If more than of a grouping is required on target, then the variable can be appended or set to multiple values. That being said, Recipes should generally agree on the values, hence the global namespace. Recipe specific choices can still be done, but they risk conflicting on target or causing runtime issues / errors. ## CNCF "components" # engines: docker-ce/docker-moby, virtual-containerd, cri-o, podman VIRTUAL-RUNTIME_container_engine ??= "podman" # runtime: runc, crun, runv, runx VIRTUAL-RUNTIME_container_runtime ??= "virtual-runc" # networking: cni, netavark VIRTUAL-RUNTIME_container_networking ??= "cni" # dns: cni, aardvark-dns VIRTUAL-RUNTIME_container_dns ??= "cni" # orchestration: k8s, k3s VIRTUAL-RUNTIME_container_orchestration ??= "k3s" ## Kubernetes terminology "components" VIRTUAL-RUNTIME_cri ??= "containerd" VIRTUAL-RUNTIME_cni ??= "cni" Signed-off-by: Bruce Ashfield --- classes/meta-virt-container-cfg.bbclass | 6 ++++ conf/distro/include/meta-virt-container.inc | 40 +++++++++++++++++++++ conf/layer.conf | 2 ++ 3 files changed, 48 insertions(+) create mode 100644 classes/meta-virt-container-cfg.bbclass create mode 100644 conf/distro/include/meta-virt-container.inc diff --git a/classes/meta-virt-container-cfg.bbclass b/classes/meta-virt-container-cfg.bbclass new file mode 100644 index 00000000..0688f525 --- /dev/null +++ b/classes/meta-virt-container-cfg.bbclass @@ -0,0 +1,6 @@ +# We need to set the Xen meta-virt config components, only if "xen" +# is in the distro features. Since we don't know the distro flags during +# layer.conf load time, we delay using a special bbclass that simply includes +# the META_VIRT_CONTAINER_CONFIG_PATH file. + +include ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', '${META_VIRT_CONTAINER_CONFIG_PATH}', '', d)} diff --git a/conf/distro/include/meta-virt-container.inc b/conf/distro/include/meta-virt-container.inc new file mode 100644 index 00000000..c3ac8394 --- /dev/null +++ b/conf/distro/include/meta-virt-container.inc @@ -0,0 +1,40 @@ +# These variables represent groupings of functionality in the CNCF +# landscape. In particular, they are areas where there is a choice +# between more than one implementation or an area where abstraction +# is beneficial. +# +# The contents of the variables are are runtime components that +# recipes may use for RDEPENDS. +# +# Build dependencies are not typically flexible, so do not currently +# have DEPENDS equivalents for the components (i.e. DEPENDS on runc +# versus crun). +# +# Distro features such as kubernetes or other container stacks +# can be used to set different defaults for these variables. +# +# Note: these are "global" values, since they represent choices. +# If more than of a grouping is required on target, then the variable +# can be appended or set to multiple values. That being said, Recipes +# should generally agree on the values, hence the global namespace. +# Recipe specific choices can still be done, but they risk +# conflicting on target or causing runtime issues / errors. +# + +## CNCF "components" + +# engines: docker-ce/docker-moby, virtual-containerd, cri-o, podman +VIRTUAL-RUNTIME_container_engine ??= "podman" +# runtime: runc, crun, runv, runx +VIRTUAL-RUNTIME_container_runtime ??= "virtual-runc" +# networking: cni, netavark +VIRTUAL-RUNTIME_container_networking ??= "cni" +# dns: cni, aardvark-dns +VIRTUAL-RUNTIME_container_dns ??= "cni" +# orchestration: k8s, k3s +VIRTUAL-RUNTIME_container_orchestration ??= "k3s" + +## Kubernetes terminology "components" + +VIRTUAL-RUNTIME_cri ??= "virtual-containerd" +VIRTUAL-RUNTIME_cni ??= "cni" diff --git a/conf/layer.conf b/conf/layer.conf index 10b457f8..88ac3905 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -52,9 +52,11 @@ INHERIT += "sanity-meta-virt" # layer.conf load time, we delay using a special bbclass that simply includes # the META_VIRT_CONFIG_PATH file, and likewise for the Xen and k8s configs META_VIRT_CONFIG_PATH = "${LAYERDIR}/conf/distro/include/meta-virt-default-versions.inc" +META_VIRT_CONTAINER_CONFIG_PATH = "${LAYERDIR}/conf/distro/include/meta-virt-container.inc" META_VIRT_XEN_CONFIG_PATH = "${LAYERDIR}/conf/distro/include/meta-virt-xen.inc" K8S_CONFIG_PATH = "${LAYERDIR}/conf/distro/include/k8s-versions.inc" USER_CLASSES:append = " meta-virt-cfg" +USER_CLASSES:append = " meta-virt-container-cfg" USER_CLASSES:append = " meta-virt-k8s-cfg" USER_CLASSES:append = " meta-virt-xen-cfg" USER_CLASSES:append = " meta-virt-hosts"