Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6bc352f

Browse files
authoredMar 20, 2025
Merge pull request kubernetes#130535 from ffromani/cpumanager-policy-options-ga
node: kep-2625: cpu manager policy options GA
2 parents 451d032 + 3c7ed00 commit 6bc352f

File tree

10 files changed

+28
-30
lines changed

10 files changed

+28
-30
lines changed
 

‎cmd/kubelet/app/server.go

+1-9
Original file line numberDiff line numberDiff line change
@@ -826,14 +826,6 @@ func run(ctx context.Context, s *options.KubeletServer, kubeDeps *kubelet.Depend
826826
return fmt.Errorf("--qos-reserved value failed to parse: %w", err)
827827
}
828828

829-
var cpuManagerPolicyOptions map[string]string
830-
if utilfeature.DefaultFeatureGate.Enabled(features.CPUManagerPolicyOptions) {
831-
cpuManagerPolicyOptions = s.CPUManagerPolicyOptions
832-
} else if s.CPUManagerPolicyOptions != nil {
833-
return fmt.Errorf("CPU Manager policy options %v require feature gates %q, %q enabled",
834-
s.CPUManagerPolicyOptions, features.CPUManager, features.CPUManagerPolicyOptions)
835-
}
836-
837829
var topologyManagerPolicyOptions map[string]string
838830
if utilfeature.DefaultFeatureGate.Enabled(features.TopologyManagerPolicyOptions) {
839831
topologyManagerPolicyOptions = s.TopologyManagerPolicyOptions
@@ -877,7 +869,7 @@ func run(ctx context.Context, s *options.KubeletServer, kubeDeps *kubelet.Depend
877869
},
878870
QOSReserved: *experimentalQOSReserved,
879871
CPUManagerPolicy: s.CPUManagerPolicy,
880-
CPUManagerPolicyOptions: cpuManagerPolicyOptions,
872+
CPUManagerPolicyOptions: s.CPUManagerPolicyOptions,
881873
CPUManagerReconcilePeriod: s.CPUManagerReconcilePeriod.Duration,
882874
MemoryManagerPolicy: s.MemoryManagerPolicy,
883875
MemoryManagerReservedMemory: s.ReservedMemory,

‎hack/local-up-cluster.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ function usage {
167167
echo "Example 1: hack/local-up-cluster.sh -o _output/dockerized/bin/linux/amd64/ (run from docker output)"
168168
echo "Example 2: hack/local-up-cluster.sh -O (auto-guess the bin path for your platform)"
169169
echo "Example 3: hack/local-up-cluster.sh (build a local copy of the source)"
170-
echo "Example 4: FEATURE_GATES=CPUManagerPolicyOptions=true \\"
171-
echo " TOPOLOGY_MANAGER_POLICY=\"single-numa-node\" \\"
170+
echo "Example 4: TOPOLOGY_MANAGER_POLICY=\"single-numa-node\" \\"
172171
echo " CPUMANAGER_POLICY=\"static\" \\"
173172
echo " CPUMANAGER_POLICY_OPTIONS=full-pcpus-only=\"true\" \\"
174173
echo " CPUMANAGER_RECONCILE_PERIOD=\"5s\" \\"

‎pkg/features/kube_features.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const (
114114
// for details about the removal of this feature gate.
115115
CPUManagerPolicyBetaOptions featuregate.Feature = "CPUManagerPolicyBetaOptions"
116116

117-
// owner: @fromanirh
117+
// owner: @ffromani
118118
//
119119
// Allow the usage of options to fine-tune the cpumanager policies.
120120
CPUManagerPolicyOptions featuregate.Feature = "CPUManagerPolicyOptions"
@@ -1049,6 +1049,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
10491049
CPUManagerPolicyOptions: {
10501050
{Version: version.MustParse("1.22"), Default: false, PreRelease: featuregate.Alpha},
10511051
{Version: version.MustParse("1.23"), Default: true, PreRelease: featuregate.Beta},
1052+
{Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.36
10521053
},
10531054

10541055
CronJobsScheduledAnnotation: {

‎pkg/generated/openapi/zz_generated.openapi.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pkg/kubelet/apis/config/types.go

-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ type KubeletConfiguration struct {
257257
CPUManagerPolicy string
258258
// CPUManagerPolicyOptions is a set of key=value which allows to set extra options
259259
// to fine tune the behaviour of the cpu manager policies.
260-
// Requires both the "CPUManager" and "CPUManagerPolicyOptions" feature gates to be enabled.
261260
CPUManagerPolicyOptions map[string]string
262261
// CPU Manager reconciliation period.
263262
// Requires the CPUManager feature gate to be enabled.

‎pkg/kubelet/cm/cpumanager/policy_options.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@ var (
4444
PreferAlignByUnCoreCacheOption,
4545
)
4646
betaOptions = sets.New[string](
47-
FullPCPUsOnlyOption,
4847
StrictCPUReservationOption,
4948
DistributeCPUsAcrossNUMAOption,
5049
)
51-
stableOptions = sets.New[string]()
50+
stableOptions = sets.New[string](
51+
FullPCPUsOnlyOption,
52+
)
5253
)
5354

5455
// CheckPolicyOptionAvailable verifies if the given option can be used depending on the Feature Gate Settings.
@@ -66,6 +67,7 @@ func CheckPolicyOptionAvailable(option string) error {
6667
return fmt.Errorf("CPU Manager Policy Beta-level Options not enabled, but option %q provided", option)
6768
}
6869

70+
// if the option is stable, we need no CPUManagerPolicy*Options feature gate check
6971
return nil
7072
}
7173

‎pkg/kubelet/cm/cpumanager/policy_options_test.go

+15-12
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,6 @@ func TestPolicyOptionsAvailable(t *testing.T) {
7070
featureGateEnable: true,
7171
expectedAvailable: false,
7272
},
73-
{
74-
option: FullPCPUsOnlyOption,
75-
featureGate: pkgfeatures.CPUManagerPolicyBetaOptions,
76-
featureGateEnable: true,
77-
expectedAvailable: true,
78-
},
79-
{
80-
option: FullPCPUsOnlyOption,
81-
featureGate: pkgfeatures.CPUManagerPolicyBetaOptions,
82-
featureGateEnable: false,
83-
expectedAvailable: false,
84-
},
8573
{
8674
option: AlignBySocketOption,
8775
featureGate: pkgfeatures.CPUManagerPolicyAlphaOptions,
@@ -143,6 +131,21 @@ func TestPolicyOptionsAvailable(t *testing.T) {
143131
}
144132
}
145133

134+
func TestPolicyOptionsAlwaysAvailableOnceGA(t *testing.T) {
135+
options := []string{
136+
FullPCPUsOnlyOption,
137+
}
138+
for _, option := range options {
139+
t.Run(option, func(t *testing.T) {
140+
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, pkgfeatures.CPUManagerPolicyAlphaOptions, false)
141+
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, pkgfeatures.CPUManagerPolicyBetaOptions, false)
142+
if err := CheckPolicyOptionAvailable(option); err != nil {
143+
t.Errorf("option %q should be available even with all featuregate disabled", option)
144+
}
145+
})
146+
}
147+
}
148+
146149
func TestValidateStaticPolicyOptions(t *testing.T) {
147150
testCases := []struct {
148151
description string

‎staging/src/k8s.io/kubelet/config/v1beta1/types.go

-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,6 @@ type KubeletConfiguration struct {
406406
SingleProcessOOMKill *bool `json:"singleProcessOOMKill,omitempty"`
407407
// cpuManagerPolicyOptions is a set of key=value which allows to set extra options
408408
// to fine tune the behaviour of the cpu manager policies.
409-
// Requires both the "CPUManager" and "CPUManagerPolicyOptions" feature gates to be enabled.
410409
// Default: nil
411410
// +optional
412411
CPUManagerPolicyOptions map[string]string `json:"cpuManagerPolicyOptions,omitempty"`

‎test/compatibility_lifecycle/reference/versioned_feature_list.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,10 @@
303303
lockToDefault: false
304304
preRelease: Beta
305305
version: "1.23"
306+
- default: true
307+
lockToDefault: true
308+
preRelease: GA
309+
version: "1.33"
306310
- name: CRDValidationRatcheting
307311
versionedSpecs:
308312
- default: false

‎test/e2e_node/cpu_manager_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ func configureCPUManagerInKubelet(oldCfg *kubeletconfig.KubeletConfiguration, ku
303303
newCfg.FeatureGates = make(map[string]bool)
304304
}
305305

306-
newCfg.FeatureGates["CPUManagerPolicyOptions"] = kubeletArguments.enableCPUManagerOptions
307306
newCfg.FeatureGates["CPUManagerPolicyBetaOptions"] = kubeletArguments.enableCPUManagerOptions
308307
newCfg.FeatureGates["CPUManagerPolicyAlphaOptions"] = kubeletArguments.enableCPUManagerOptions
309308
newCfg.FeatureGates["DisableCPUQuotaWithExclusiveCPUs"] = kubeletArguments.disableCPUQuotaWithExclusiveCPUs

0 commit comments

Comments
 (0)
Please sign in to comment.