Skip to content

Commit fcad0e1

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 7aa4007 commit fcad0e1

3 files changed

Lines changed: 94 additions & 2 deletions

File tree

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,19 @@ RUN if [ $(arch) == "x86_64" ] || [ $(arch) == "aarch64" ]; then \
5858

5959
RUN dnf clean all && rm -rf /var/cache/dnf/*
6060

61-
COPY manifests /manifests
61+
COPY manifests/01-openshift-imagestream.yaml /manifests/01-openshift-imagestream.yaml
62+
COPY manifests/image-references /manifests/image-references
6263

6364
ARG TAGS=''
6465
RUN if echo "${TAGS:-}" | grep -q scos > /dev/null 2>&1; then sed -i 's/rhel-coreos/stream-coreos/g' /manifests/*; fi
6566

6667
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" \
6768
name="driver-toolkit" \
6869
io.openshift.release.operator=true \
69-
version="0.1"
70+
version="0.1" \
71+
io.openshift.os.streamclass=rhel-9 \
72+
kernel-version=${KERNEL_VERSION} \
73+
kernel-rt-version=${RT_KERNEL_VERSION}
7074

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

Dockerfile.rhel10

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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/01-openshift-imagestream.yaml /manifests/01-openshift-imagestream.yaml
62+
COPY manifests/image-references-rhel10 /manifests/image-references
63+
64+
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" \
65+
name="driver-toolkit" \
66+
io.openshift.release.operator=true \
67+
version="0.1" \
68+
io.openshift.os.streamclass=rhel-10 \
69+
kernel-version=${KERNEL_VERSION} \
70+
kernel-rt-version=${RT_KERNEL_VERSION}
71+
72+
# Last layer for metadata for mapping the driver-toolkit to a specific kernel version
73+
RUN export INSTALLED_KERNEL=$(rpm -q --qf "%{VERSION}-%{RELEASE}.%{ARCH}" kernel-devel); \
74+
export INSTALLED_RT_KERNEL=$(rpm -q --qf "%{VERSION}-%{RELEASE}.%{ARCH}+rt" kernel-rt-core); \
75+
echo "{ \"KERNEL_VERSION\": \"${INSTALLED_KERNEL}\", \"RT_KERNEL_VERSION\": \"${INSTALLED_RT_KERNEL}\", \"RHEL_VERSION\": \"$(</etc/dnf/vars/releasever)\" }" > /etc/driver-toolkit-release.json
76+

manifests/image-references-rhel10

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
kind: ImageStream
2+
apiVersion: image.openshift.io/v1
3+
spec:
4+
tags:
5+
- name: driver-toolkit
6+
from:
7+
kind: DockerImage
8+
name: example.com/image-reference-placeholder:driver-toolkit
9+
- name: rhel-coreos-10
10+
from:
11+
kind: DockerImage
12+
name: example.com/image-reference-placeholder:rhel-coreos-10

0 commit comments

Comments
 (0)