diff --git a/api/v1beta1/azuremanagedmachinepool_webhook.go b/api/v1beta1/azuremanagedmachinepool_webhook.go index 86be164f2aa..459750e8b7d 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" @@ -316,7 +317,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 }