Skip to content

Conversation

@bitoku
Copy link
Contributor

@bitoku bitoku commented Jun 26, 2025

What type of PR is this?

/kind feature

What this PR does / why we need it:

This implements https://issues.redhat.com/browse/OCPNODE-2864

Which issue(s) this PR fixes:

Fixes https://issues.redhat.com/browse/OCPNODE-2864

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Added `exec_cpu_affinity` type which can specify cpu where exec command runs.

@bitoku bitoku requested a review from mrunalp as a code owner June 26, 2025 04:09
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 26, 2025
@openshift-ci-robot
Copy link

@bitoku: This pull request references OCPNODE-2864 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set.

In response to this:

What type of PR is this?

/kind feature

What this PR does / why we need it:

This implements https://issues.redhat.com/browse/OCPNODE-2864

Which issue(s) this PR fixes:

Fixes https://issues.redhat.com/browse/OCPNODE-2864

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Added `exec_cpu_affinity` type which can specify cpu where exec command runs.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jun 26, 2025
@openshift-ci openshift-ci bot requested review from QiWang19 and littlejawa June 26, 2025 04:09
@openshift-ci openshift-ci bot added dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/feature Categorizes issue or PR as related to a new feature. labels Jun 26, 2025
@bitoku bitoku force-pushed the exec-cpu-affinity branch 2 times, most recently from bafa8ef to b0c10de Compare June 26, 2025 07:38
@codecov
Copy link

codecov bot commented Jun 26, 2025

Codecov Report

❌ Patch coverage is 71.21212% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.28%. Comparing base (c926682) to head (4dd7fb9).
⚠️ Report is 34 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9286      +/-   ##
==========================================
+ Coverage   66.95%   67.28%   +0.32%     
==========================================
  Files         198      199       +1     
  Lines       27426    27508      +82     
==========================================
+ Hits        18364    18509     +145     
+ Misses       7545     7453      -92     
- Partials     1517     1546      +29     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bitoku
Copy link
Contributor Author

bitoku commented Jun 27, 2025

/retest

@bitoku
Copy link
Contributor Author

bitoku commented Jun 30, 2025

@haircommander @MarSik @bartwensley PTAL

@haircommander
Copy link
Member

/approve

looks good!

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

MarSik commented Jul 3, 2025

Just a note as I am on vacation and only noticed the change. It might be a good idea to sync this with #9223 where I proposed we allow configuring the housekeeping cpus using an annotation like housekeeping-cpus.crio.io/[container-name]: 0,1

I know the first cpu is traditional, but this would give us more flexibility. We can always default to the first cpu (+ hyperthreading siblings?) when the annotation is missing of course.

@bitoku
Copy link
Contributor Author

bitoku commented Jul 4, 2025

Thanks @MarSik .
Yeah it may be a good idea to have that option.
I made the option extendable so we can add options later.
I'll keep this PR as it is for now.

@bitoku bitoku force-pushed the exec-cpu-affinity branch 2 times, most recently from 1cffaf0 to 6795b02 Compare July 7, 2025 13:10
@bitoku
Copy link
Contributor Author

bitoku commented Jul 7, 2025

/retest

