Skip to content

Commit

Permalink
Use clusterctl move annotation on last systempool validation
Browse files Browse the repository at this point in the history
Signed-off-by: Pulak Kanti Bhowmick <[email protected]>
  • Loading branch information
pkbhowmick committed Apr 14, 2023
1 parent 910068d commit 3213f30
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@ release-*/manifests/calico-*.yaml
# mentioned in the capz book
/sp.json
/cluster.yaml
vendor
4 changes: 3 additions & 1 deletion api/v1beta1/azuremanagedmachinepool_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3213f30

Please sign in to comment.