Merge pull request #15632 from hakman/swap_memory

Add support for using swap memory
This commit is contained in:
Kubernetes Prow Robot 2023-07-15 10:47:05 -07:00 committed by GitHub
commit 343d8cd6d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 30 additions and 0 deletions

View File

@ -3808,6 +3808,10 @@ spec:
Kubelet.
format: int32
type: integer
memorySwapBehavior:
description: 'MemorySwapBehavior defines how swap is used by container
workloads. Supported values: LimitedSwap, "UnlimitedSwap.'
type: string
networkPluginMTU:
description: NetworkPluginMTU is the MTU to be passed to the network
plugin, and overrides the default MTU for cases where it cannot
@ -4237,6 +4241,10 @@ spec:
Kubelet.
format: int32
type: integer
memorySwapBehavior:
description: 'MemorySwapBehavior defines how swap is used by container
workloads. Supported values: LimitedSwap, "UnlimitedSwap.'
type: string
networkPluginMTU:
description: NetworkPluginMTU is the MTU to be passed to the network
plugin, and overrides the default MTU for cases where it cannot

View File

@ -621,6 +621,10 @@ spec:
Kubelet.
format: int32
type: integer
memorySwapBehavior:
description: 'MemorySwapBehavior defines how swap is used by container
workloads. Supported values: LimitedSwap, "UnlimitedSwap.'
type: string
networkPluginMTU:
description: NetworkPluginMTU is the MTU to be passed to the network
plugin, and overrides the default MTU for cases where it cannot

View File

@ -220,6 +220,7 @@ func buildKubeletComponentConfig(kubeletConfig *kops.KubeletConfigSpec) (*nodeta
if kubeletConfig.ShutdownGracePeriodCriticalPods != nil {
componentConfig.ShutdownGracePeriodCriticalPods = *kubeletConfig.ShutdownGracePeriodCriticalPods
}
componentConfig.MemorySwap.SwapBehavior = kubeletConfig.MemorySwapBehavior
s := runtime.NewScheme()
if err := kubelet.AddToScheme(s); err != nil {

View File

@ -232,6 +232,9 @@ type KubeletConfigSpec struct {
// ShutdownGracePeriodCriticalPods specifies the duration used to terminate critical pods during a node shutdown.
// Default: 10s
ShutdownGracePeriodCriticalPods *metav1.Duration `json:"shutdownGracePeriodCriticalPods,omitempty"`
// MemorySwapBehavior defines how swap is used by container workloads.
// Supported values: LimitedSwap, "UnlimitedSwap.
MemorySwapBehavior string `json:"memorySwapBehavior,omitempty"`
}
// KubeProxyConfig defines the configuration for a proxy

View File

@ -232,6 +232,9 @@ type KubeletConfigSpec struct {
// ShutdownGracePeriodCriticalPods specifies the duration used to terminate critical pods during a node shutdown.
// Default: 10s
ShutdownGracePeriodCriticalPods *metav1.Duration `json:"shutdownGracePeriodCriticalPods,omitempty"`
// MemorySwapBehavior defines how swap is used by container workloads.
// Supported values: LimitedSwap, "UnlimitedSwap.
MemorySwapBehavior string `json:"memorySwapBehavior,omitempty"`
}
// KubeProxyConfig defines the configuration for a proxy

View File

@ -5387,6 +5387,7 @@ func autoConvert_v1alpha2_KubeletConfigSpec_To_kops_KubeletConfigSpec(in *Kubele
out.PodPidsLimit = in.PodPidsLimit
out.ShutdownGracePeriod = in.ShutdownGracePeriod
out.ShutdownGracePeriodCriticalPods = in.ShutdownGracePeriodCriticalPods
out.MemorySwapBehavior = in.MemorySwapBehavior
return nil
}
@ -5486,6 +5487,7 @@ func autoConvert_kops_KubeletConfigSpec_To_v1alpha2_KubeletConfigSpec(in *kops.K
out.PodPidsLimit = in.PodPidsLimit
out.ShutdownGracePeriod = in.ShutdownGracePeriod
out.ShutdownGracePeriodCriticalPods = in.ShutdownGracePeriodCriticalPods
out.MemorySwapBehavior = in.MemorySwapBehavior
return nil
}

View File

@ -230,6 +230,9 @@ type KubeletConfigSpec struct {
// ShutdownGracePeriodCriticalPods specifies the duration used to terminate critical pods during a node shutdown.
// Default: 10s
ShutdownGracePeriodCriticalPods *metav1.Duration `json:"shutdownGracePeriodCriticalPods,omitempty"`
// MemorySwapBehavior defines how swap is used by container workloads.
// Supported values: LimitedSwap, "UnlimitedSwap.
MemorySwapBehavior string `json:"memorySwapBehavior,omitempty"`
}
// KubeProxyConfig defines the configuration for a proxy

View File

@ -5744,6 +5744,7 @@ func autoConvert_v1alpha3_KubeletConfigSpec_To_kops_KubeletConfigSpec(in *Kubele
out.PodPidsLimit = in.PodPidsLimit
out.ShutdownGracePeriod = in.ShutdownGracePeriod
out.ShutdownGracePeriodCriticalPods = in.ShutdownGracePeriodCriticalPods
out.MemorySwapBehavior = in.MemorySwapBehavior
return nil
}
@ -5843,6 +5844,7 @@ func autoConvert_kops_KubeletConfigSpec_To_v1alpha3_KubeletConfigSpec(in *kops.K
out.PodPidsLimit = in.PodPidsLimit
out.ShutdownGracePeriod = in.ShutdownGracePeriod
out.ShutdownGracePeriodCriticalPods = in.ShutdownGracePeriodCriticalPods
out.MemorySwapBehavior = in.MemorySwapBehavior
return nil
}

View File

@ -918,6 +918,10 @@ func validateKubelet(k *kops.KubeletConfigSpec, c *kops.Cluster, kubeletPath *fi
allErrs = append(allErrs, field.Invalid(kubeletPath.Child("shutdownGracePeriodCriticalPods"), k.ShutdownGracePeriodCriticalPods.String(), "shutdownGracePeriodCriticalPods cannot be greater than shutdownGracePeriod"))
}
}
if k.MemorySwapBehavior != "" {
allErrs = append(allErrs, IsValidValue(kubeletPath.Child("memorySwapBehavior"), &k.MemorySwapBehavior, []string{"LimitedSwap", "UnlimitedSwap"})...)
}
}
return allErrs
}