Comment on lines 773 to 825
BeforeEach(func() {
sbox := sandbox.NewBuilder()
createdAt := time.Now()
sbox.SetCreatedAt(createdAt)
sbox.SetID("sandboxID")
sbox.SetName("sandboxName")
sbox.SetLogDir("test")
sbox.SetShmPath("test")
sbox.SetNamespace("")
sbox.SetKubeName("")
sbox.SetMountLabel("test")
sbox.SetProcessLabel("test")
sbox.SetCgroupParent("")
sbox.SetRuntimeHandler("")
sbox.SetResolvPath("")
sbox.SetHostname("")
sbox.SetPortMappings([]*hostport.PortMapping{})
sbox.SetHostNetwork(false)
sbox.SetUsernsMode("")
sbox.SetPodLinuxOverhead(nil)
sbox.SetPodLinuxResources(nil)
err = sbox.SetCRISandbox(sbox.ID(), make(map[string]string), map[string]string{}, &types.PodSandboxMetadata{})
Expect(err).ToNot(HaveOccurred())
sbox.SetPrivileged(false)
sbox.SetHostNetwork(false)
sbox.SetCreatedAt(createdAt)
sbNoShared, err = sbox.GetSandbox()
Expect(err).ToNot(HaveOccurred())
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding the unit tests. Instead of nesting the Describe and duplicating the BeforeEach, it would be cleaner to restructure the original "Precreate hook" test to use the "Context"/"BeforeEach" pattern (see other tests in this file) and pass in the crioannotations for each test, which seems to be the only thing that differs here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated. let me know how it looks.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks great - thanks for updating/extending the unit tests.

@haircommander
Copy link
Member

@MarSik I thought @browsell mentioned users don't want another annotation. Maybe we have an additional option to have the range be configurable and introduce both the configurable range, the First, and the default?

@browsell
Copy link
Contributor

browsell commented Jul 8, 2025

@MarSik I thought @browsell mentioned users don't want another annotation. Maybe we have an additional option to have the range be configurable and introduce both the configurable range, the First, and the default?

We do not want to add any additional annotations.

@bitoku bitoku force-pushed the exec-cpu-affinity branch 2 times, most recently from 313af6a to 1d88711 Compare July 8, 2025 16:20
@bitoku bitoku force-pushed the exec-cpu-affinity branch from 1d88711 to 5b34b0a Compare July 9, 2025 11:16
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 9, 2025
@haircommander
Copy link
Member

you've got a merge conflict

@bitoku bitoku force-pushed the exec-cpu-affinity branch from 90ee92e to a46fd45 Compare July 9, 2025 17:12
@bitoku
Copy link
Contributor Author

bitoku commented Jul 10, 2025

@cri-o/cri-o-maintainers PTAL

// Don't set ExecCPUAffinity, which means using runtime default.
default:
// This shouldn't happen because there's config validation.
log.Errorf(ctx, "Unknown ExecCPUAffinityType %s is used. Falling back to default.", h.execCPUAffinity)
Copy link
Member

Choose a reason for hiding this comment

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

if this shouldn't happen we should panic here because it's a coding error that should be caught by testing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It makes sense, but I wonder if we can find it in test because cri-o runs as a service, and get restarted easily.
I'd rather returning error instead of panic, which don't break entire system, but still have a chance to catch coding errors I guess.

@haircommander
Copy link
Member

/override ci/prow/ci-e2e-evented-pleg

still LGTM, one more nit if you have time but not a blocker

do any other @cri-o/cri-o-maintainers want to TAL?

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 10, 2025

@haircommander: Overrode contexts on behalf of haircommander: ci/prow/ci-e2e-evented-pleg

In response to this:

/override ci/prow/ci-e2e-evented-pleg

still LGTM, one more nit if you have time but not a blocker

do any other @cri-o/cri-o-maintainers want to TAL?

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.

Signed-off-by: Ayato Tokubi <[email protected]>
@bitoku bitoku force-pushed the exec-cpu-affinity branch from a46fd45 to 4dd7fb9 Compare July 11, 2025 13:19
@bitoku
Copy link
Contributor Author

bitoku commented Jul 11, 2025

/test ci-cgroupv2-e2e-crun

@bitoku
Copy link
Contributor Author

bitoku commented Jul 12, 2025

/retest

2 similar comments
@bitoku
Copy link
Contributor Author

bitoku commented Jul 14, 2025

/retest

@bitoku
Copy link
Contributor Author

bitoku commented Jul 15, 2025

/retest

@bitoku
Copy link
Contributor Author

bitoku commented Jul 15, 2025

/skip

@bitoku
Copy link
Contributor Author

bitoku commented Jul 16, 2025

/retest

@bitoku
Copy link
Contributor Author

bitoku commented Jul 28, 2025

@cri-o/cri-o-maintainers PTAL

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

openshift-ci bot commented Jul 28, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bitoku, haircommander, saschagrunert

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,saschagrunert]

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

@bitoku
Copy link
Contributor Author

bitoku commented Jul 28, 2025

/retest

2 similar comments
@bitoku
Copy link
Contributor Author

bitoku commented Jul 28, 2025

/retest

@bitoku
Copy link
Contributor Author

bitoku commented Jul 29, 2025

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 29, 2025

@bitoku: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/ci-e2e-evented-pleg 4dd7fb9 link false /test ci-e2e-evented-pleg

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@bitoku
Copy link
Contributor Author

bitoku commented Jul 29, 2025

/retest

@openshift-merge-bot openshift-merge-bot bot merged commit 51ce3dd into cri-o:main Jul 29, 2025
87 of 89 checks passed
@bitoku bitoku deleted the exec-cpu-affinity branch July 30, 2025 11:04
@bitoku
Copy link
Contributor Author

bitoku commented Jul 31, 2025

/cherry-pick release-1.33

@openshift-cherrypick-robot

@bitoku: #9286 failed to apply on top of branch "release-1.33":

Applying: Set ExecCPUAffinity
Using index info to reconstruct a base tree...
M	internal/runtimehandlerhooks/high_performance_hooks_linux.go
M	pkg/config/config.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/config/config.go
CONFLICT (content): Merge conflict in pkg/config/config.go
Auto-merging internal/runtimehandlerhooks/high_performance_hooks_linux.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Set ExecCPUAffinity

In response to this:

/cherry-pick release-1.33

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.

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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. kind/feature Categorizes issue or PR as related to a new feature. 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.

9 participants