Skip to content

Conversation

@klihub
Copy link
Contributor

@klihub klihub commented Jun 27, 2025

What type of PR is this?

/kind bug

What this PR does / why we need it:

Currently CDI device injection is performed right after injecting other devices into the container. This is problematic because CDI device injection might alter, among other things, the environment. However setting up the final environment happens only later during container creation and it involves setting environment variables from the image and the Pod Spec. If the same environment variable is injected both from an image or a container, and from a CDI Spec, now the former take precedence of the latter. This is unintentional and wrong.

This patch moves CDI device injection much later during container creation.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

Does this PR introduce a user-facing change?

server: delay CDI device injection, to ensure that CDI Spec edits take precedence over image defaults and the Pod Spec.

@klihub klihub requested a review from mrunalp as a code owner June 27, 2025 20:13
@openshift-ci openshift-ci bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/bug Categorizes issue or PR as related to a bug. labels Jun 27, 2025
@openshift-ci openshift-ci bot requested review from QiWang19 and littlejawa June 27, 2025 20:13
@codecov
Copy link

codecov bot commented Jun 27, 2025

Codecov Report

Attention: Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 47.09%. Comparing base (8e1af22) to head (a6eaab8).
Report is 6 commits behind head on release-1.32.

Additional details and impacted files
@@               Coverage Diff                @@
##           release-1.32    #9296      +/-   ##
================================================
- Coverage         47.09%   47.09%   -0.01%     
================================================
  Files               154      154              
  Lines             22204    22207       +3     
================================================
  Hits              10458    10458              
- Misses            10675    10677       +2     
- Partials           1071     1072       +1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@elezar
Copy link
Contributor

elezar commented Jun 30, 2025

thanks @klihub

@klihub klihub force-pushed the fixes/release-1.32/delay-cdi-device-injection branch from dd1ed2e to 1bea5b2 Compare July 3, 2025 08:13
klihub added 3 commits July 3, 2025 11:37
Use a few environment variables with default values to verify
that evironment variables from CDI injection take precedence
over ones in the Pod Spec.

Signed-off-by: Krisztian Litkey <[email protected]>
Currently CDI device injection is performed right after injecting
other devices into the container. This is problematic because CDI
device injection might alter, among other things, the environment.
However setting up the final environment happens only later during
container creation and it involves setting environment variables
from the image and the Pod Spec. If the same environment variable
is injected both from an image or a container, and from a CDI Spec,
now the former take precedence of the latter. This is unintentional
and wrong.

This patch moves CDI device injection much later during container
creation, between OCI Hook injection and *oci.Container creation.

Signed-off-by: Krisztian Litkey <[email protected]>
@klihub klihub force-pushed the fixes/release-1.32/delay-cdi-device-injection branch from 1bea5b2 to a6eaab8 Compare July 3, 2025 08:37
@klihub
Copy link
Contributor Author

klihub commented Jul 4, 2025

@haircommander This is a cherry-pick/backport of #9292 to the 1.32 release branch. If we don't suspect those CI failures to be related to the changes this PR brings in, could we get this in ?

@elezar
Copy link
Contributor

elezar commented Jul 7, 2025

lgtm

@haircommander
Copy link
Member

/approve

@cri-o/cri-o-maintainers PTAL

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 10, 2025
@haircommander
Copy link
Member

/cherry-pick release-1.31

@openshift-cherrypick-robot

@haircommander: once the present PR merges, I will cherry-pick it on top of release-1.31 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.31

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Member

@sohankunkerkar sohankunkerkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 17, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 17, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haircommander, klihub, sohankunkerkar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [haircommander,sohankunkerkar]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 59112fa into cri-o:release-1.32 Jul 17, 2025
41 of 49 checks passed
@openshift-cherrypick-robot

@haircommander: new pull request created: #9353

In response to this:

/cherry-pick release-1.31

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@klihub klihub deleted the fixes/release-1.32/delay-cdi-device-injection branch August 4, 2025 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants