From f7fe7dad7a930cb4e5dfc0ccc52b8a6e8a68aac9 Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Thu, 16 Feb 2023 19:26:23 +0100 Subject: [PATCH] KCP: fix rollout after upgrade --- bootstrap/kubeadm/api/v1beta1/kubeadm_types.go | 1 - bootstrap/kubeadm/api/v1beta1/kubeadmconfig_webhook.go | 6 ++++++ .../bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml | 2 -- .../bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml | 2 -- .../controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml | 2 -- ...plane.cluster.x-k8s.io_kubeadmcontrolplanetemplates.yaml | 2 -- 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/bootstrap/kubeadm/api/v1beta1/kubeadm_types.go b/bootstrap/kubeadm/api/v1beta1/kubeadm_types.go index f54df29dd128..653b4da552e8 100644 --- a/bootstrap/kubeadm/api/v1beta1/kubeadm_types.go +++ b/bootstrap/kubeadm/api/v1beta1/kubeadm_types.go @@ -258,7 +258,6 @@ type NodeRegistrationOptions struct { // "Never". Defaults to "IfNotPresent". This can be used only // with Kubernetes version equal to 1.22 and later. // +kubebuilder:validation:Enum=Always;IfNotPresent;Never - // +kubebuilder:default=IfNotPresent // +optional ImagePullPolicy string `json:"imagePullPolicy,omitempty"` } diff --git a/bootstrap/kubeadm/api/v1beta1/kubeadmconfig_webhook.go b/bootstrap/kubeadm/api/v1beta1/kubeadmconfig_webhook.go index f718f7ec2910..32879de190f0 100644 --- a/bootstrap/kubeadm/api/v1beta1/kubeadmconfig_webhook.go +++ b/bootstrap/kubeadm/api/v1beta1/kubeadmconfig_webhook.go @@ -58,6 +58,12 @@ func DefaultKubeadmConfigSpec(r *KubeadmConfigSpec) { if r.Format == "" { r.Format = CloudConfig } + if r.InitConfiguration != nil && r.InitConfiguration.NodeRegistration.ImagePullPolicy == "" { + r.InitConfiguration.NodeRegistration.ImagePullPolicy = "IfNotPresent" + } + if r.JoinConfiguration != nil && r.JoinConfiguration.NodeRegistration.ImagePullPolicy == "" { + r.JoinConfiguration.NodeRegistration.ImagePullPolicy = "IfNotPresent" + } } // +kubebuilder:webhook:verbs=create;update,path=/validate-bootstrap-cluster-x-k8s-io-v1beta1-kubeadmconfig,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=bootstrap.cluster.x-k8s.io,resources=kubeadmconfigs,versions=v1beta1,name=validation.kubeadmconfig.bootstrap.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1 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 95006f593ead..f88b1bd00a26 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 @@ -2601,7 +2601,6 @@ spec: 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" @@ -2824,7 +2823,6 @@ spec: 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" 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 d97458b462c8..70f7cceb5eaf 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 @@ -2627,7 +2627,6 @@ spec: 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 @@ -2866,7 +2865,6 @@ spec: 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 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 d208540c4c6b..d6172041934a 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 @@ -3071,7 +3071,6 @@ spec: 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" @@ -3304,7 +3303,6 @@ spec: 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" 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 d1cf5ed96706..aa8481e2c4d9 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 @@ -1861,7 +1861,6 @@ spec: 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 @@ -2111,7 +2110,6 @@ spec: 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