summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2024-10-22 13:12:53 +0000
committerBruce Ashfield <bruce.ashfield@gmail.com>2024-11-15 19:50:00 +0000
commitb164962a6ed9bedd78cbfb1b52d8bfde128314e2 (patch)
treeb8ce5244ef3de64c920a9264951419db76bb64eb
parent3857974ed93bda2361ecdeb670b7f03bd257539f (diff)
downloadmeta-virtualization-b164962a6ed9bedd78cbfb1b52d8bfde128314e2.tar.gz
images: add container host image
This image is a reference implementation to create a target platform capable of running containers. This includes kernel configuration, container runtimes, tools and other support applications. The packages to install are largely described in the packagegroups that are part of this layer. packagegroups are preferred as they can easily be used to create similar images of different composition. The recipes for the packages have their list of build and runtime dependencies, as such, those dependencies are not part of the image install or listed explicitly in the packgroups. CNCF areas that have choices are described by VIRTUAL-RUNTIME variables. These variables can be set individually (in a distro, layer or local configuration file), or can be set by the setting of a "CONTAINER_PROFILE". It is possible to select incompatible packages if setting the VIRTUAL-RUNTIME variables individually. container profiles have been created as valid / tested stacks of the components in meta-virtualization. The contents of the image are selected by testing the VIRTUAL-RUNTIME values and mapping them to packagegroups. The possible VIRTUAL-RUNTIME variables (and their values) are currently: engines: docker/docker-moby, virtual-containerd, cri-o, podman, lxc 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" To select a CONTAINER_PROFILE, set the variable in your local, distro or layer configuration: CONTAINER_PROFILE="<your value>" The possible values for CONTAINER_PROFILE can be found in conf/distro/include in the format of: meta-virt-container-<profile>.inc default (docker) containerd podman docker k3s-host k3s-node This image will eventually be modified more as something that can easily be inherited and re-used, but for now, it is a capture of the best practices in a container host image. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r--recipes-extended/images/container-image-host.bb119
1 files changed, 119 insertions, 0 deletions
diff --git a/recipes-extended/images/container-image-host.bb b/recipes-extended/images/container-image-host.bb
new file mode 100644
index 00000000..3a75bb43
--- /dev/null
+++ b/recipes-extended/images/container-image-host.bb
@@ -0,0 +1,119 @@
1# This image is a reference implementation to create a target platform
2# capable of running containers. This includes kernel configuration,
3# container runtimes, tools and other support applications.
4#
5# The wpackages to install are largely described in the packagegroups
6# that are part of this layer. packagegroups are preferred as they can
7# easily be used to create similar images of different composition.
8# The recipes for the packages have their list of build and runtime
9# dependencies, as such, those dependencies are not part of the image
10# install or listed explicitly in the packgroups.
11#
12# CNCF areas that have choices are described by VIRTUAL-RUNTIME
13# variables. These variables can be set individually (in a distro,
14# layer or local configuration file), or can be set by the setting of
15# a "CONTAINER_PROFILE". It is possible to select incompatible
16# packages if setting the VIRTUAL-RUNTIME variables individually.
17# container profiles have been created as valid / tested stacks of the
18# components in meta-virtualization.
19#
20# The contents of the image are selected by testing the VIRTUAL-RUNTIME
21# values and mapping them to packagegroups.
22#
23# The possible VIRTUAL-RUNTIME variables (and their values) are
24# currently:
25#
26## engines: docker/docker-moby, virtual-containerd, cri-o, podman, lxc
27## VIRTUAL-RUNTIME_container_engine ??= "podman"
28## runtime: runc, crun, runv, runx
29## VIRTUAL-RUNTIME_container_runtime ??= "virtual-runc"
30## networking: cni, netavark
31## VIRTUAL-RUNTIME_container_networking ??= "cni"
32## dns: cni, aardvark-dns
33## VIRTUAL-RUNTIME_container_dns ??= "cni"
34## orchestration: k8s, k3s
35## VIRTUAL-RUNTIME_container_orchestration ??= "k3s"
36## Kubernetes terminology "components"
37## VIRTUAL-RUNTIME_cri ??= "virtual-containerd"
38## VIRTUAL-RUNTIME_cni ??= "cni"
39#
40# To select a CONTAINER_PROFILE, set the variable in your local,
41# distro or layer configuration:
42#
43# CONTAINER_PROFILE="<your value>"
44#
45# The possible values for CONTAINER_PROFILE can be found in
46# conf/distro/include in the format of: meta-virt-container-<profile>.inc
47#
48## default (docker)
49## containerd
50## podman
51## docker
52## k3s-host
53## k3s-node
54
55DESCRIPTION = "A configurable container host image"
56LICENSE = "MIT"
57
58inherit features_check
59
60# minimum features tested to have a working
61# container host image
62REQUIRED_DISTRO_FEATURES ?= " virtualization \
63 systemd \
64 seccomp \
65 "
66
67# features that are typically enabled
68RECOMMENDED_DISTRO_FEATURES ?= " pam \
69 usrmerge \
70 "
71# features that are enabled for specific wworkloads
72OPTIONAL_DISTRO_FEATURES ?= " vmsep \
73 k3s \
74 k8s \
75 "
76
77IMAGE_FEATURES[validitems] += "virt-unique-hostname"
78IMAGE_FEATURES[validitems] += "container-tools"
79
80IMAGE_FEATURES += "ssh-server-openssh"
81IMAGE_FEATURES += "package-management"
82# IMAGE_FEATURES += "container-tools"
83IMAGE_FEATURES += "virt-unique-hostname"
84
85IMAGE_LINGUAS = " "
86
87# additional packages to install
88CONTAINER_IMAGE_HOST_EXTRA_INSTALL ?= ""
89
90# values can be: "all", "split" or ""
91CONTAINER_IMAGE_KERNEL_MODULES ?= "all"
92
93# These could be done via a mapping to allow a single selection line
94# per type of virtul runtime, but right now the format of the
95# virtual-runtime to packagegroup name is not mandated, so we keep
96# them separate to allow the mapping in the individual items.
97IMAGE_INSTALL = " \
98 packagegroup-core-boot \
99 packagegroup-oci \
100 container-host-config \
101 ${@bb.utils.contains('CONTAINER_IMAGE_KERNEL_MODULES','split','','kernel-modules',d)} \
102 ${@bb.utils.contains_any('VIRTUAL-RUNTIME_container_engine','docker docker-moby','packagegroup-docker','',d)} \
103 ${@bb.utils.contains_any('VIRTUAL-RUNTIME_container_engine','podman','packagegroup-podman','',d)} \
104 ${@bb.utils.contains_any('VIRTUAL-RUNTIME_container_engine','containerd','packagegroup-containerd','',d)} \
105 ${@bb.utils.contains('VIRTUAL-RUNTIME_container_networking','cni','packagegroup-cni','',d)} \
106 ${@bb.utils.contains('VIRTUAL-RUNTIME_container_networking','netavark','packagegroup-netavark','',d)} \
107 ${@bb.utils.contains('IMAGE_FEATURES','container-tools','packagegroup-container-tools','',d)} \
108 ${@bb.utils.contains('VIRTUAL-RUNTIME_container_orchestration','k3s-host','packagegroup-k3s-host','',d)} \
109 ${@bb.utils.contains('VIRTUAL-RUNTIME_container_orchestration','k3s-node','packagegroup-k3s-node','',d)} \
110 ${CONTAINER_IMAGE_HOST_EXTRA_INSTALL} \
111 "
112
113# inherit the basics of a booting image
114inherit core-image
115
116IMAGE_ROOTFS_SIZE = "8192"
117
118# we always need extra space to install container images
119IMAGE_ROOTFS_EXTRA_SPACE = "41943040"