From 3213f308e9bd164faef27e6d496fa3b8319bb1e4 Mon Sep 17 00:00:00 2001 From: Pulak Kanti Bhowmick Date: Fri, 14 Apr 2023 23:57:08 +0600 Subject: [PATCH] Use clusterctl move annotation on last systempool validation Signed-off-by: Pulak Kanti Bhowmick --- .gitignore | 1 + api/v1beta1/azuremanagedmachinepool_webhook.go | 4 +++- go.mod | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c8501b36bee4..f46e016c7783 100644 --- a/.gitignore +++ b/.gitignore @@ -85,3 +85,4 @@ release-*/manifests/calico-*.yaml # mentioned in the capz book /sp.json /cluster.yaml +vendor diff --git a/api/v1beta1/azuremanagedmachinepool_webhook.go b/api/v1beta1/azuremanagedmachinepool_webhook.go index a62158e1ba57..498313780135 100644 --- a/api/v1beta1/azuremanagedmachinepool_webhook.go +++ b/api/v1beta1/azuremanagedmachinepool_webhook.go @@ -35,6 +35,7 @@ import ( "sigs.k8s.io/cluster-api-provider-azure/util/maps" webhookutils "sigs.k8s.io/cluster-api-provider-azure/util/webhook" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + clusterctlv1 "sigs.k8s.io/cluster-api/cmd/clusterctl/api/v1alpha3" capifeature "sigs.k8s.io/cluster-api/feature" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" @@ -308,7 +309,8 @@ func (m *AzureManagedMachinePool) validateLastSystemNodePool(cli client.Client) return nil } - if ownerCluster.Spec.Paused { + // checking if the Cluster is going to be deleted for clusterctl move operation + if _, found := ownerCluster.Annotations[clusterctlv1.DeleteForMoveAnnotation]; found { return nil } diff --git a/go.mod b/go.mod index 30b610ae4c3c..74c35964f32d 100644 --- a/go.mod +++ b/go.mod @@ -46,7 +46,7 @@ require ( k8s.io/kubectl v0.26.1 k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 sigs.k8s.io/cloud-provider-azure v1.25.5 - sigs.k8s.io/cluster-api v1.4.1 + sigs.k8s.io/cluster-api v1.4.0-beta.2.0.20230414160241-e774ad52879f sigs.k8s.io/cluster-api/test v1.4.1 sigs.k8s.io/controller-runtime v0.14.5 sigs.k8s.io/kind v0.17.0