Rename NodeSwapEnabled flag to NodeSwap

This commit is contained in:
Elana Hashman
2021-07-07 13:25:43 -07:00
parent 2423813207
commit 642eff0c69
8 changed files with 14 additions and 14 deletions

View File

@@ -331,7 +331,7 @@ type KubeletConfiguration struct {
// Tells the Kubelet to fail to start if swap is enabled on the node.
FailSwapOn bool
// memorySwap configures swap memory available to container workloads.
// +featureGate=NodeSwapEnabled
// +featureGate=NodeSwap
// +optional
MemorySwap MemorySwapConfiguration
// A quantity defines the maximum size of the container log file before it is rotated. For example: "5Mi" or "256Ki".
@@ -590,7 +590,7 @@ type MemorySwapConfiguration struct {
// swapBehavior configures swap memory available to container workloads. May be one of
// "", "LimitedSwap": workload combined memory and swap usage cannot exceed pod memory limit
// "UnlimitedSwap": workloads can use unlimited swap, up to the allocatable limit.
// +featureGate=NodeSwapEnabled
// +featureGate=NodeSwap
// +optional
SwapBehavior string
}

View File

@@ -155,13 +155,13 @@ func ValidateKubeletConfiguration(kc *kubeletconfig.KubeletConfiguration) error
if (kc.ShutdownGracePeriod.Duration > 0 || kc.ShutdownGracePeriodCriticalPods.Duration > 0) && !localFeatureGate.Enabled(features.GracefulNodeShutdown) {
allErrors = append(allErrors, fmt.Errorf("invalid configuration: Specifying ShutdownGracePeriod or ShutdownGracePeriodCriticalPods requires feature gate GracefulNodeShutdown"))
}
if localFeatureGate.Enabled(features.NodeSwapEnabled) {
if localFeatureGate.Enabled(features.NodeSwap) {
if kc.MemorySwap.SwapBehavior != "" && kc.MemorySwap.SwapBehavior != kubetypes.LimitedSwap && kc.MemorySwap.SwapBehavior != kubetypes.UnlimitedSwap {
allErrors = append(allErrors, fmt.Errorf("invalid configuration: MemorySwap.SwapBehavior %v must be one of: LimitedSwap, UnlimitedSwap", kc.MemorySwap.SwapBehavior))
}
}
if !localFeatureGate.Enabled(features.NodeSwapEnabled) && kc.MemorySwap != (kubeletconfig.MemorySwapConfiguration{}) {
allErrors = append(allErrors, fmt.Errorf("invalid configuration: MemorySwap.SwapBehavior cannot be set when NodeSwapEnabled feature flag is disabled"))
if !localFeatureGate.Enabled(features.NodeSwap) && kc.MemorySwap != (kubeletconfig.MemorySwapConfiguration{}) {
allErrors = append(allErrors, fmt.Errorf("invalid configuration: MemorySwap.SwapBehavior cannot be set when NodeSwap feature flag is disabled"))
}
for _, val := range kc.EnforceNodeAllocatable {

View File

@@ -156,7 +156,7 @@ func TestValidateKubeletConfiguration(t *testing.T) {
FeatureGates: map[string]bool{
"CustomCPUCFSQuotaPeriod": true,
"GracefulNodeShutdown": true,
"NodeSwapEnabled": true,
"NodeSwap": true,
"MemoryQoS": true,
},
Logging: componentbaseconfig.LoggingConfiguration{
@@ -241,7 +241,7 @@ func TestValidateKubeletConfiguration(t *testing.T) {
FeatureGates: map[string]bool{
"CustomCPUCFSQuotaPeriod": true,
"GracefulNodeShutdown": true,
"NodeSwapEnabled": true,
"NodeSwap": true,
"MemoryQoS": true,
},
Logging: componentbaseconfig.LoggingConfiguration{