Bug 1945597 - Optionally set KERNEL_VERSION and RT_KERNEL_VERSION
Summary: Optionally set KERNEL_VERSION and RT_KERNEL_VERSION
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Special Resource Operator
Version: 4.7
Hardware: All
OS: All
unspecified
urgent
Target Milestone: ---
: 4.7.z
Assignee: Zvonko Kosic
QA Contact: Walid A.
URL:
Whiteboard:
Depends On: 1945599
Blocks: 1945602
TreeView+ depends on / blocked
 
Reported: 2021-04-01 11:20 UTC by Zvonko Kosic
Modified: 2021-04-20 18:52 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1945599 1945602 (view as bug list)
Environment:
Last Closed: 2021-04-20 18:52:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift driver-toolkit pull 15 0 None open Bug 1945597: [release-4.7] Optionally set KERNEL_VERSION and RT_KERNEL_VERSION 2021-04-01 14:46:43 UTC
Red Hat Product Errata RHBA-2021:1149 0 None None None 2021-04-20 18:52:59 UTC

Description Zvonko Kosic 2021-04-01 11:20:49 UTC
Setting an empty default value for `ARG` entries eliminates the need of the following downstream modifications:
```
    - action: replace
      match: 'ARG KERNEL_VERSION'
      replacement: ''

    - action: replace
      match: 'ARG RT_KERNEL_VERSION'
      replacement: ''

    - action: replace
      match: 'ARG RHEL_VERSION'
      replacement: ''
```
https://github.com/openshift/ocp-build-data/blob/6861686494e12d5cbecde7d67f5ba01f4afe6323/images/driver-toolkit.yml#L10-L20

Using this bash's parameter expansion `${VAR:+-}` appends a `-` only if `$VAR` is not empty, eliminating the following downstream modifications:
```
    - action: replace
      match: '-${KERNEL_VERSION}'
      replacement: ''

    - action: replace
      match: '-${RT_KERNEL_VERSION}'
      replacement: ''
```
https://github.com/openshift/ocp-build-data/blob/6861686494e12d5cbecde7d67f5ba01f4afe6323/images/driver-toolkit.yml#L22-L28

---

This way, ART builds will use basically the same `Dockerfile` as upstream, and we'd use those replacement modifications only when we want to explicitly pin a version:
```
content:
  source:
    modifications:
    - action: replace
      match: "ARG KERNEL_VERSION=''"
      replacement: "ARG KERNEL_VERSION='1.2.3'"

    - action: replace
      match: "ARG RT_KERNEL_VERSION=''"
      replacement: "ARG RT_KERNEL_VERSION='1.2.3'"
```

Comment 3 Walid A. 2021-04-14 18:08:35 UTC
Verified on master branch of https://github.com/openshift-psap/special-resource-operator.git that we were able to use the driver-toolkit container as a base to build the simple-kmod driver-container.
Thanks @David Gray for providing the verification steps.

# oc get all -n simple-kmod
NAME                                                      READY   STATUS      RESTARTS   AGE
pod/simple-kmod-driver-build-bf9b01f15741109d-1-build     0/1     Completed   0          2m51s
pod/simple-kmod-driver-container-bf9b01f15741109d-4qbkv   1/1     Running     0          3m38s
pod/simple-kmod-driver-container-bf9b01f15741109d-4qqc6   1/1     Running     0          3m38s
pod/simple-kmod-driver-container-bf9b01f15741109d-l72s6   1/1     Running     0          3m38s
NAME                                                           DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR                                                                                                 AGE
daemonset.apps/simple-kmod-driver-container-bf9b01f15741109d   3         3         3       3            3           feature.node.kubernetes.io/kernel-version.full=4.18.0-240.22.1.el8_3.x86_64,node-role.kubernetes.io/worker=   3m38s
NAME                                                                       TYPE     FROM         LATEST
buildconfig.build.openshift.io/simple-kmod-driver-build-bf9b01f15741109d   Docker   Git@master   1
NAME                                                                   TYPE     FROM          STATUS     STARTED         DURATION
build.build.openshift.io/simple-kmod-driver-build-bf9b01f15741109d-1   Docker   Git@59317a1   Complete   2 minutes ago   1m57s
NAME                                                          IMAGE REPOSITORY                                                                            TAGS                            UPDATED
imagestream.image.openshift.io/driver-toolkit                 image-registry.openshift-image-registry.svc:5000/simple-kmod/driver-toolkit                 v4.7.0-202104131107.p0          5 minutes ago
imagestream.image.openshift.io/simple-kmod-driver-container   image-registry.openshift-image-registry.svc:5000/simple-kmod/simple-kmod-driver-container   v4.18.0-240.22.1.el8_3.x86_64   55 seconds ago

# oc get ds -n simple-kmod
NAME                                            DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR                                                                                                 AGE
simple-kmod-driver-container-bf9b01f15741109d   3         3         3       3            3           feature.node.kubernetes.io/kernel-version.full=4.18.0-240.22.1.el8_3.x86_64,node-role.kubernetes.io/worker=   4m3s

# oc get pods -n simple-kmod
NAME                                                  READY   STATUS      RESTARTS   AGE
simple-kmod-driver-build-bf9b01f15741109d-1-build     0/1     Completed   0          3m44s
simple-kmod-driver-container-bf9b01f15741109d-4qbkv   1/1     Running     0          4m31s
simple-kmod-driver-container-bf9b01f15741109d-4qqc6   1/1     Running     0          4m31s
simple-kmod-driver-container-bf9b01f15741109d-l72s6   1/1     Running     0          4m31s


# oc get pods -n simple-kmod -o wide
NAME                                                  READY   STATUS      RESTARTS   AGE     IP             NODE                                         NOMINATED NODE   READINESS GATES
simple-kmod-driver-build-bf9b01f15741109d-1-build     0/1     Completed   0          4m8s    10.128.3.167   ip-10-0-130-0.us-east-2.compute.internal     <none>           <none>
simple-kmod-driver-container-bf9b01f15741109d-4qbkv   1/1     Running     0          4m55s   10.129.2.15    ip-10-0-196-121.us-east-2.compute.internal   <none>           <none>
simple-kmod-driver-container-bf9b01f15741109d-4qqc6   1/1     Running     0          4m55s   10.128.3.166   ip-10-0-130-0.us-east-2.compute.internal     <none>           <none>
simple-kmod-driver-container-bf9b01f15741109d-l72s6   1/1     Running     0          4m55s   10.131.0.139   ip-10-0-179-91.us-east-2.compute.internal    <none>           <none>

# oc debug node/ip-10-0-196-121.us-east-2.compute.internal -- /host/usr/sbin/lsmod | grep simple
Starting pod/ip-10-0-196-121us-east-2computeinternal-debug ...
To use host binaries, run `chroot /host`
simple_procfs_kmod     16384  0
simple_kmod            16384  0
Removing debug pod ...

Comment 5 errata-xmlrpc 2021-04-20 18:52:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.7.7 bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1149


Note You need to log in before you can comment on or make changes to this bug.