diff --git a/controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_webhook.go b/controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_webhook.go index ea2a5da88824..aa238eaddd09 100644 --- a/controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_webhook.go +++ b/controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_webhook.go @@ -78,6 +78,7 @@ func (in *KubeadmControlPlane) ValidateUpdate(old runtime.Object) error { {spec, "infrastructureTemplate", "name"}, {spec, "replicas"}, {spec, "version"}, + {spec, "upgradeAfter"}, } allErrs := in.validateCommon() diff --git a/controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_webhook_test.go b/controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_webhook_test.go index dc3471928416..c01bab40594c 100644 --- a/controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_webhook_test.go +++ b/controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_webhook_test.go @@ -178,6 +178,8 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) { validUpdate.Spec.Version = "v1.16.6" validUpdate.Spec.InfrastructureTemplate.Name = "orange" validUpdate.Spec.Replicas = pointer.Int32Ptr(5) + now := metav1.NewTime(time.Now()) + validUpdate.Spec.UpgradeAfter = &now scaleToZero := before.DeepCopy() scaleToZero.Spec.Replicas = pointer.Int32Ptr(0)