Skip to content

[release-1.35] Add min_injected_gomaxprocs via runtime handler precreate hook#9876

Merged
openshift-merge-bot[bot] merged 1 commit into
cri-o:release-1.35from
openshift-cherrypick-robot:cherry-pick-9860-to-release-1.35
Apr 14, 2026
Merged

[release-1.35] Add min_injected_gomaxprocs via runtime handler precreate hook#9876
openshift-merge-bot[bot] merged 1 commit into
cri-o:release-1.35from
openshift-cherrypick-robot:cherry-pick-9860-to-release-1.35

Conversation

@openshift-cherrypick-robot

Copy link
Copy Markdown

This is an automated cherry-pick of #9860

/assign haircommander

add min_injected_gomaxprocs option, which allows a user to specify GOMAXPROCS in every container CRI-O creates. The config field itself is an integer that represents the floor of GOMAXPROCS. CRI-O will inject max(floor, cpu.request), if the pod is not a guaranteed pod or is part of a partitioned workload

Implement GOMAXPROCS injection as a composable PreCreate runtime handler
hook instead of inline logic in container_create.go. This follows the
existing CRI-O hook architecture (like HighPerformanceHooks) and allows
the GOMAXPROCS hook to compose with other hooks via CompositeHooks.

Key changes:
- GomaxprocsHooks: PreCreate hook that reads CPU shares from the OCI
  spec, calculates GOMAXPROCS with a configurable floor, and injects
  the env var for burstable/best-effort pods
- CompositeHooks: chains multiple RuntimeHandlerHooks implementations,
  enabling GOMAXPROCS to work alongside high-performance hooks
- HooksRetriever.Get(): builds a hook chain when inject_gomaxprocs > 0
- Config field, CLI flag, annotation, docs, completions, and tests

The hook fires for all OCI runtimes and skips guaranteed pods,
workload-partitioned pods, pods with CPU limits (Go 1.25+ auto-detects),
and pods that already have GOMAXPROCS set.

Signed-off-by: Peter Hunt <pehunt@redhat.com>
Co-authored-by: Harshal Patil <12152047+harche@users.noreply.github.com>
@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. labels Apr 10, 2026
@coderabbitai

coderabbitai Bot commented Apr 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4069f84e-2501-4142-b54c-aaf697cc831e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot requested review from QiWang19 and littlejawa April 10, 2026 19:15
@haircommander

Copy link
Copy Markdown
Member

/lgtm
/approve

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 10, 2026
@openshift-ci

openshift-ci Bot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haircommander, openshift-cherrypick-robot

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

The pull request process is described here

Details Needs approval from an approver in each of these files:

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 10, 2026
@haircommander

Copy link
Copy Markdown
Member

/cherry-pick release-1.34

@openshift-cherrypick-robot

Copy link
Copy Markdown
Author

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

Details

In response to this:

/cherry-pick release-1.34

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.

@codecov

codecov Bot commented Apr 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.98374% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.74%. Comparing base (fb90456) to head (075322e).
⚠️ Report is 4 commits behind head on release-1.35.

Additional details and impacted files
@@               Coverage Diff                @@
##           release-1.35    #9876      +/-   ##
================================================
- Coverage         67.74%   67.74%   -0.01%     
================================================
  Files               211      213       +2     
  Lines             29294    29412     +118     
================================================
+ Hits              19845    19924      +79     
- Misses             7766     7799      +33     
- Partials           1683     1689       +6     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@haircommander

Copy link
Copy Markdown
Member

/retest

@haircommander

Copy link
Copy Markdown
Member

/retest
/cherry-pick release-1.34

@openshift-cherrypick-robot

Copy link
Copy Markdown
Author

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

Details

In response to this:

/retest
/cherry-pick release-1.34

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.

@haircommander

Copy link
Copy Markdown
Member

/override ci/prow/e2e-gcp-ovn

@openshift-ci

openshift-ci Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

@haircommander: Overrode contexts on behalf of haircommander: ci/prow/e2e-gcp-ovn

Details

In response to this:

/override ci/prow/e2e-gcp-ovn

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.

@openshift-merge-bot openshift-merge-bot Bot merged commit 5f05147 into cri-o:release-1.35 Apr 14, 2026
51 checks passed
@openshift-cherrypick-robot

Copy link
Copy Markdown
Author

@haircommander: #9876 failed to apply on top of branch "release-1.34":

Applying: Add inject_gomaxprocs via runtime handler precreate hook
Using index info to reconstruct a base tree...
M	completions/bash/crio
M	completions/fish/crio.fish
M	completions/zsh/_crio
M	docs/crio.8.md
M	docs/crio.conf.5.md
M	internal/criocli/criocli.go
M	internal/runtimehandlerhooks/runtime_handler_hooks_linux.go
A	pkg/annotations/v2/annotations.go
M	pkg/config/config.go
M	pkg/config/template.go
M	pkg/config/workloads.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/config/workloads.go
Auto-merging pkg/config/template.go
Auto-merging pkg/config/config.go
CONFLICT (content): Merge conflict in pkg/config/config.go
CONFLICT (modify/delete): pkg/annotations/v2/annotations.go deleted in HEAD and modified in Add inject_gomaxprocs via runtime handler precreate hook. Version Add inject_gomaxprocs via runtime handler precreate hook of pkg/annotations/v2/annotations.go left in tree.
Auto-merging internal/runtimehandlerhooks/runtime_handler_hooks_linux.go
Auto-merging internal/criocli/criocli.go
CONFLICT (content): Merge conflict in internal/criocli/criocli.go
Auto-merging docs/crio.conf.5.md
Auto-merging docs/crio.8.md
Auto-merging completions/zsh/_crio
Auto-merging completions/fish/crio.fish
Auto-merging completions/bash/crio
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 set advice.mergeConflict false"
Patch failed at 0001 Add inject_gomaxprocs via runtime handler precreate hook

Details

In response to this:

/retest
/cherry-pick release-1.34

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. 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.

3 participants