Skip to content

OCPNODE-4602: implement {system,container}GomaxprocsBehavior field - #6332

Open
haircommander wants to merge 3 commits into
openshift:mainfrom
haircommander:gomaxprocs
Open

OCPNODE-4602: implement {system,container}GomaxprocsBehavior field#6332
haircommander wants to merge 3 commits into
openshift:mainfrom
haircommander:gomaxprocs

Conversation

@haircommander

@haircommander haircommander commented Jul 23, 2026

Copy link
Copy Markdown
Member

- What I did
implement openshift/enhancements#2047
- How to verify it

- Description for the changelog

Summary by CodeRabbit

  • New Features

    • Added feature-gated GOMAXPROCS configuration for kubelet and CRI-O.
    • Autosize mode calculates and applies GOMAXPROCS values from reserved CPU capacity.
    • Added support for configuring this behavior through node-sizing settings.
    • Disabled mode removes previously generated GOMAXPROCS service settings.
  • Bug Fixes

    • Ensured GOMAXPROCS settings are consistently applied or removed during configuration updates.
    • Preserved existing container runtime configuration when the feature is disabled.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 23, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@haircommander: This pull request references OCPNODE-4602 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 "5.0.0" version, but no target version was set.

Details

In response to this:

- What I did
implement openshift/enhancements#2047
- How to verify it

- Description for the changelog

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-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 088e8104-aad9-4aef-9698-db2c8e8162ad

📥 Commits

Reviewing files that changed from the base of the PR and between 6845c13 and 01fedf4.

📒 Files selected for processing (1)
  • pkg/controller/kubelet-config/helpers.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/controller/kubelet-config/helpers.go

Included review availability: Your plan includes up to 12 reviews per rolling hour; 11 remain after this review.


Walkthrough

The change adds feature-gated GOMAXPROCS configuration across CRI-O drop-ins, kubelet Ignition generation, and node-sizing systemd templates. Tests cover autosize, disabled, gate-disabled, and empty behavior.

Changes

GOMAXPROCS injection

Layer / File(s) Summary
Kubelet behavior propagation
pkg/controller/kubelet-config/*
Kubelet bootstrap and reconciliation pass gated SystemGomaxprocsBehavior into Ignition generation. Generated environment files contain SYSTEM_GOMAXPROCS_BEHAVIOR. Tests cover generated content and file creation.
CRI-O drop-in generation
pkg/controller/container-runtime-config/*, go.mod
The feature gate flows through CRI-O reconciliation. CRI-O generates min_injected_gomaxprocs values of 1 for autosize and 0 for disabled behavior. Tests cover gating and coexistence with existing drop-ins.
Node-sizing systemd configuration
templates/*/files/kubelet-auto-node-sizing-enabled.yaml, templates/common/_base/files/kubelet-auto-sizing.yaml
Templates define SYSTEM_GOMAXPROCS_BEHAVIOR. Node sizing creates or removes kubelet and CRI-O GOMAXPROCS drop-ins and computes GOMAXPROCS from reserved CPU.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 01fed

This change implements configurable system and container GOMAXPROCS behavior, and no actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant FeatureGateHandler
  participant KubeletController
  participant KubeletIgnition
  participant ContainerRuntimeController
  participant CRIODropinGenerator
  participant NodeSizing
  FeatureGateHandler->>KubeletController: provide gomaxprocs gate state
  KubeletController->>KubeletIgnition: pass SystemGomaxprocsBehavior
  KubeletIgnition->>NodeSizing: emit SYSTEM_GOMAXPROCS_BEHAVIOR
  FeatureGateHandler->>ContainerRuntimeController: provide gomaxprocs gate state
  ContainerRuntimeController->>CRIODropinGenerator: pass gomaxprocsInjectionEnabled
  CRIODropinGenerator->>NodeSizing: configure CRI-O gomaxprocs drop-in
  NodeSizing->>NodeSizing: compute or remove GOMAXPROCS configuration
Loading

Suggested reviewers: cheesesashimi, hasan4791

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: implementing system- and container-level GomaxprocsBehavior fields.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The PR adds standard Go tests with static Test and t.Run names; no Ginkgo It, Describe, Context, When, or similar titles were added or changed.
Test Structure And Quality ✅ Passed The PR adds only standard-library testing.T tests in the changed test files; no Ginkgo It blocks or cluster waits are introduced.
Microshift Test Compatibility ✅ Passed The cumulative diff adds only ordinary Go Test... unit tests and no new Ginkgo It/Describe tests, so the MicroShift compatibility check does not apply.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The diff adds only standard Go unit tests (Test...) in controller helper packages; it adds no Ginkgo e2e tests or multi-node assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed The PR changes MachineConfig, CRI-O, kubelet, and node-sizing configuration only; diff scans found no affinity, spread, selectors, tolerations, replicas, PDB, or workload resources.
Ote Binary Stdout Contract ✅ Passed The PR diff changes no OTE binary entry point or suite setup. The only new logging call is klog in a controller helper, and OTE tests do not import that package.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR adds only Go unit tests using testing.T; no new Ginkgo e2e tests, IPv4-only assumptions, or external connectivity requirements were found.
No-Weak-Crypto ✅ Passed The exact HEAD^..HEAD patch adds GOMAXPROCS configuration and arithmetic only; searches found no weak crypto primitives, crypto APIs, custom crypto, or secret/token comparisons.
Container-Privileges ✅ Passed The complete PR diff adds no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, or allowPrivilegeEscalation settings; changes add only GOMAXPROCS environment and systemd drop-ins.
No-Sensitive-Data-In-Logs ✅ Passed I am still investigating the changed code for logging of passwords, tokens, API keys, PII, session IDs, hostnames, or customer data.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: haircommander
Once this PR has been reviewed and has the lgtm label, please assign isabella-janssen for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@haircommander

Copy link
Copy Markdown
Member Author

/test unit

1 similar comment
@haircommander

Copy link
Copy Markdown
Member Author

/test unit

@isabella-janssen

Copy link
Copy Markdown
Member

/hold

Holding to allow the Kube rebase to land in #6321. Please ensure this will not cause merge conflicts for the Kube rebase before unholding this PR.

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 28, 2026
@isabella-janssen

Copy link
Copy Markdown
Member

/unhold

Kube rebase landed

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 29, 2026
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 17, 2026
haircommander and others added 2 commits August 17, 2026 15:44
Signed-off-by: Peter Hunt <pehunt@redhat.com>
…ed_gomaxprocs

Implement the container-level half of the GOMAXPROCS injection feature.
When the GomaxprocsInjection feature gate is enabled, the
ContainerGomaxprocsBehavior field on ContainerRuntimeConfig translates
to CRI-O's min_injected_gomaxprocs setting via a crio.conf.d drop-in:
Autosize sets it to 1 (enabling CRI-O's per-container GOMAXPROCS
injection) and Disabled sets it to 0.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Peter Hunt <pehunt@redhat.com>
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 17, 2026
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@openshift-ci-robot

openshift-ci-robot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

@haircommander: This pull request references OCPNODE-4602 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 "5.1.0" version, but no target version was set.

Details

In response to this:

- What I did
implement openshift/enhancements#2047
- How to verify it

- Description for the changelog

Summary by CodeRabbit

  • New Features

  • Added feature-gated GOMAXPROCS configuration for kubelet and CRI-O.

  • Autosize mode calculates and applies GOMAXPROCS values from reserved CPU capacity.

  • Added support for configuring this behavior through node-sizing settings.

  • Disabled mode removes previously generated GOMAXPROCS service settings.

  • Bug Fixes

  • Ensured GOMAXPROCS settings are consistently applied or removed during configuration updates.

  • Preserved existing container runtime configuration when the feature is disabled.

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.

Implement the system-service half of the GOMAXPROCS injection feature.
When the GomaxprocsInjection feature gate is enabled and
SystemGomaxprocsBehavior is set to Autosize on KubeletConfig, the
node-sizing script calculates GOMAXPROCS as max(ceil(system_reserved_cpu), 1)
and writes systemd drop-in files (30-gomaxprocs.conf) for both
kubelet.service and crio.service. Switching away from Autosize cleans
up the drop-ins.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Peter Hunt <pehunt@redhat.com>
@openshift-ci

openshift-ci Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

@haircommander: 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/perfscale-control-plane-6nodes 01fedf4 link false /test perfscale-control-plane-6nodes

Full PR test history. Your PR dashboard.

Details

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.

@haircommander

Copy link
Copy Markdown
Member Author

@yuqi-zhang PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants