diff --git a/api/v1beta1/azuremanagedmachinepool_webhook.go b/api/v1beta1/azuremanagedmachinepool_webhook.go index d5a0f7110f0..b7c7082b909 100644 --- a/api/v1beta1/azuremanagedmachinepool_webhook.go +++ b/api/v1beta1/azuremanagedmachinepool_webhook.go @@ -38,6 +38,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" @@ -323,7 +324,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 }