diff --git a/k8s/crds/kops.k8s.io_clusters.yaml b/k8s/crds/kops.k8s.io_clusters.yaml index ae875b9ac880c..63133e66bb4ee 100644 --- a/k8s/crds/kops.k8s.io_clusters.yaml +++ b/k8s/crds/kops.k8s.io_clusters.yaml @@ -3791,6 +3791,17 @@ spec: Kubelet. format: int32 type: integer + memorySwap: + description: MemorySwap defines the memory swap behavior + type: string + memorySwapConfiguration: + description: MemorySwapConfiguration holds the memory swap configuration + for the kubelet + properties: + swapBehavior: + description: SwapBehavior can be "" or "UnlimitedSwap" + type: string + type: object networkPluginMTU: description: NetworkPluginMTU is the MTU to be passed to the network plugin, and overrides the default MTU for cases where it cannot @@ -4220,6 +4231,17 @@ spec: Kubelet. format: int32 type: integer + memorySwap: + description: MemorySwap defines the memory swap behavior + type: string + memorySwapConfiguration: + description: MemorySwapConfiguration holds the memory swap configuration + for the kubelet + properties: + swapBehavior: + description: SwapBehavior can be "" or "UnlimitedSwap" + type: string + type: object networkPluginMTU: description: NetworkPluginMTU is the MTU to be passed to the network plugin, and overrides the default MTU for cases where it cannot diff --git a/k8s/crds/kops.k8s.io_instancegroups.yaml b/k8s/crds/kops.k8s.io_instancegroups.yaml index 09bc8e0f4c78b..a15afe5058793 100644 --- a/k8s/crds/kops.k8s.io_instancegroups.yaml +++ b/k8s/crds/kops.k8s.io_instancegroups.yaml @@ -618,6 +618,17 @@ spec: Kubelet. format: int32 type: integer + memorySwap: + description: MemorySwap defines the memory swap behavior + type: string + memorySwapConfiguration: + description: MemorySwapConfiguration holds the memory swap configuration + for the kubelet + properties: + swapBehavior: + description: SwapBehavior can be "" or "UnlimitedSwap" + type: string + type: object networkPluginMTU: description: NetworkPluginMTU is the MTU to be passed to the network plugin, and overrides the default MTU for cases where it cannot diff --git a/pkg/apis/kops/componentconfig.go b/pkg/apis/kops/componentconfig.go index f335b987743c7..0ce24bff7cb93 100644 --- a/pkg/apis/kops/componentconfig.go +++ b/pkg/apis/kops/componentconfig.go @@ -225,13 +225,16 @@ type KubeletConfigSpec struct { EnableCadvisorJsonEndpoints *bool `json:"enableCadvisorJsonEndpoints,omitempty" flag:"enable-cadvisor-json-endpoints"` // PodPidsLimit is the maximum number of pids in any pod. PodPidsLimit *int64 `json:"podPidsLimit,omitempty" flag:"pod-max-pids"` - // ShutdownGracePeriod specifies the total duration that the node should delay the shutdown by. // Default: 30s ShutdownGracePeriod *metav1.Duration `json:"shutdownGracePeriod,omitempty"` // ShutdownGracePeriodCriticalPods specifies the duration used to terminate critical pods during a node shutdown. // Default: 10s ShutdownGracePeriodCriticalPods *metav1.Duration `json:"shutdownGracePeriodCriticalPods,omitempty"` + // MemorySwapConfiguration holds the memory swap configuration for the kubelet + MemorySwapConfiguration *MemorySwapConfiguration `json:"memorySwapConfiguration,omitempty"` + // MemorySwap defines the memory swap behavior + MemorySwap *string `json:"memorySwap,omitempty"` } // KubeProxyConfig defines the configuration for a proxy @@ -1096,6 +1099,7 @@ type LoadBalancerControllerSpec struct { // Default: false EnableWAF bool `json:"enableWAF,omitempty"` // EnableWAFv2 specifies whether the controller can use WAFs (V2). + // Default: false EnableWAFv2 bool `json:"enableWAFv2,omitempty"` // EnableShield specifies whether the controller can enable Shield Advanced. @@ -1103,6 +1107,11 @@ type LoadBalancerControllerSpec struct { EnableShield bool `json:"enableShield,omitempty"` } +type MemorySwapConfiguration struct { + // SwapBehavior can be "" or "UnlimitedSwap" + SwapBehavior *string `json:"swapBehavior,omitempty"` +} + // HasAdmissionController checks if a specific admission controller is enabled func (c *KubeAPIServerConfig) HasAdmissionController(name string) bool { for _, x := range c.AdmissionControl { diff --git a/pkg/apis/kops/v1alpha2/componentconfig.go b/pkg/apis/kops/v1alpha2/componentconfig.go index 0ec8545eb729b..2c1e314fd70ee 100644 --- a/pkg/apis/kops/v1alpha2/componentconfig.go +++ b/pkg/apis/kops/v1alpha2/componentconfig.go @@ -225,13 +225,16 @@ type KubeletConfigSpec struct { EnableCadvisorJsonEndpoints *bool `json:"enableCadvisorJsonEndpoints,omitempty" flag:"enable-cadvisor-json-endpoints"` // PodPidsLimit is the maximum number of pids in any pod. PodPidsLimit *int64 `json:"podPidsLimit,omitempty" flag:"pod-max-pids"` - // ShutdownGracePeriod specifies the total duration that the node should delay the shutdown by. // Default: 30s ShutdownGracePeriod *metav1.Duration `json:"shutdownGracePeriod,omitempty"` // ShutdownGracePeriodCriticalPods specifies the duration used to terminate critical pods during a node shutdown. // Default: 10s ShutdownGracePeriodCriticalPods *metav1.Duration `json:"shutdownGracePeriodCriticalPods,omitempty"` + // MemorySwapConfiguration holds the memory swap configuration for the kubelet + MemorySwapConfiguration *MemorySwapConfiguration `json:"memorySwapConfiguration,omitempty"` + // MemorySwap defines the memory swap behavior + MemorySwap *string `json:"memorySwap,omitempty"` } // KubeProxyConfig defines the configuration for a proxy @@ -1166,6 +1169,11 @@ type LoadBalancerControllerSpec struct { EnableShield bool `json:"enableShield,omitempty"` } +type MemorySwapConfiguration struct { + // SwapBehavior can be "" or "UnlimitedSwap" + SwapBehavior *string `json:"swapBehavior,omitempty"` +} + // HasAdmissionController checks if a specific admission controller is enabled func (c *KubeAPIServerConfig) HasAdmissionController(name string) bool { for _, x := range c.AdmissionControl { diff --git a/pkg/apis/kops/v1alpha2/zz_generated.conversion.go b/pkg/apis/kops/v1alpha2/zz_generated.conversion.go index c4a3e21e9bd7a..b50d712f0fecd 100644 --- a/pkg/apis/kops/v1alpha2/zz_generated.conversion.go +++ b/pkg/apis/kops/v1alpha2/zz_generated.conversion.go @@ -774,6 +774,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*MemorySwapConfiguration)(nil), (*kops.MemorySwapConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_MemorySwapConfiguration_To_kops_MemorySwapConfiguration(a.(*MemorySwapConfiguration), b.(*kops.MemorySwapConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kops.MemorySwapConfiguration)(nil), (*MemorySwapConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kops_MemorySwapConfiguration_To_v1alpha2_MemorySwapConfiguration(a.(*kops.MemorySwapConfiguration), b.(*MemorySwapConfiguration), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*MetricsServerConfig)(nil), (*kops.MetricsServerConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha2_MetricsServerConfig_To_kops_MetricsServerConfig(a.(*MetricsServerConfig), b.(*kops.MetricsServerConfig), scope) }); err != nil { @@ -5381,6 +5391,16 @@ func autoConvert_v1alpha2_KubeletConfigSpec_To_kops_KubeletConfigSpec(in *Kubele out.PodPidsLimit = in.PodPidsLimit out.ShutdownGracePeriod = in.ShutdownGracePeriod out.ShutdownGracePeriodCriticalPods = in.ShutdownGracePeriodCriticalPods + if in.MemorySwapConfiguration != nil { + in, out := &in.MemorySwapConfiguration, &out.MemorySwapConfiguration + *out = new(kops.MemorySwapConfiguration) + if err := Convert_v1alpha2_MemorySwapConfiguration_To_kops_MemorySwapConfiguration(*in, *out, s); err != nil { + return err + } + } else { + out.MemorySwapConfiguration = nil + } + out.MemorySwap = in.MemorySwap return nil } @@ -5480,6 +5500,16 @@ func autoConvert_kops_KubeletConfigSpec_To_v1alpha2_KubeletConfigSpec(in *kops.K out.PodPidsLimit = in.PodPidsLimit out.ShutdownGracePeriod = in.ShutdownGracePeriod out.ShutdownGracePeriodCriticalPods = in.ShutdownGracePeriodCriticalPods + if in.MemorySwapConfiguration != nil { + in, out := &in.MemorySwapConfiguration, &out.MemorySwapConfiguration + *out = new(MemorySwapConfiguration) + if err := Convert_kops_MemorySwapConfiguration_To_v1alpha2_MemorySwapConfiguration(*in, *out, s); err != nil { + return err + } + } else { + out.MemorySwapConfiguration = nil + } + out.MemorySwap = in.MemorySwap return nil } @@ -5726,6 +5756,26 @@ func Convert_kops_LyftVPCNetworkingSpec_To_v1alpha2_LyftVPCNetworkingSpec(in *ko return autoConvert_kops_LyftVPCNetworkingSpec_To_v1alpha2_LyftVPCNetworkingSpec(in, out, s) } +func autoConvert_v1alpha2_MemorySwapConfiguration_To_kops_MemorySwapConfiguration(in *MemorySwapConfiguration, out *kops.MemorySwapConfiguration, s conversion.Scope) error { + out.SwapBehavior = in.SwapBehavior + return nil +} + +// Convert_v1alpha2_MemorySwapConfiguration_To_kops_MemorySwapConfiguration is an autogenerated conversion function. +func Convert_v1alpha2_MemorySwapConfiguration_To_kops_MemorySwapConfiguration(in *MemorySwapConfiguration, out *kops.MemorySwapConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha2_MemorySwapConfiguration_To_kops_MemorySwapConfiguration(in, out, s) +} + +func autoConvert_kops_MemorySwapConfiguration_To_v1alpha2_MemorySwapConfiguration(in *kops.MemorySwapConfiguration, out *MemorySwapConfiguration, s conversion.Scope) error { + out.SwapBehavior = in.SwapBehavior + return nil +} + +// Convert_kops_MemorySwapConfiguration_To_v1alpha2_MemorySwapConfiguration is an autogenerated conversion function. +func Convert_kops_MemorySwapConfiguration_To_v1alpha2_MemorySwapConfiguration(in *kops.MemorySwapConfiguration, out *MemorySwapConfiguration, s conversion.Scope) error { + return autoConvert_kops_MemorySwapConfiguration_To_v1alpha2_MemorySwapConfiguration(in, out, s) +} + func autoConvert_v1alpha2_MetricsServerConfig_To_kops_MetricsServerConfig(in *MetricsServerConfig, out *kops.MetricsServerConfig, s conversion.Scope) error { out.Enabled = in.Enabled out.Image = in.Image diff --git a/pkg/apis/kops/v1alpha2/zz_generated.deepcopy.go b/pkg/apis/kops/v1alpha2/zz_generated.deepcopy.go index 0edd912e2590b..f284ae021ccf6 100644 --- a/pkg/apis/kops/v1alpha2/zz_generated.deepcopy.go +++ b/pkg/apis/kops/v1alpha2/zz_generated.deepcopy.go @@ -3932,6 +3932,16 @@ func (in *KubeletConfigSpec) DeepCopyInto(out *KubeletConfigSpec) { *out = new(v1.Duration) **out = **in } + if in.MemorySwapConfiguration != nil { + in, out := &in.MemorySwapConfiguration, &out.MemorySwapConfiguration + *out = new(MemorySwapConfiguration) + (*in).DeepCopyInto(*out) + } + if in.MemorySwap != nil { + in, out := &in.MemorySwap, &out.MemorySwap + *out = new(string) + **out = **in + } return } @@ -4182,6 +4192,27 @@ func (in *LyftVPCNetworkingSpec) DeepCopy() *LyftVPCNetworkingSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MemorySwapConfiguration) DeepCopyInto(out *MemorySwapConfiguration) { + *out = *in + if in.SwapBehavior != nil { + in, out := &in.SwapBehavior, &out.SwapBehavior + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MemorySwapConfiguration. +func (in *MemorySwapConfiguration) DeepCopy() *MemorySwapConfiguration { + if in == nil { + return nil + } + out := new(MemorySwapConfiguration) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricsServerConfig) DeepCopyInto(out *MetricsServerConfig) { *out = *in diff --git a/pkg/apis/kops/v1alpha3/componentconfig.go b/pkg/apis/kops/v1alpha3/componentconfig.go index 01bfc4eeb38d5..cfe47811f3afd 100644 --- a/pkg/apis/kops/v1alpha3/componentconfig.go +++ b/pkg/apis/kops/v1alpha3/componentconfig.go @@ -223,13 +223,16 @@ type KubeletConfigSpec struct { EnableCadvisorJsonEndpoints *bool `json:"enableCadvisorJsonEndpoints,omitempty" flag:"enable-cadvisor-json-endpoints"` // PodPidsLimit is the maximum number of pids in any pod. PodPidsLimit *int64 `json:"podPidsLimit,omitempty" flag:"pod-max-pids"` - // ShutdownGracePeriod specifies the total duration that the node should delay the shutdown by. // Default: 30s ShutdownGracePeriod *metav1.Duration `json:"shutdownGracePeriod,omitempty"` // ShutdownGracePeriodCriticalPods specifies the duration used to terminate critical pods during a node shutdown. // Default: 10s ShutdownGracePeriodCriticalPods *metav1.Duration `json:"shutdownGracePeriodCriticalPods,omitempty"` + // MemorySwapConfiguration holds the memory swap configuration for the kubelet + MemorySwapConfiguration *MemorySwapConfiguration `json:"memorySwapConfiguration,omitempty"` + // MemorySwap defines the memory swap behavior + MemorySwap *string `json:"memorySwap,omitempty"` } // KubeProxyConfig defines the configuration for a proxy @@ -1095,3 +1098,8 @@ type LoadBalancerControllerSpec struct { // Default: false EnableShield bool `json:"enableShield,omitempty"` } + +type MemorySwapConfiguration struct { + // SwapBehavior can be "" or "UnlimitedSwap" + SwapBehavior *string `json:"swapBehavior,omitempty"` +} diff --git a/pkg/apis/kops/v1alpha3/zz_generated.conversion.go b/pkg/apis/kops/v1alpha3/zz_generated.conversion.go index ec5f67214e904..f29390c21002b 100644 --- a/pkg/apis/kops/v1alpha3/zz_generated.conversion.go +++ b/pkg/apis/kops/v1alpha3/zz_generated.conversion.go @@ -874,6 +874,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*MemorySwapConfiguration)(nil), (*kops.MemorySwapConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MemorySwapConfiguration_To_kops_MemorySwapConfiguration(a.(*MemorySwapConfiguration), b.(*kops.MemorySwapConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kops.MemorySwapConfiguration)(nil), (*MemorySwapConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kops_MemorySwapConfiguration_To_v1alpha3_MemorySwapConfiguration(a.(*kops.MemorySwapConfiguration), b.(*MemorySwapConfiguration), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*MetricsServerConfig)(nil), (*kops.MetricsServerConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha3_MetricsServerConfig_To_kops_MetricsServerConfig(a.(*MetricsServerConfig), b.(*kops.MetricsServerConfig), scope) }); err != nil { @@ -5736,6 +5746,16 @@ func autoConvert_v1alpha3_KubeletConfigSpec_To_kops_KubeletConfigSpec(in *Kubele out.PodPidsLimit = in.PodPidsLimit out.ShutdownGracePeriod = in.ShutdownGracePeriod out.ShutdownGracePeriodCriticalPods = in.ShutdownGracePeriodCriticalPods + if in.MemorySwapConfiguration != nil { + in, out := &in.MemorySwapConfiguration, &out.MemorySwapConfiguration + *out = new(kops.MemorySwapConfiguration) + if err := Convert_v1alpha3_MemorySwapConfiguration_To_kops_MemorySwapConfiguration(*in, *out, s); err != nil { + return err + } + } else { + out.MemorySwapConfiguration = nil + } + out.MemorySwap = in.MemorySwap return nil } @@ -5835,6 +5855,16 @@ func autoConvert_kops_KubeletConfigSpec_To_v1alpha3_KubeletConfigSpec(in *kops.K out.PodPidsLimit = in.PodPidsLimit out.ShutdownGracePeriod = in.ShutdownGracePeriod out.ShutdownGracePeriodCriticalPods = in.ShutdownGracePeriodCriticalPods + if in.MemorySwapConfiguration != nil { + in, out := &in.MemorySwapConfiguration, &out.MemorySwapConfiguration + *out = new(MemorySwapConfiguration) + if err := Convert_kops_MemorySwapConfiguration_To_v1alpha3_MemorySwapConfiguration(*in, *out, s); err != nil { + return err + } + } else { + out.MemorySwapConfiguration = nil + } + out.MemorySwap = in.MemorySwap return nil } @@ -6061,6 +6091,26 @@ func Convert_kops_LoadBalancerSubnetSpec_To_v1alpha3_LoadBalancerSubnetSpec(in * return autoConvert_kops_LoadBalancerSubnetSpec_To_v1alpha3_LoadBalancerSubnetSpec(in, out, s) } +func autoConvert_v1alpha3_MemorySwapConfiguration_To_kops_MemorySwapConfiguration(in *MemorySwapConfiguration, out *kops.MemorySwapConfiguration, s conversion.Scope) error { + out.SwapBehavior = in.SwapBehavior + return nil +} + +// Convert_v1alpha3_MemorySwapConfiguration_To_kops_MemorySwapConfiguration is an autogenerated conversion function. +func Convert_v1alpha3_MemorySwapConfiguration_To_kops_MemorySwapConfiguration(in *MemorySwapConfiguration, out *kops.MemorySwapConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha3_MemorySwapConfiguration_To_kops_MemorySwapConfiguration(in, out, s) +} + +func autoConvert_kops_MemorySwapConfiguration_To_v1alpha3_MemorySwapConfiguration(in *kops.MemorySwapConfiguration, out *MemorySwapConfiguration, s conversion.Scope) error { + out.SwapBehavior = in.SwapBehavior + return nil +} + +// Convert_kops_MemorySwapConfiguration_To_v1alpha3_MemorySwapConfiguration is an autogenerated conversion function. +func Convert_kops_MemorySwapConfiguration_To_v1alpha3_MemorySwapConfiguration(in *kops.MemorySwapConfiguration, out *MemorySwapConfiguration, s conversion.Scope) error { + return autoConvert_kops_MemorySwapConfiguration_To_v1alpha3_MemorySwapConfiguration(in, out, s) +} + func autoConvert_v1alpha3_MetricsServerConfig_To_kops_MetricsServerConfig(in *MetricsServerConfig, out *kops.MetricsServerConfig, s conversion.Scope) error { out.Enabled = in.Enabled out.Image = in.Image diff --git a/pkg/apis/kops/v1alpha3/zz_generated.deepcopy.go b/pkg/apis/kops/v1alpha3/zz_generated.deepcopy.go index a6cd40f877075..a572682c7d2d1 100644 --- a/pkg/apis/kops/v1alpha3/zz_generated.deepcopy.go +++ b/pkg/apis/kops/v1alpha3/zz_generated.deepcopy.go @@ -3880,6 +3880,16 @@ func (in *KubeletConfigSpec) DeepCopyInto(out *KubeletConfigSpec) { *out = new(v1.Duration) **out = **in } + if in.MemorySwapConfiguration != nil { + in, out := &in.MemorySwapConfiguration, &out.MemorySwapConfiguration + *out = new(MemorySwapConfiguration) + (*in).DeepCopyInto(*out) + } + if in.MemorySwap != nil { + in, out := &in.MemorySwap, &out.MemorySwap + *out = new(string) + **out = **in + } return } @@ -4107,6 +4117,27 @@ func (in *LoadBalancerSubnetSpec) DeepCopy() *LoadBalancerSubnetSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MemorySwapConfiguration) DeepCopyInto(out *MemorySwapConfiguration) { + *out = *in + if in.SwapBehavior != nil { + in, out := &in.SwapBehavior, &out.SwapBehavior + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MemorySwapConfiguration. +func (in *MemorySwapConfiguration) DeepCopy() *MemorySwapConfiguration { + if in == nil { + return nil + } + out := new(MemorySwapConfiguration) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricsServerConfig) DeepCopyInto(out *MetricsServerConfig) { *out = *in diff --git a/pkg/apis/kops/validation/validation.go b/pkg/apis/kops/validation/validation.go index 6356c7d203b3c..28acc43f3352a 100644 --- a/pkg/apis/kops/validation/validation.go +++ b/pkg/apis/kops/validation/validation.go @@ -911,6 +911,19 @@ 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.MemorySwapConfiguration != nil { + memorySwapFldPath := kubeletPath.Child("memorySwapConfiguration") + swapBehavior := k.MemorySwapConfiguration.SwapBehavior + if swapBehavior != nil { + switch *swapBehavior { + case "": + case "UnlimitedSwap": + default: + allErrs = append(allErrs, field.Invalid(memorySwapFldPath.Child("memorySwapBehavior"), *swapBehavior, "swapBehavior must be either empty or 'UnlimitedSwap'")) + } + } + } } return allErrs } diff --git a/pkg/apis/kops/zz_generated.deepcopy.go b/pkg/apis/kops/zz_generated.deepcopy.go index bd5ba5bfccdf0..696f8ad353015 100644 --- a/pkg/apis/kops/zz_generated.deepcopy.go +++ b/pkg/apis/kops/zz_generated.deepcopy.go @@ -4059,6 +4059,16 @@ func (in *KubeletConfigSpec) DeepCopyInto(out *KubeletConfigSpec) { *out = new(v1.Duration) **out = **in } + if in.MemorySwapConfiguration != nil { + in, out := &in.MemorySwapConfiguration, &out.MemorySwapConfiguration + *out = new(MemorySwapConfiguration) + (*in).DeepCopyInto(*out) + } + if in.MemorySwap != nil { + in, out := &in.MemorySwap, &out.MemorySwap + *out = new(string) + **out = **in + } return } @@ -4325,6 +4335,27 @@ func (in *LyftVPCNetworkingSpec) DeepCopy() *LyftVPCNetworkingSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MemorySwapConfiguration) DeepCopyInto(out *MemorySwapConfiguration) { + *out = *in + if in.SwapBehavior != nil { + in, out := &in.SwapBehavior, &out.SwapBehavior + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MemorySwapConfiguration. +func (in *MemorySwapConfiguration) DeepCopy() *MemorySwapConfiguration { + if in == nil { + return nil + } + out := new(MemorySwapConfiguration) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricsServerConfig) DeepCopyInto(out *MetricsServerConfig) { *out = *in diff --git a/pkg/model/components/kubelet.go b/pkg/model/components/kubelet.go index f29a056be6615..bf1c55ef3b166 100644 --- a/pkg/model/components/kubelet.go +++ b/pkg/model/components/kubelet.go @@ -220,5 +220,15 @@ func (b *KubeletOptionsBuilder) BuildOptions(o interface{}) error { clusterSpec.Kubelet.RegisterSchedulable = fi.PtrTo(true) clusterSpec.ControlPlaneKubelet.RegisterSchedulable = fi.PtrTo(true) + if clusterSpec.Kubelet.MemorySwapConfiguration != nil { + if clusterSpec.Kubelet.MemorySwapConfiguration.SwapBehavior != nil { + if *clusterSpec.Kubelet.MemorySwapConfiguration.SwapBehavior == "" { + clusterSpec.Kubelet.MemorySwap = fi.PtrTo("") + } else if *clusterSpec.Kubelet.MemorySwapConfiguration.SwapBehavior == "UnlimitedSwap" { + clusterSpec.Kubelet.MemorySwap = fi.PtrTo("UnlimitedSwap") + } + } + } + return nil }