intel / intel-data-center-gpu-driver-for-openshift

Intel Data Center GPU Drivers for Red Hat OpenShift Container Platform
https://catalog.redhat.com/software/containers/intel/intel-data-center-gpu-driver-container/6495ee55c8b2461e35fb8264
Apache License 2.0
7 stars 5 forks source link

Build Argument KERNEL_FULL_VERSION not available in dockerfile #35

Closed hershpa closed 1 year ago

hershpa commented 1 year ago

Summary: The build argument $KERNEL_FULL_VERSION was understood to be populated automatically by KMM in dockerfile. It was determined that $KERNEL_FULL_VERSION is not populated in the dockerfile but it is present in the KMM module. Currently ${KERNEL_VERSION}is only available as a default build argument automatically populated by KMM in dockerfile. An issue has been created on KMM upstream to ensure that KMM provides $KERNEL_FULL_VERSION as a default build argument to avoid user confusion and maintain consistency.

Impact: Analysis shows that $KERNEL_FULL_VERSION is empty string when the variable is echoed in dockerfile. Since the variable is empty, that gives COPY --from=builder /lib/modules/ /opt/lib/modules/. This copies everything under/lib/modules in the builder image into the final image.

We also noticed this in the build log: [Warning] one or more build args were not consumed: [KERNEL_VERSION].

Short-term solution: Add this in the 2nd stage of the dockerfile: ARG KERNEL_VERSION ARG KERNEL_FULL_VERSION=${KERNEL_VERSION} Use ${KERNEL_FULL_VERSION} as needed in the 2nd stage.

Long-term solution: KMM will add and automatically populate the $KERNEL_FULL_VERSION as a default build argument in the dockerfile. With this, user can use $KERNEL_FULL_VERSION as a default build argument in the dockerfile and KMM module. This would be available in a later KMM release, most likely KMM 1.1 or later.

Once this is available, we will make the following change: Before: ARG KERNEL_VERSION ARG KERNEL_FULL_VERSION=${KERNEL_VERSION}

After: ARG KERNEL_FULL_VERSION

hershpa commented 1 year ago

I have created a PR in KMM upstream https://github.com/kubernetes-sigs/kernel-module-management/pull/409 to implement the long-term solution described above.

hershpa commented 1 year ago

I have created a PR in KMM upstream kubernetes-sigs/kernel-module-management#409 to implement the long-term solution described above.

The PR has been merged and will be available in KMM 1.1 release.

uMartinXu commented 1 year ago

Should we close the issue? since PR #36 fixing before using KMM 1.1 also got merged.

hershpa commented 1 year ago

Yes, we can close this one. When we decide to move to KMM 1.1, we can proceed to the long-term solution and remove the workaround.