Skip to content

Add package standardflags for -automaxprocs commandline argument #193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2025

Conversation

nixpanic
Copy link
Member

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test

/kind feature

/kind flake

What this PR does / why we need it:

The new -automaxprocs flag can be used to set the GOMAXPROCS environment variable to match the configured Linux container CPU quota.

Which issue(s) this PR fixes:

Related: kubernetes-csi/node-driver-registrar#495

Special notes for your reviewer:

Applications can call EnableAutomaxprocs() to enable it during startup.

Does this PR introduce a user-facing change?:

The AddAutomaxprocs() function adds the -automaxprocs boolean flag to the commandline options. By default the flag is disabled.

The AddAutomaxprocs() function adds the -automaxprocs boolean flag to
the commandline options. By default the flag is disabled.

Applications can call EnableAutomaxprocs() to enable it during startup.
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. labels Apr 25, 2025
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Apr 25, 2025
@nixpanic
Copy link
Member Author

/cc jsafrane

@xing-yang
Copy link
Contributor

What are the requirements for using this flag properly?

@nixpanic
Copy link
Member Author

What are the requirements for using this flag properly?

The flag only has effect when the container where the application runs has CPU limits configured.

The maxprocs package reads the CPU quota from cgroups under /sys/... and sets the GOMAXPROCS environment variable based on the CPU quota. If CPU quota is not configured, or not supported, the flag does not have any effect.

@xing-yang
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 17, 2025
@jsafrane
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jsafrane, nixpanic

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:

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 20, 2025
@k8s-ci-robot k8s-ci-robot merged commit 36bffce into kubernetes-csi:master May 20, 2025
3 checks passed
mauriciopoppe added a commit to mauriciopoppe/csi-sidecars-aio-poc that referenced this pull request May 24, 2025
kubernetes-csi/csi-lib-utils#193 added a flag
across all the sidecars. In this repo that flag should only be
defined once.
mauriciopoppe added a commit to mauriciopoppe/csi-sidecars-aio-poc that referenced this pull request May 24, 2025
kubernetes-csi/csi-lib-utils#193 added a flag
across all the sidecars. In this repo that flag should only be
defined once.
mauriciopoppe added a commit to mauriciopoppe/csi-sidecars-aio-poc that referenced this pull request May 24, 2025
kubernetes-csi/csi-lib-utils#193 added a flag across all the sidecars. In this repo that flag should only be defined once.
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", 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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants