Skip to content

Commit 32feeaa

Browse files
committed
Adding support for payload multiple-stream.
The multiple-stream effort will contain multiple images considered as `machine-os` in the payload as well as multiple `driver-toolkit` images. This commit is adding some labels to the container such as the `rhel-stream` and `kernel-version`. In addition it adds a reference to the `rhel-coreos-10` image in order to specify to the payload that DTK depends on the `rhel-coreos-10` image. The Dockerfile has been split into 2 Dockerfile, one for each rhel release. In the future, it may extend to 3 Dockerfile including rhel for nvidia. Signed-off-by: Yoni Bettan <yonibettan@gmail.com>
1 parent 411e7ca commit 32feeaa

3 files changed

Lines changed: 86 additions & 1 deletion

File tree

Dockerfile.rhel10

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
FROM registry.ci.openshift.org/ocp/4.22:rhel-coreos-10
2+
ARG KERNEL_VERSION=''
3+
ARG RT_KERNEL_VERSION=''
4+
ARG RHEL_VERSION=''
5+
# If RHEL_VERSION is empty, we infer it from the /etc/os-release file. This is used by OKD as we always want the latest one.
6+
RUN [ "${RHEL_VERSION}" == "" ] && source /etc/os-release && RHEL_VERSION=${VERSION_ID}; echo ${RHEL_VERSION} > /etc/dnf/vars/releasever \
7+
&& dnf config-manager --best --setopt=install_weak_deps=False --save
8+
9+
# kernel packages needed to build drivers / kmods
10+
RUN dnf -y install \
11+
kernel-devel${KERNEL_VERSION:+-}${KERNEL_VERSION} \
12+
kernel-devel-matched${KERNEL_VERSION:+-}${KERNEL_VERSION} \
13+
kernel-headers${KERNEL_VERSION:+-}${KERNEL_VERSION} \
14+
kernel-modules${KERNEL_VERSION:+-}${KERNEL_VERSION} \
15+
kernel-modules-extra${KERNEL_VERSION:+-}${KERNEL_VERSION}
16+
17+
# real-time kernel packages
18+
# Also, assert that the kernel and kernel-rt rpms come from the same build. Relevant for 9.3+.
19+
RUN if [ $(arch) = x86_64 ]; then \
20+
dnf -y install \
21+
kernel-rt-devel${RT_KERNEL_VERSION:+-}${RT_KERNEL_VERSION} \
22+
kernel-rt-modules${RT_KERNEL_VERSION:+-}${RT_KERNEL_VERSION} \
23+
kernel-rt-modules-extra${RT_KERNEL_VERSION:+-}${RT_KERNEL_VERSION}; \
24+
diff --side-by-side <(rpm -qi kernel-core | grep 'Source RPM') <(rpm -qi kernel-rt-core | grep 'Source RPM'); \
25+
fi
26+
27+
# 64k-pages kernel packages for aarch64
28+
# Headers are not compiled, so there is no kernel-64k-headers packages,
29+
# and compilation will use the headers from kernel-headers
30+
RUN if [ $(arch) = aarch64 ]; then \
31+
dnf -y install \
32+
kernel-64k-devel${KERNEL_VERSION:+-}${KERNEL_VERSION} \
33+
kernel-64k-modules${KERNEL_VERSION:+-}${KERNEL_VERSION} \
34+
kernel-64k-modules-extra${KERNEL_VERSION:+-}${KERNEL_VERSION}; \
35+
fi
36+
37+
RUN dnf -y install kernel-rpm-macros
38+
39+
# Additional packages that are mandatory for driver-containers
40+
RUN dnf -y install elfutils-libelf-devel kmod binutils kabi-dw glibc
41+
42+
# Find and install the GCC version used to compile the kernel
43+
# If it cannot be found (fails on some architectures), install the default gcc
44+
RUN export INSTALLED_KERNEL=$(rpm -q --qf "%{VERSION}-%{RELEASE}.%{ARCH}" kernel-devel) && \
45+
GCC_VERSION=$(cat /lib/modules/${INSTALLED_KERNEL}/config | grep -Eo "gcc \(GCC\) ([0-9\.]+)" | grep -Eo "([0-9\.]+)") && \
46+
dnf -y install gcc-${GCC_VERSION} gcc-c++-${GCC_VERSION} || dnf -y install gcc gcc-c++
47+
48+
# Additional packages that are needed for a subset (e.g DPDK) of driver-containers
49+
RUN dnf -y install xz diffutils flex bison
50+
51+
# Packages needed to build driver-containers
52+
RUN dnf -y install git make rpm-build
53+
54+
# Packages needed to sign and run externally build kernel modules
55+
RUN if [ $(arch) == "x86_64" ] || [ $(arch) == "aarch64" ]; then \
56+
ARCH_DEP_PKGS="mokutil"; fi \
57+
&& dnf -y install openssl keyutils $ARCH_DEP_PKGS
58+
59+
RUN dnf clean all
60+
61+
COPY manifests /manifests
62+
63+
ARG TAGS=''
64+
RUN if echo "${TAGS:-}" | grep -q scos > /dev/null 2>&1; then sed -i 's/rhel-coreos/stream-coreos/g' /manifests/*; fi
65+
66+
LABEL io.k8s.description="driver-toolkit is a container with the kernel packages necessary for building driver containers for deploying kernel modules/drivers on OpenShift" \
67+
name="driver-toolkit" \
68+
io.openshift.release.operator=true \
69+
version="0.1" \
70+
io.openshift.os.streamclass=rhel-10 \
71+
kernel-version=${KERNEL_VERSION} \
72+
kernel-rt-version=${RT_KERNEL_VERSION}
73+
74+
# Last layer for metadata for mapping the driver-toolkit to a specific kernel version
75+
RUN export INSTALLED_KERNEL=$(rpm -q --qf "%{VERSION}-%{RELEASE}.%{ARCH}" kernel-devel); \
76+
export INSTALLED_RT_KERNEL=$(rpm -q --qf "%{VERSION}-%{RELEASE}.%{ARCH}+rt" kernel-rt-core); \
77+
echo "{ \"KERNEL_VERSION\": \"${INSTALLED_KERNEL}\", \"RT_KERNEL_VERSION\": \"${INSTALLED_RT_KERNEL}\", \"RHEL_VERSION\": \"$(</etc/dnf/vars/releasever)\" }" > /etc/driver-toolkit-release.json
78+

Dockerfile renamed to Dockerfile.rhel9

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ RUN if echo "${TAGS:-}" | grep -q scos > /dev/null 2>&1; then sed -i 's/rhel-cor
6666
LABEL io.k8s.description="driver-toolkit is a container with the kernel packages necessary for building driver containers for deploying kernel modules/drivers on OpenShift" \
6767
name="driver-toolkit" \
6868
io.openshift.release.operator=true \
69-
version="0.1"
69+
version="0.1" \
70+
io.openshift.os.streamclass=rhel-9 \
71+
kernel-version=${KERNEL_VERSION} \
72+
kernel-rt-version=${RT_KERNEL_VERSION}
7073

7174
# Last layer for metadata for mapping the driver-toolkit to a specific kernel version
7275
RUN export INSTALLED_KERNEL=$(rpm -q --qf "%{VERSION}-%{RELEASE}.%{ARCH}" kernel-devel); \

manifests/image-references

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ spec:
1010
from:
1111
kind: DockerImage
1212
name: example.com/image-reference-placeholder:rhel-coreos
13+
- name: rhel-coreos-10
14+
from:
15+
kind: DockerImage
16+
name: example.com/image-reference-placeholder:rhel-coreos-10

0 commit comments

Comments
 (0)