-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handle clusterctl block-move annotation #4213
Conversation
Skipping CI for Draft Pull Request. |
98cd69c
to
2266f9f
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #4213 +/- ##
==========================================
+ Coverage 60.88% 60.97% +0.08%
==========================================
Files 190 190
Lines 18983 19029 +46
==========================================
+ Hits 11557 11602 +45
- Misses 6789 6790 +1
Partials 637 637 ☔ View full report in Codecov by Sentry. |
/test ? |
@nojnhuh: The following commands are available to trigger required jobs:
The following commands are available to trigger optional jobs:
Use
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/test pull-cluster-api-provider-azure-capi-e2e |
2266f9f
to
a224eb7
Compare
/test pull-cluster-api-provider-azure-ci-entrypoint |
/assign @Jont828 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good pending one nit!
controllers/helpers.go
Outdated
@@ -1120,3 +1121,29 @@ func GetClusterScoper(ctx context.Context, logger logr.Logger, c client.Client, | |||
|
|||
return nil, errors.Errorf("unsupported infrastructure type %q, should be AzureCluster or AzureManagedCluster", cluster.Spec.InfrastructureRef.Kind) | |||
} | |||
|
|||
// AddBlockMoveAnnotation adds CAPI's block-move annotation returns whether or not the change had an effect. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// AddBlockMoveAnnotation adds CAPI's block-move annotation returns whether or not the change had an effect. | |
// AddBlockMoveAnnotation adds CAPI's block-move annotation and returns whether or not the annotation was added. |
nit for more clarity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending Willie's comment
// Register our finalizer immediately to avoid orphaning Azure resources on delete | ||
needsPatch := controllerutil.AddFinalizer(azureCluster, infrav1.ClusterFinalizer) | ||
// Register the block-move annotation immediately to avoid moving un-paused ASO resources | ||
needsPatch = AddBlockMoveAnnotation(azureCluster) || needsPatch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify, this just means we don't want to allow clusterctl move to happen before we're done reconciling, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, this makes sure there isn't any interval of time where both an ASO resource has reconcile-policy: manage
and the AzureCluster doesn't have the block-move label, which is the danger zone.
a224eb7
to
27d8eff
Compare
/lgtm |
LGTM label has been added. Git tree hash: 52d8be664b66eb331ab38b7905783f2d869fa304
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: CecileRobertMichon The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR makes CAPZ aware of the clusterctl
clusterctl.cluster.x-k8s.io/block-move
annotation added by kubernetes-sigs/cluster-api#8690 and uses it to blockclusterctl move
when ASO resources have not yet been paused. These changes modify the necessary controllers to add the annotation at the beginning of a "normal" reconciliation and remove it at the end of a "pause" reconciliation.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #3839
Special notes for your reviewer:
These changes are not expected to build until #4182 or any other CAPI bump to v1.6.0+.
TODOs:
Release note: