Bug 1945602 - 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.6
Hardware: All
OS: All
unspecified
urgent
Target Milestone: ---
: 4.6.z
Assignee: Zvonko Kosic
QA Contact: Walid A.
URL:
Whiteboard:
Depends On: 1945597
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-04-01 11:31 UTC by Zvonko Kosic
Modified: 2021-04-27 14:21 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1945597
Environment:
Last Closed: 2021-04-27 14:20:49 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift driver-toolkit pull 14 0 None open Bug 1945602: [release-4.6] Optionally set KERNEL_VERSION and RT_KERNEL_VERSION 2021-04-14 18:17:01 UTC
Red Hat Product Errata RHBA-2021:1232 0 None None None 2021-04-27 14:21:10 UTC

Description Zvonko Kosic 2021-04-01 11:31:13 UTC
+++ This bug was initially created as a clone of Bug #1945597 +++

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-20 18:27:22 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.

# oc debug node/<worker_node>
.
. 
sh-4.4# chroot /host
sh-4.4# 
sh-4.4# lsmod | grep kmod
simple_procfs_kmod     16384  0
simple_kmod            16384  0
sh-4.4# 
sh-4.4# exit
exit
sh-4.4# 
sh-4.4# exit
exit
Removing debug pod ...

# oc get ds -n simple-kmod
NAME                                           DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR                                                                                                 AGE
simple-kmod-driver-container-ee060ca2c5056b7   3         3         3       3            3           feature.node.kubernetes.io/kernel-version.full=4.18.0-193.47.1.el8_2.x86_64,node-role.kubernetes.io/worker=   5m4s

# oc get pods -n simple-kmod
NAME                                                 READY   STATUS      RESTARTS   AGE
simple-kmod-driver-build-ee060ca2c5056b7-1-build     0/1     Completed   0          4m37s
simple-kmod-driver-container-ee060ca2c5056b7-6zqfh   1/1     Running     0          5m12s
simple-kmod-driver-container-ee060ca2c5056b7-9vbrw   1/1     Running     0          5m12s
simple-kmod-driver-container-ee060ca2c5056b7-bczlx   1/1     Running     0          5m12s

# oc get pods -n openshift-special-resource-operator
NAME                                                   READY   STATUS    RESTARTS   AGE
special-resource-controller-manager-8587db687f-5d9xg   2/2     Running   0          12m

Comment 5 errata-xmlrpc 2021-04-27 14:20:49 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.6.26 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:1232


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