-
Notifications
You must be signed in to change notification settings - Fork 417
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
add pause handling for AzureCluster controller #3735
add pause handling for AzureCluster controller #3735
Conversation
|
||
// ClusterUpdatePauseChange returns a predicate that returns true for an update event when a cluster's | ||
// Spec.Paused changes between any two distinct values. | ||
func ClusterUpdatePauseChange(logger logr.Logger) predicate.Funcs { |
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.
This is mostly copy-paste from CAPI's ClusterUpdateUnpaused
.
ctx, _, done := tele.StartSpanWithLogger(ctx, "controllers.azureClusterService.Pause") | ||
defer done() | ||
|
||
for _, service := range s.services { |
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.
I don't think the order in which services are paused is significant, at least for ASO.
dd22f7c
to
339603a
Compare
@@ -51,3 +56,63 @@ var _ = Describe("AzureClusterReconciler", func() { | |||
}) | |||
}) | |||
}) | |||
|
|||
func TestAzureClusterReconcilePaused(t *testing.T) { |
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.
I originally tried to specify this test like the one above with envtest, but the race detector was flagging something in the logging calls whenever two objects were being created, even serially and with a 10s sleep in between. It was easier to rework this test to use a fake client than try to fix the race which seemed unrelated to the rest of these changes. The test itself hasn't lost any fidelity during that rewrite AFAICT.
(squash reminder) /hold |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #3735 +/- ##
==========================================
+ Coverage 54.05% 54.26% +0.20%
==========================================
Files 186 186
Lines 18833 18898 +65
==========================================
+ Hits 10181 10255 +74
+ Misses 8105 8088 -17
- Partials 547 555 +8
☔ View full report in Codecov by Sentry. |
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
LGTM label has been added. Git tree hash: 7ed89233f583d5db13927c22afa78f31b057ff2f
|
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
squash and remove hold?
[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 |
1c26aa9
to
8db012a
Compare
squashed! |
/retest |
3 similar comments
/retest |
/retest |
/retest |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR introduces the capability for CAPZ's Azure service interfaces (i.e.
azure/services/*
) to define logic to be run in reaction to a CAPZ resource being paused. The primary change is the introduction of a newreconcilePause
at the same level of abstraction asreconcileNormal
andreconcileDelete
.The currently-identified use case is to set the serviceoperator.azure.com/reconcile-policy annotation to
skip
on ASO resources to communicate CAPI's notion of "paused" to ASO's controllers.This change modifies the AzureCluster controller, but all other controllers using the same
azure.ServiceReconciler
pattern will need to modified similarly, at least once they start using ASO.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Part of #3525
Special notes for your reviewer:
This change only partially addresses #3525. Currently,
reconcilePause
will essentially no-op (aside from logging), so this PR is not expected to produce any meaningfully visible changes. Future PRs will implement the logic to add the annotation to ASO resources, handle the impending block-move CAPI annotation, and implement the same pattern for other CAPZ controllers.TODOs:
Release note: