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 system GOMAXPROCS configuration for kubelet and CRI-O.
    • Autosize mode now calculates and applies GOMAXPROCS values from reserved CPU capacity.
    • Disabled mode removes previously generated GOMAXPROCS service settings.
    • Added support for configuring this behavior through node-sizing environment settings.
  • Bug Fixes

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

haircommander and others added 3 commits July 23, 2026 15:15
Add GomaxprocsBehaviorType, ContainerGomaxprocsBehavior, and
SystemGomaxprocsBehavior fields to the vendored API types, along with
the FeatureGateGomaxprocsInjection feature gate definition. These
changes mirror openshift/api PR openshift#2934 and will be replaced by a proper
vendor bump once that PR merges.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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>
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-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: ea0ec591-23d5-486e-b613-3de2ad91bc7e

📥 Commits

Reviewing files that changed from the base of the PR and between 067b924 and e6d5d44.

⛔ Files ignored due to path filters (2)
  • vendor/github.com/openshift/api/features/features.go is excluded by !**/vendor/**, !vendor/**
  • vendor/github.com/openshift/api/machineconfiguration/v1/types.go is excluded by !**/vendor/**, !vendor/**
📒 Files selected for processing (13)
  • pkg/controller/container-runtime-config/container_runtime_config_bootstrap.go
  • pkg/controller/container-runtime-config/container_runtime_config_controller.go
  • pkg/controller/container-runtime-config/helpers.go
  • pkg/controller/container-runtime-config/helpers_test.go
  • pkg/controller/kubelet-config/helpers.go
  • pkg/controller/kubelet-config/helpers_test.go
  • pkg/controller/kubelet-config/kubelet_config_bootstrap.go
  • pkg/controller/kubelet-config/kubelet_config_controller.go
  • templates/arbiter/00-arbiter/_base/files/kubelet-auto-node-sizing-enabled.yaml
  • templates/common/_base/files/kubelet-auto-node-sizing-enabled.yaml
  • templates/common/_base/files/kubelet-auto-sizing.yaml
  • templates/master/00-master/_base/files/kubelet-auto-node-sizing-enabled.yaml
  • templates/master/00-master/two-node-with-fencing/files/kubelet-auto-node-sizing-enabled.yaml

Walkthrough

The change adds feature-gated gomaxprocs configuration across CRI-O drop-ins, kubelet Ignition generation, and node-sizing systemd templates, with tests covering enabled, disabled, autosize, and empty behavior cases.

Changes

Gomaxprocs injection

Layer / File(s) Summary
CRI-O drop-in generation and gating
pkg/controller/container-runtime-config/*
Feature-gate state is propagated through CRI-O bootstrap and reconciliation; gomaxprocs behavior generates min_injected_gomaxprocs values of 1 or 0, with corresponding tests.
Kubelet Ignition propagation
pkg/controller/kubelet-config/*
Feature-gated system gomaxprocs behavior is passed into Ignition generation and emitted as SYSTEM_GOMAXPROCS_BEHAVIOR, with updated and new tests.
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 systemd drop-ins and computes GOMAXPROCS from reserved CPU.

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

Sequence Diagram(s)

sequenceDiagram
  participant FeatureGateHandler
  participant KubeletController
  participant ContainerRuntimeController
  participant KubeletIgnition
  participant CRIODropins
  participant NodeSizing
  FeatureGateHandler->>KubeletController: enable or disable gomaxprocs injection
  KubeletController->>KubeletIgnition: pass systemGomaxprocsBehavior
  KubeletIgnition->>NodeSizing: emit SYSTEM_GOMAXPROCS_BEHAVIOR
  FeatureGateHandler->>ContainerRuntimeController: enable or disable gomaxprocs injection
  ContainerRuntimeController->>CRIODropins: render min_injected_gomaxprocs
  NodeSizing->>CRIODropins: create or remove systemd gomaxprocs drop-in
Loading

Suggested reviewers: qiwang19

🚥 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 summarizes the main change: adding system and container GomaxprocsBehavior support.
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 No Ginkgo-style titles were added, and the new t.Run names are static/descriptive with no dynamic data.
Test Structure And Quality ✅ Passed PASS: The touched tests are plain Go unit tests, not Ginkgo; there are no cluster waits/timeouts or cleanup gaps, and the new subtests are focused.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the changes are unit tests only and use no MicroShift-unsupported APIs/features.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PASS: The added tests are plain testing.T unit tests; no Ginkgo e2e specs or SNO/multi-node assumptions were found.
Topology-Aware Scheduling Compatibility ✅ Passed No deployment/pod scheduling changes were introduced; the PR only adds feature-gated config/env handling and systemd drop-ins, with no nodeSelector/affinity/PDB logic.
Ote Binary Stdout Contract ✅ Passed Touched files are library/controller code only; no main/init/TestMain/suite setup or stdout-writing calls were added.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; touched tests are unit tests and no IPv4-only or external-connectivity assumptions appear in changed files.
No-Weak-Crypto ✅ Passed Scanned all modified files; no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret/token comparisons were present.
Container-Privileges ✅ Passed Changed files only add systemd drop-ins/env vars; no container/K8s manifests gained privileged, host*, SYS_ADMIN, or allowPrivilegeEscalation settings.
No-Sensitive-Data-In-Logs ✅ Passed No new sensitive-data logging found; added logs are generic controller/error messages and no secrets, PII, tokens, or hostnames are emitted.
✨ 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

@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@haircommander: The following tests 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/verify-deps e6d5d44 link true /test verify-deps
ci/prow/unit e6d5d44 link true /test unit
ci/prow/verify e6d5d44 link true /test verify

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.

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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