mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
node: kep-2625: cpu manager policy options GA
Move the support for CPUManager Policy Options to GA Signed-off-by: Francesco Romani <fromani@redhat.com>
This commit is contained in:
parent
16abcd78bd
commit
3c7ed00e22
@ -826,14 +826,6 @@ func run(ctx context.Context, s *options.KubeletServer, kubeDeps *kubelet.Depend
|
||||
return fmt.Errorf("--qos-reserved value failed to parse: %w", err)
|
||||
}
|
||||
|
||||
var cpuManagerPolicyOptions map[string]string
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CPUManagerPolicyOptions) {
|
||||
cpuManagerPolicyOptions = s.CPUManagerPolicyOptions
|
||||
} else if s.CPUManagerPolicyOptions != nil {
|
||||
return fmt.Errorf("CPU Manager policy options %v require feature gates %q, %q enabled",
|
||||
s.CPUManagerPolicyOptions, features.CPUManager, features.CPUManagerPolicyOptions)
|
||||
}
|
||||
|
||||
var topologyManagerPolicyOptions map[string]string
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.TopologyManagerPolicyOptions) {
|
||||
topologyManagerPolicyOptions = s.TopologyManagerPolicyOptions
|
||||
@ -877,7 +869,7 @@ func run(ctx context.Context, s *options.KubeletServer, kubeDeps *kubelet.Depend
|
||||
},
|
||||
QOSReserved: *experimentalQOSReserved,
|
||||
CPUManagerPolicy: s.CPUManagerPolicy,
|
||||
CPUManagerPolicyOptions: cpuManagerPolicyOptions,
|
||||
CPUManagerPolicyOptions: s.CPUManagerPolicyOptions,
|
||||
CPUManagerReconcilePeriod: s.CPUManagerReconcilePeriod.Duration,
|
||||
MemoryManagerPolicy: s.MemoryManagerPolicy,
|
||||
MemoryManagerReservedMemory: s.ReservedMemory,
|
||||
|
@ -167,8 +167,7 @@ function usage {
|
||||
echo "Example 1: hack/local-up-cluster.sh -o _output/dockerized/bin/linux/amd64/ (run from docker output)"
|
||||
echo "Example 2: hack/local-up-cluster.sh -O (auto-guess the bin path for your platform)"
|
||||
echo "Example 3: hack/local-up-cluster.sh (build a local copy of the source)"
|
||||
echo "Example 4: FEATURE_GATES=CPUManagerPolicyOptions=true \\"
|
||||
echo " TOPOLOGY_MANAGER_POLICY=\"single-numa-node\" \\"
|
||||
echo "Example 4: TOPOLOGY_MANAGER_POLICY=\"single-numa-node\" \\"
|
||||
echo " CPUMANAGER_POLICY=\"static\" \\"
|
||||
echo " CPUMANAGER_POLICY_OPTIONS=full-pcpus-only=\"true\" \\"
|
||||
echo " CPUMANAGER_RECONCILE_PERIOD=\"5s\" \\"
|
||||
|
@ -114,7 +114,7 @@ const (
|
||||
// for details about the removal of this feature gate.
|
||||
CPUManagerPolicyBetaOptions featuregate.Feature = "CPUManagerPolicyBetaOptions"
|
||||
|
||||
// owner: @fromanirh
|
||||
// owner: @ffromani
|
||||
//
|
||||
// Allow the usage of options to fine-tune the cpumanager policies.
|
||||
CPUManagerPolicyOptions featuregate.Feature = "CPUManagerPolicyOptions"
|
||||
@ -1049,6 +1049,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
|
||||
CPUManagerPolicyOptions: {
|
||||
{Version: version.MustParse("1.22"), Default: false, PreRelease: featuregate.Alpha},
|
||||
{Version: version.MustParse("1.23"), Default: true, PreRelease: featuregate.Beta},
|
||||
{Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.36
|
||||
},
|
||||
|
||||
CronJobsScheduledAnnotation: {
|
||||
|
2
pkg/generated/openapi/zz_generated.openapi.go
generated
2
pkg/generated/openapi/zz_generated.openapi.go
generated
@ -66530,7 +66530,7 @@ func schema_k8sio_kubelet_config_v1beta1_KubeletConfiguration(ref common.Referen
|
||||
},
|
||||
"cpuManagerPolicyOptions": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "cpuManagerPolicyOptions is a set of key=value which \tallows to set extra options to fine tune the behaviour of the cpu manager policies. Requires both the \"CPUManager\" and \"CPUManagerPolicyOptions\" feature gates to be enabled. Default: nil",
|
||||
Description: "cpuManagerPolicyOptions is a set of key=value which \tallows to set extra options to fine tune the behaviour of the cpu manager policies. Default: nil",
|
||||
Type: []string{"object"},
|
||||
AdditionalProperties: &spec.SchemaOrBool{
|
||||
Allows: true,
|
||||
|
@ -257,7 +257,6 @@ type KubeletConfiguration struct {
|
||||
CPUManagerPolicy string
|
||||
// CPUManagerPolicyOptions is a set of key=value which allows to set extra options
|
||||
// to fine tune the behaviour of the cpu manager policies.
|
||||
// Requires both the "CPUManager" and "CPUManagerPolicyOptions" feature gates to be enabled.
|
||||
CPUManagerPolicyOptions map[string]string
|
||||
// CPU Manager reconciliation period.
|
||||
// Requires the CPUManager feature gate to be enabled.
|
||||
|
@ -44,11 +44,12 @@ var (
|
||||
PreferAlignByUnCoreCacheOption,
|
||||
)
|
||||
betaOptions = sets.New[string](
|
||||
FullPCPUsOnlyOption,
|
||||
StrictCPUReservationOption,
|
||||
DistributeCPUsAcrossNUMAOption,
|
||||
)
|
||||
stableOptions = sets.New[string]()
|
||||
stableOptions = sets.New[string](
|
||||
FullPCPUsOnlyOption,
|
||||
)
|
||||
)
|
||||
|
||||
// CheckPolicyOptionAvailable verifies if the given option can be used depending on the Feature Gate Settings.
|
||||
@ -66,6 +67,7 @@ func CheckPolicyOptionAvailable(option string) error {
|
||||
return fmt.Errorf("CPU Manager Policy Beta-level Options not enabled, but option %q provided", option)
|
||||
}
|
||||
|
||||
// if the option is stable, we need no CPUManagerPolicy*Options feature gate check
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -70,18 +70,6 @@ func TestPolicyOptionsAvailable(t *testing.T) {
|
||||
featureGateEnable: true,
|
||||
expectedAvailable: false,
|
||||
},
|
||||
{
|
||||
option: FullPCPUsOnlyOption,
|
||||
featureGate: pkgfeatures.CPUManagerPolicyBetaOptions,
|
||||
featureGateEnable: true,
|
||||
expectedAvailable: true,
|
||||
},
|
||||
{
|
||||
option: FullPCPUsOnlyOption,
|
||||
featureGate: pkgfeatures.CPUManagerPolicyBetaOptions,
|
||||
featureGateEnable: false,
|
||||
expectedAvailable: false,
|
||||
},
|
||||
{
|
||||
option: AlignBySocketOption,
|
||||
featureGate: pkgfeatures.CPUManagerPolicyAlphaOptions,
|
||||
@ -143,6 +131,21 @@ func TestPolicyOptionsAvailable(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPolicyOptionsAlwaysAvailableOnceGA(t *testing.T) {
|
||||
options := []string{
|
||||
FullPCPUsOnlyOption,
|
||||
}
|
||||
for _, option := range options {
|
||||
t.Run(option, func(t *testing.T) {
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, pkgfeatures.CPUManagerPolicyAlphaOptions, false)
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, pkgfeatures.CPUManagerPolicyBetaOptions, false)
|
||||
if err := CheckPolicyOptionAvailable(option); err != nil {
|
||||
t.Errorf("option %q should be available even with all featuregate disabled", option)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateStaticPolicyOptions(t *testing.T) {
|
||||
testCases := []struct {
|
||||
description string
|
||||
|
@ -406,7 +406,6 @@ type KubeletConfiguration struct {
|
||||
SingleProcessOOMKill *bool `json:"singleProcessOOMKill,omitempty"`
|
||||
// cpuManagerPolicyOptions is a set of key=value which allows to set extra options
|
||||
// to fine tune the behaviour of the cpu manager policies.
|
||||
// Requires both the "CPUManager" and "CPUManagerPolicyOptions" feature gates to be enabled.
|
||||
// Default: nil
|
||||
// +optional
|
||||
CPUManagerPolicyOptions map[string]string `json:"cpuManagerPolicyOptions,omitempty"`
|
||||
|
@ -303,6 +303,10 @@
|
||||
lockToDefault: false
|
||||
preRelease: Beta
|
||||
version: "1.23"
|
||||
- default: true
|
||||
lockToDefault: true
|
||||
preRelease: GA
|
||||
version: "1.33"
|
||||
- name: CRDValidationRatcheting
|
||||
versionedSpecs:
|
||||
- default: false
|
||||
|
@ -303,7 +303,6 @@ func configureCPUManagerInKubelet(oldCfg *kubeletconfig.KubeletConfiguration, ku
|
||||
newCfg.FeatureGates = make(map[string]bool)
|
||||
}
|
||||
|
||||
newCfg.FeatureGates["CPUManagerPolicyOptions"] = kubeletArguments.enableCPUManagerOptions
|
||||
newCfg.FeatureGates["CPUManagerPolicyBetaOptions"] = kubeletArguments.enableCPUManagerOptions
|
||||
newCfg.FeatureGates["CPUManagerPolicyAlphaOptions"] = kubeletArguments.enableCPUManagerOptions
|
||||
newCfg.FeatureGates["DisableCPUQuotaWithExclusiveCPUs"] = kubeletArguments.disableCPUQuotaWithExclusiveCPUs
|
||||
|
Loading…
Reference in New Issue
Block a user