mirror of https://github.com/kubernetes/kops.git
Merge pull request #15632 from hakman/swap_memory
Add support for using swap memory
This commit is contained in:
commit
343d8cd6d5
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue