Skip to content

Commit fd3eecb

Browse files
haircommanderclaude
andcommitted
Add system service-level GOMAXPROCS configuration support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d206ded commit fd3eecb

11 files changed

Lines changed: 505 additions & 0 deletions
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
2+
name: "KubeletConfig"
3+
crdName: kubeletconfigs.machineconfiguration.openshift.io
4+
featureGates:
5+
- GomaxprocsInjection
6+
tests:
7+
onCreate:
8+
- name: Should be able to create KubeletConfig with systemGomaxprocsBehavior set to Autosize
9+
initial: |
10+
apiVersion: machineconfiguration.openshift.io/v1
11+
kind: KubeletConfig
12+
spec:
13+
systemGomaxprocsBehavior: Autosize
14+
expected: |
15+
apiVersion: machineconfiguration.openshift.io/v1
16+
kind: KubeletConfig
17+
spec:
18+
systemGomaxprocsBehavior: Autosize
19+
20+
- name: Should be able to create KubeletConfig with systemGomaxprocsBehavior set to Disabled
21+
initial: |
22+
apiVersion: machineconfiguration.openshift.io/v1
23+
kind: KubeletConfig
24+
spec:
25+
systemGomaxprocsBehavior: Disabled
26+
expected: |
27+
apiVersion: machineconfiguration.openshift.io/v1
28+
kind: KubeletConfig
29+
spec:
30+
systemGomaxprocsBehavior: Disabled
31+
32+
- name: Should fail if systemGomaxprocsBehavior has an invalid value
33+
initial: |
34+
apiVersion: machineconfiguration.openshift.io/v1
35+
kind: KubeletConfig
36+
spec:
37+
systemGomaxprocsBehavior: Enabled
38+
expectedError: "spec.systemGomaxprocsBehavior: Unsupported value"
39+
40+
- name: Should be able to create KubeletConfig without systemGomaxprocsBehavior
41+
initial: |
42+
apiVersion: machineconfiguration.openshift.io/v1
43+
kind: KubeletConfig
44+
spec: {}
45+
expected: |
46+
apiVersion: machineconfiguration.openshift.io/v1
47+
kind: KubeletConfig
48+
spec: {}

machineconfiguration/v1/types.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,21 @@ type KubeletConfigSpec struct {
769769
// +optional
770770
TLSSecurityProfile *configv1.TLSSecurityProfile `json:"tlsSecurityProfile,omitempty"`
771771

772+
// systemGomaxprocsBehavior controls whether the kubelet-auto-node-size service automatically configures
773+
// GOMAXPROCS for kubelet and CRI-O system services based on the system reserved CPU allocation.
774+
// Valid values are "Autosize" and "Disabled".
775+
// When set to "Autosize", the GOMAXPROCS environment variable for kubelet and CRI-O is set to
776+
// max(ceil(system_reserved_cpu), 1). This optimizes the runtime parallelism of these Go-based system
777+
// services based on their CPU allocation rather than total node capacity.
778+
// When set to "Disabled", automatic GOMAXPROCS configuration is disabled and the system services
779+
// use Go's default GOMAXPROCS behavior.
780+
// When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
781+
// The current default is "Disabled".
782+
//
783+
// +openshift:enable:FeatureGate=GomaxprocsInjection
784+
// +optional
785+
// +kubebuilder:validation:Enum=Autosize;Disabled
786+
SystemGomaxprocsBehavior GomaxprocsBehaviorType `json:"systemGomaxprocsBehavior,omitempty"`
772787
}
773788

774789
// KubeletConfigStatus defines the observed state of a KubeletConfig

machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_kubeletconfigs-CustomNoUpgrade.crd.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,22 @@ spec:
123123
type: object
124124
type: object
125125
x-kubernetes-map-type: atomic
126+
systemGomaxprocsBehavior:
127+
description: |-
128+
systemGomaxprocsBehavior controls whether the kubelet-auto-node-size service automatically configures
129+
GOMAXPROCS for kubelet and CRI-O system services based on the system reserved CPU allocation.
130+
Valid values are "Autosize" and "Disabled".
131+
When set to "Autosize", the GOMAXPROCS environment variable for kubelet and CRI-O is set to
132+
max(ceil(system_reserved_cpu), 1). This optimizes the runtime parallelism of these Go-based system
133+
services based on their CPU allocation rather than total node capacity.
134+
When set to "Disabled", automatic GOMAXPROCS configuration is disabled and the system services
135+
use Go's default GOMAXPROCS behavior.
136+
When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
137+
The current default is "Disabled".
138+
enum:
139+
- Autosize
140+
- Disabled
141+
type: string
126142
tlsSecurityProfile:
127143
description: |-
128144
tlsSecurityProfile configures TLS settings for the kubelet.

machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_kubeletconfigs-DevPreviewNoUpgrade.crd.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,22 @@ spec:
123123
type: object
124124
type: object
125125
x-kubernetes-map-type: atomic
126+
systemGomaxprocsBehavior:
127+
description: |-
128+
systemGomaxprocsBehavior controls whether the kubelet-auto-node-size service automatically configures
129+
GOMAXPROCS for kubelet and CRI-O system services based on the system reserved CPU allocation.
130+
Valid values are "Autosize" and "Disabled".
131+
When set to "Autosize", the GOMAXPROCS environment variable for kubelet and CRI-O is set to
132+
max(ceil(system_reserved_cpu), 1). This optimizes the runtime parallelism of these Go-based system
133+
services based on their CPU allocation rather than total node capacity.
134+
When set to "Disabled", automatic GOMAXPROCS configuration is disabled and the system services
135+
use Go's default GOMAXPROCS behavior.
136+
When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
137+
The current default is "Disabled".
138+
enum:
139+
- Autosize
140+
- Disabled
141+
type: string
126142
tlsSecurityProfile:
127143
description: |-
128144
tlsSecurityProfile configures TLS settings for the kubelet.

machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_kubeletconfigs-TechPreviewNoUpgrade.crd.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,22 @@ spec:
123123
type: object
124124
type: object
125125
x-kubernetes-map-type: atomic
126+
systemGomaxprocsBehavior:
127+
description: |-
128+
systemGomaxprocsBehavior controls whether the kubelet-auto-node-size service automatically configures
129+
GOMAXPROCS for kubelet and CRI-O system services based on the system reserved CPU allocation.
130+
Valid values are "Autosize" and "Disabled".
131+
When set to "Autosize", the GOMAXPROCS environment variable for kubelet and CRI-O is set to
132+
max(ceil(system_reserved_cpu), 1). This optimizes the runtime parallelism of these Go-based system
133+
services based on their CPU allocation rather than total node capacity.
134+
When set to "Disabled", automatic GOMAXPROCS configuration is disabled and the system services
135+
use Go's default GOMAXPROCS behavior.
136+
When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
137+
The current default is "Disabled".
138+
enum:
139+
- Autosize
140+
- Disabled
141+
type: string
126142
tlsSecurityProfile:
127143
description: |-
128144
tlsSecurityProfile configures TLS settings for the kubelet.

machineconfiguration/v1/zz_generated.featuregated-crd-manifests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ kubeletconfigs.machineconfiguration.openshift.io:
8888
Capability: ""
8989
Category: ""
9090
FeatureGates:
91+
- GomaxprocsInjection
9192
- TLSGroupPreferences
9293
FilenameOperatorName: machine-config
9394
FilenameOperatorOrdering: "01"

0 commit comments

Comments
 (0)