diff --git a/bootstrap/kubeadm/api/v1alpha3/conversion.go b/bootstrap/kubeadm/api/v1alpha3/conversion.go index ed148fa8660a..5a73bb04045d 100644 --- a/bootstrap/kubeadm/api/v1alpha3/conversion.go +++ b/bootstrap/kubeadm/api/v1alpha3/conversion.go @@ -79,6 +79,20 @@ func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error { dst.Spec.JoinConfiguration.SkipPhases = restored.Spec.JoinConfiguration.SkipPhases } + if restored.Spec.JoinConfiguration != nil && restored.Spec.JoinConfiguration.NodeRegistration.ImagePullPolicy != "" { + if dst.Spec.JoinConfiguration == nil { + dst.Spec.JoinConfiguration = &bootstrapv1.JoinConfiguration{} + } + dst.Spec.JoinConfiguration.NodeRegistration.ImagePullPolicy = restored.Spec.JoinConfiguration.NodeRegistration.ImagePullPolicy + } + + if restored.Spec.InitConfiguration != nil && restored.Spec.InitConfiguration.NodeRegistration.ImagePullPolicy != "" { + if dst.Spec.InitConfiguration == nil { + dst.Spec.InitConfiguration = &bootstrapv1.InitConfiguration{} + } + dst.Spec.InitConfiguration.NodeRegistration.ImagePullPolicy = restored.Spec.InitConfiguration.NodeRegistration.ImagePullPolicy + } + return nil } @@ -163,6 +177,20 @@ func (src *KubeadmConfigTemplate) ConvertTo(dstRaw conversion.Hub) error { dst.Spec.Template.Spec.JoinConfiguration.SkipPhases = restored.Spec.Template.Spec.JoinConfiguration.SkipPhases } + if restored.Spec.Template.Spec.JoinConfiguration != nil && restored.Spec.Template.Spec.JoinConfiguration.NodeRegistration.ImagePullPolicy != "" { + if dst.Spec.Template.Spec.JoinConfiguration == nil { + dst.Spec.Template.Spec.JoinConfiguration = &bootstrapv1.JoinConfiguration{} + } + dst.Spec.Template.Spec.JoinConfiguration.NodeRegistration.ImagePullPolicy = restored.Spec.Template.Spec.JoinConfiguration.NodeRegistration.ImagePullPolicy + } + + if restored.Spec.Template.Spec.InitConfiguration != nil && restored.Spec.Template.Spec.InitConfiguration.NodeRegistration.ImagePullPolicy != "" { + if dst.Spec.Template.Spec.InitConfiguration == nil { + dst.Spec.Template.Spec.InitConfiguration = &bootstrapv1.InitConfiguration{} + } + dst.Spec.Template.Spec.InitConfiguration.NodeRegistration.ImagePullPolicy = restored.Spec.Template.Spec.InitConfiguration.NodeRegistration.ImagePullPolicy + } + return nil } diff --git a/bootstrap/kubeadm/api/v1alpha4/conversion.go b/bootstrap/kubeadm/api/v1alpha4/conversion.go index 58ec2acb946e..289c1b88a518 100644 --- a/bootstrap/kubeadm/api/v1alpha4/conversion.go +++ b/bootstrap/kubeadm/api/v1alpha4/conversion.go @@ -64,6 +64,20 @@ func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error { dst.Spec.JoinConfiguration.SkipPhases = restored.Spec.JoinConfiguration.SkipPhases } + if restored.Spec.JoinConfiguration != nil && restored.Spec.JoinConfiguration.NodeRegistration.ImagePullPolicy != "" { + if dst.Spec.JoinConfiguration == nil { + dst.Spec.JoinConfiguration = &bootstrapv1.JoinConfiguration{} + } + dst.Spec.JoinConfiguration.NodeRegistration.ImagePullPolicy = restored.Spec.JoinConfiguration.NodeRegistration.ImagePullPolicy + } + + if restored.Spec.InitConfiguration != nil && restored.Spec.InitConfiguration.NodeRegistration.ImagePullPolicy != "" { + if dst.Spec.InitConfiguration == nil { + dst.Spec.InitConfiguration = &bootstrapv1.InitConfiguration{} + } + dst.Spec.InitConfiguration.NodeRegistration.ImagePullPolicy = restored.Spec.InitConfiguration.NodeRegistration.ImagePullPolicy + } + return nil } @@ -129,6 +143,20 @@ func (src *KubeadmConfigTemplate) ConvertTo(dstRaw conversion.Hub) error { dst.Spec.Template.Spec.JoinConfiguration.SkipPhases = restored.Spec.Template.Spec.JoinConfiguration.SkipPhases } + if restored.Spec.Template.Spec.JoinConfiguration != nil && restored.Spec.Template.Spec.JoinConfiguration.NodeRegistration.ImagePullPolicy != "" { + if dst.Spec.Template.Spec.JoinConfiguration == nil { + dst.Spec.Template.Spec.JoinConfiguration = &bootstrapv1.JoinConfiguration{} + } + dst.Spec.Template.Spec.JoinConfiguration.NodeRegistration.ImagePullPolicy = restored.Spec.Template.Spec.JoinConfiguration.NodeRegistration.ImagePullPolicy + } + + if restored.Spec.Template.Spec.InitConfiguration != nil && restored.Spec.Template.Spec.InitConfiguration.NodeRegistration.ImagePullPolicy != "" { + if dst.Spec.Template.Spec.InitConfiguration == nil { + dst.Spec.Template.Spec.InitConfiguration = &bootstrapv1.InitConfiguration{} + } + dst.Spec.Template.Spec.InitConfiguration.NodeRegistration.ImagePullPolicy = restored.Spec.Template.Spec.InitConfiguration.NodeRegistration.ImagePullPolicy + } + return nil } diff --git a/bootstrap/kubeadm/api/v1alpha4/zz_generated.conversion.go b/bootstrap/kubeadm/api/v1alpha4/zz_generated.conversion.go index 8b75fbf18241..2ae753287ddb 100644 --- a/bootstrap/kubeadm/api/v1alpha4/zz_generated.conversion.go +++ b/bootstrap/kubeadm/api/v1alpha4/zz_generated.conversion.go @@ -1455,6 +1455,7 @@ func autoConvert_v1beta1_NodeRegistrationOptions_To_v1alpha4_NodeRegistrationOpt out.Taints = *(*[]corev1.Taint)(unsafe.Pointer(&in.Taints)) out.KubeletExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.KubeletExtraArgs)) out.IgnorePreflightErrors = *(*[]string)(unsafe.Pointer(&in.IgnorePreflightErrors)) + // WARNING: in.ImagePullPolicy requires manual conversion: does not exist in peer-type return nil } diff --git a/bootstrap/kubeadm/api/v1beta1/kubeadm_types.go b/bootstrap/kubeadm/api/v1beta1/kubeadm_types.go index f8ea593ec0ac..0f74c7268592 100644 --- a/bootstrap/kubeadm/api/v1beta1/kubeadm_types.go +++ b/bootstrap/kubeadm/api/v1beta1/kubeadm_types.go @@ -244,6 +244,15 @@ type NodeRegistrationOptions struct { // IgnorePreflightErrors provides a slice of pre-flight errors to be ignored when the current node is registered. // +optional IgnorePreflightErrors []string `json:"ignorePreflightErrors,omitempty"` + + // ImagePullPolicy specifies the policy for image pulling + // during kubeadm "init" and "join" operations. The value of + // this field must be one of "Always", "IfNotPresent" or + // "Never". Defaults to "IfNotPresent". + // +kubebuilder:validation:Enum=Always;IfNotPresent;Never + // +kubebuilder:default=IfNotPresent + // +optional + ImagePullPolicy string `json:"imagePullPolicy,omitempty"` } // MarshalJSON marshals NodeRegistrationOptions in a way that an empty slice in Taints is preserved. diff --git a/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml b/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml index 71c60711ac0a..1fa6c79a2b1c 100644 --- a/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml +++ b/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml @@ -2592,6 +2592,17 @@ spec: items: type: string type: array + imagePullPolicy: + default: IfNotPresent + description: ImagePullPolicy specifies the policy for image + pulling during kubeadm "init" and "join" operations. The + value of this field must be one of "Always", "IfNotPresent" + or "Never". Defaults to "IfNotPresent". + enum: + - Always + - IfNotPresent + - Never + type: string kubeletExtraArgs: additionalProperties: type: string @@ -2803,6 +2814,17 @@ spec: items: type: string type: array + imagePullPolicy: + default: IfNotPresent + description: ImagePullPolicy specifies the policy for image + pulling during kubeadm "init" and "join" operations. The + value of this field must be one of "Always", "IfNotPresent" + or "Never". Defaults to "IfNotPresent". + enum: + - Always + - IfNotPresent + - Never + type: string kubeletExtraArgs: additionalProperties: type: string diff --git a/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml b/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml index 85493b712abd..aca806803d73 100644 --- a/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml +++ b/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml @@ -2619,6 +2619,18 @@ spec: items: type: string type: array + imagePullPolicy: + default: IfNotPresent + description: ImagePullPolicy specifies the policy + for image pulling during kubeadm "init" and "join" + operations. The value of this field must be one + of "Always", "IfNotPresent" or "Never". Defaults + to "IfNotPresent". + enum: + - Always + - IfNotPresent + - Never + type: string kubeletExtraArgs: additionalProperties: type: string @@ -2845,6 +2857,18 @@ spec: items: type: string type: array + imagePullPolicy: + default: IfNotPresent + description: ImagePullPolicy specifies the policy + for image pulling during kubeadm "init" and "join" + operations. The value of this field must be one + of "Always", "IfNotPresent" or "Never". Defaults + to "IfNotPresent". + enum: + - Always + - IfNotPresent + - Never + type: string kubeletExtraArgs: additionalProperties: type: string diff --git a/bootstrap/kubeadm/types/upstreamv1beta1/zz_generated.conversion.go b/bootstrap/kubeadm/types/upstreamv1beta1/zz_generated.conversion.go index b340245f6c51..0497d927b800 100644 --- a/bootstrap/kubeadm/types/upstreamv1beta1/zz_generated.conversion.go +++ b/bootstrap/kubeadm/types/upstreamv1beta1/zz_generated.conversion.go @@ -806,5 +806,6 @@ func autoConvert_v1beta1_NodeRegistrationOptions_To_upstreamv1beta1_NodeRegistra out.Taints = *(*[]corev1.Taint)(unsafe.Pointer(&in.Taints)) out.KubeletExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.KubeletExtraArgs)) // WARNING: in.IgnorePreflightErrors requires manual conversion: does not exist in peer-type + // WARNING: in.ImagePullPolicy requires manual conversion: does not exist in peer-type return nil } diff --git a/bootstrap/kubeadm/types/upstreamv1beta2/zz_generated.conversion.go b/bootstrap/kubeadm/types/upstreamv1beta2/zz_generated.conversion.go index 5000842ff569..81d4c6c1e468 100644 --- a/bootstrap/kubeadm/types/upstreamv1beta2/zz_generated.conversion.go +++ b/bootstrap/kubeadm/types/upstreamv1beta2/zz_generated.conversion.go @@ -815,6 +815,7 @@ func autoConvert_v1beta1_NodeRegistrationOptions_To_upstreamv1beta2_NodeRegistra out.Taints = *(*[]corev1.Taint)(unsafe.Pointer(&in.Taints)) out.KubeletExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.KubeletExtraArgs)) out.IgnorePreflightErrors = *(*[]string)(unsafe.Pointer(&in.IgnorePreflightErrors)) + // WARNING: in.ImagePullPolicy requires manual conversion: does not exist in peer-type return nil } diff --git a/bootstrap/kubeadm/types/upstreamv1beta3/zz_generated.conversion.go b/bootstrap/kubeadm/types/upstreamv1beta3/zz_generated.conversion.go index 19f5bd3a67fc..ca0073ef0af9 100644 --- a/bootstrap/kubeadm/types/upstreamv1beta3/zz_generated.conversion.go +++ b/bootstrap/kubeadm/types/upstreamv1beta3/zz_generated.conversion.go @@ -807,6 +807,7 @@ func autoConvert_v1beta1_NodeRegistrationOptions_To_upstreamv1beta3_NodeRegistra out.Taints = *(*[]corev1.Taint)(unsafe.Pointer(&in.Taints)) out.KubeletExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.KubeletExtraArgs)) out.IgnorePreflightErrors = *(*[]string)(unsafe.Pointer(&in.IgnorePreflightErrors)) + // WARNING: in.ImagePullPolicy requires manual conversion: does not exist in peer-type return nil } diff --git a/controlplane/kubeadm/api/v1alpha3/conversion.go b/controlplane/kubeadm/api/v1alpha3/conversion.go index dd0b04c5e512..0061e6331a8a 100644 --- a/controlplane/kubeadm/api/v1alpha3/conversion.go +++ b/controlplane/kubeadm/api/v1alpha3/conversion.go @@ -85,6 +85,20 @@ func (src *KubeadmControlPlane) ConvertTo(dstRaw conversion.Hub) error { dst.Spec.RolloutBefore = restored.Spec.RolloutBefore + if restored.Spec.KubeadmConfigSpec.JoinConfiguration != nil && restored.Spec.KubeadmConfigSpec.JoinConfiguration.NodeRegistration.ImagePullPolicy != "" { + if dst.Spec.KubeadmConfigSpec.JoinConfiguration == nil { + dst.Spec.KubeadmConfigSpec.JoinConfiguration = &bootstrapv1.JoinConfiguration{} + } + dst.Spec.KubeadmConfigSpec.JoinConfiguration.NodeRegistration.ImagePullPolicy = restored.Spec.KubeadmConfigSpec.JoinConfiguration.NodeRegistration.ImagePullPolicy + } + + if restored.Spec.KubeadmConfigSpec.InitConfiguration != nil && restored.Spec.KubeadmConfigSpec.InitConfiguration.NodeRegistration.ImagePullPolicy != "" { + if dst.Spec.KubeadmConfigSpec.InitConfiguration == nil { + dst.Spec.KubeadmConfigSpec.InitConfiguration = &bootstrapv1.InitConfiguration{} + } + dst.Spec.KubeadmConfigSpec.InitConfiguration.NodeRegistration.ImagePullPolicy = restored.Spec.KubeadmConfigSpec.InitConfiguration.NodeRegistration.ImagePullPolicy + } + return nil } diff --git a/controlplane/kubeadm/api/v1alpha4/conversion.go b/controlplane/kubeadm/api/v1alpha4/conversion.go index 9eaebf63b74a..9fae7f390022 100644 --- a/controlplane/kubeadm/api/v1alpha4/conversion.go +++ b/controlplane/kubeadm/api/v1alpha4/conversion.go @@ -70,6 +70,20 @@ func (src *KubeadmControlPlane) ConvertTo(dstRaw conversion.Hub) error { dst.Spec.RolloutBefore = restored.Spec.RolloutBefore dst.Spec.MachineTemplate.NodeVolumeDetachTimeout = restored.Spec.MachineTemplate.NodeVolumeDetachTimeout + if restored.Spec.KubeadmConfigSpec.JoinConfiguration != nil && restored.Spec.KubeadmConfigSpec.JoinConfiguration.NodeRegistration.ImagePullPolicy != "" { + if dst.Spec.KubeadmConfigSpec.JoinConfiguration == nil { + dst.Spec.KubeadmConfigSpec.JoinConfiguration = &bootstrapv1.JoinConfiguration{} + } + dst.Spec.KubeadmConfigSpec.JoinConfiguration.NodeRegistration.ImagePullPolicy = restored.Spec.KubeadmConfigSpec.JoinConfiguration.NodeRegistration.ImagePullPolicy + } + + if restored.Spec.KubeadmConfigSpec.InitConfiguration != nil && restored.Spec.KubeadmConfigSpec.InitConfiguration.NodeRegistration.ImagePullPolicy != "" { + if dst.Spec.KubeadmConfigSpec.InitConfiguration == nil { + dst.Spec.KubeadmConfigSpec.InitConfiguration = &bootstrapv1.InitConfiguration{} + } + dst.Spec.KubeadmConfigSpec.InitConfiguration.NodeRegistration.ImagePullPolicy = restored.Spec.KubeadmConfigSpec.InitConfiguration.NodeRegistration.ImagePullPolicy + } + return nil } @@ -145,6 +159,20 @@ func (src *KubeadmControlPlaneTemplate) ConvertTo(dstRaw conversion.Hub) error { dst.Spec.Template.Spec.RolloutBefore = restored.Spec.Template.Spec.RolloutBefore + if restored.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration != nil && restored.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration.NodeRegistration.ImagePullPolicy != "" { + if dst.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration == nil { + dst.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration = &bootstrapv1.JoinConfiguration{} + } + dst.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration.NodeRegistration.ImagePullPolicy = restored.Spec.Template.Spec.KubeadmConfigSpec.JoinConfiguration.NodeRegistration.ImagePullPolicy + } + + if restored.Spec.Template.Spec.KubeadmConfigSpec.InitConfiguration != nil && restored.Spec.Template.Spec.KubeadmConfigSpec.InitConfiguration.NodeRegistration.ImagePullPolicy != "" { + if dst.Spec.Template.Spec.KubeadmConfigSpec.InitConfiguration == nil { + dst.Spec.Template.Spec.KubeadmConfigSpec.InitConfiguration = &bootstrapv1.InitConfiguration{} + } + dst.Spec.Template.Spec.KubeadmConfigSpec.InitConfiguration.NodeRegistration.ImagePullPolicy = restored.Spec.Template.Spec.KubeadmConfigSpec.InitConfiguration.NodeRegistration.ImagePullPolicy + } + return nil } diff --git a/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml b/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml index 533231db6ce0..1477302d6f49 100644 --- a/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml +++ b/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml @@ -3063,6 +3063,17 @@ spec: items: type: string type: array + imagePullPolicy: + default: IfNotPresent + description: ImagePullPolicy specifies the policy for + image pulling during kubeadm "init" and "join" operations. + The value of this field must be one of "Always", "IfNotPresent" + or "Never". Defaults to "IfNotPresent". + enum: + - Always + - IfNotPresent + - Never + type: string kubeletExtraArgs: additionalProperties: type: string @@ -3283,6 +3294,17 @@ spec: items: type: string type: array + imagePullPolicy: + default: IfNotPresent + description: ImagePullPolicy specifies the policy for + image pulling during kubeadm "init" and "join" operations. + The value of this field must be one of "Always", "IfNotPresent" + or "Never". Defaults to "IfNotPresent". + enum: + - Always + - IfNotPresent + - Never + type: string kubeletExtraArgs: additionalProperties: type: string diff --git a/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanetemplates.yaml b/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanetemplates.yaml index 52663f04e22a..b943fc891a30 100644 --- a/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanetemplates.yaml +++ b/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanetemplates.yaml @@ -1853,6 +1853,18 @@ spec: items: type: string type: array + imagePullPolicy: + default: IfNotPresent + description: ImagePullPolicy specifies the policy + for image pulling during kubeadm "init" and + "join" operations. The value of this field must + be one of "Always", "IfNotPresent" or "Never". + Defaults to "IfNotPresent". + enum: + - Always + - IfNotPresent + - Never + type: string kubeletExtraArgs: additionalProperties: type: string @@ -2089,6 +2101,18 @@ spec: items: type: string type: array + imagePullPolicy: + default: IfNotPresent + description: ImagePullPolicy specifies the policy + for image pulling during kubeadm "init" and + "join" operations. The value of this field must + be one of "Always", "IfNotPresent" or "Never". + Defaults to "IfNotPresent". + enum: + - Always + - IfNotPresent + - Never + type: string kubeletExtraArgs: additionalProperties: type: string