-
Notifications
You must be signed in to change notification settings - Fork 731
OCPNODE-4601: Add {system,container}GomaxprocsBehavior field #2934
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's also add some tests to https://github.com/openshift/api/tree/2cee386cfdcf4c00938f0683cc4555d5120944a8/machineconfiguration/v1/tests |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -768,6 +768,22 @@ type KubeletConfigSpec struct { | |
| // When specified, the type field can be set to either "Old", "Intermediate", "Modern", "Custom" or omitted for backward compatibility. | ||
| // +optional | ||
| TLSSecurityProfile *configv1.TLSSecurityProfile `json:"tlsSecurityProfile,omitempty"` | ||
|
|
||
| // systemGomaxprocsBehavior controls whether the kubelet-auto-node-size service automatically configures | ||
| // GOMAXPROCS for kubelet and CRI-O system services based on the system reserved CPU allocation. | ||
| // Valid values are "Autosize" and "Disabled". | ||
| // When set to "Autosize", the GOMAXPROCS environment variable for kubelet and CRI-O is set to | ||
| // max(ceil(system_reserved_cpu), 1). This optimizes the runtime parallelism of these Go-based system | ||
| // services based on their CPU allocation rather than total node capacity. | ||
| // When set to "Disabled", automatic GOMAXPROCS configuration is disabled and the system services | ||
| // use Go's default GOMAXPROCS behavior. | ||
| // When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. | ||
| // The current default is "Disabled". | ||
| // | ||
| // +openshift:enable:FeatureGate=GomaxprocsInjection | ||
| // +optional | ||
| // +kubebuilder:validation:Enum=Autosize;Disabled | ||
| SystemGomaxprocsBehavior SystemGomaxprocsBehaviorType `json:"systemGomaxprocsBehavior,omitempty"` | ||
| } | ||
|
|
||
| // KubeletConfigStatus defines the observed state of a KubeletConfig | ||
|
|
@@ -962,6 +978,27 @@ type ContainerRuntimeConfiguration struct { | |
| // +kubebuilder:validation:MaxItems=10 | ||
| // +kubebuilder:validation:XValidation:rule="self.all(x, self.exists_one(y, x.path == y.path))",message="additionalArtifactStores must not contain duplicate paths" | ||
| AdditionalArtifactStores []AdditionalArtifactStore `json:"additionalArtifactStores,omitempty"` | ||
|
|
||
| // containerGomaxprocsBehavior controls whether CRI-O automatically injects the GOMAXPROCS environment variable into containers | ||
| // based on their CPU resource requests. | ||
| // Valid values are "Autosize" and "Disabled". | ||
| // When set to "Autosize", CRI-O will automatically set GOMAXPROCS proportional to the container's CPU request, | ||
| // calculated as max(ceil(cpu_request_in_cores * 2), 1). This helps Go applications optimize their runtime parallelism | ||
| // based on the allocated CPU resources rather than the total node capacity. | ||
| // When set to "Disabled", GOMAXPROCS injection is disabled and containers will use Go's default GOMAXPROCS behavior. | ||
| // When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. | ||
| // The current default is "Disabled". | ||
| // | ||
| // Containers can override the injected GOMAXPROCS value by: | ||
| // - Setting GOMAXPROCS in the container image Dockerfile (ENV GOMAXPROCS=...) | ||
| // - Setting GOMAXPROCS in the pod spec (env or envFrom) | ||
| // - Calling runtime.GOMAXPROCS() programmatically in Go code | ||
| // - Adding the skip-gomaxprocs.crio.io annotation to the pod | ||
| // | ||
| // +openshift:enable:FeatureGate=GomaxprocsInjection | ||
| // +optional | ||
| // +kubebuilder:validation:Enum=Autosize;Disabled | ||
| ContainerGomaxprocsBehavior ContainerGomaxprocsBehaviorType `json:"containerGomaxprocsBehavior,omitempty"` | ||
| } | ||
|
|
||
| type ContainerRuntimeDefaultRuntime string | ||
|
|
@@ -974,6 +1011,30 @@ const ( | |
| ContainerRuntimeDefaultRuntimeDefault = ContainerRuntimeDefaultRuntimeCrun | ||
| ) | ||
|
|
||
| // ContainerGomaxprocsBehaviorType specifies whether CRI-O should inject GOMAXPROCS into containers | ||
| type ContainerGomaxprocsBehaviorType string | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can probably merge Container and System behaviour types into one, unless you foresee them branching in the future? I don't think you necessarily need to define the default as a const as well - the general pattern is that we document it in the godocs, and then have the implementing controller do the necessary default implementation. |
||
|
|
||
| const ( | ||
| // ContainerGomaxprocsBehaviorAutosize enables automatic GOMAXPROCS injection based on CPU requests | ||
| ContainerGomaxprocsBehaviorAutosize ContainerGomaxprocsBehaviorType = "Autosize" | ||
| // ContainerGomaxprocsBehaviorDisabled disables GOMAXPROCS injection | ||
| ContainerGomaxprocsBehaviorDisabled ContainerGomaxprocsBehaviorType = "Disabled" | ||
| // ContainerGomaxprocsBehaviorDefault is the default behavior | ||
| ContainerGomaxprocsBehaviorDefault = ContainerGomaxprocsBehaviorDisabled | ||
| ) | ||
|
|
||
| // SystemGomaxprocsBehaviorType specifies whether system services should have GOMAXPROCS automatically configured | ||
| type SystemGomaxprocsBehaviorType string | ||
|
|
||
| const ( | ||
| // SystemGomaxprocsBehaviorAutosize enables automatic GOMAXPROCS configuration for system services based on system reserved CPU | ||
| SystemGomaxprocsBehaviorAutosize SystemGomaxprocsBehaviorType = "Autosize" | ||
| // SystemGomaxprocsBehaviorDisabled disables automatic GOMAXPROCS configuration for system services | ||
| SystemGomaxprocsBehaviorDisabled SystemGomaxprocsBehaviorType = "Disabled" | ||
| // SystemGomaxprocsBehaviorDefault is the default behavior | ||
| SystemGomaxprocsBehaviorDefault = SystemGomaxprocsBehaviorDisabled | ||
| ) | ||
|
|
||
| // StorePath is an absolute filesystem path used by additional container storage configurations. | ||
| // The path must be between 1 and 256 characters long, begin with a forward slash, and only contain | ||
| // the characters a-z, A-Z, 0-9, '/', '.', '_', and '-'. Consecutive forward slashes are not permitted. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use node as the primary component here?