-
Notifications
You must be signed in to change notification settings - Fork 421
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 AzureManagedControlPlane #3783
add pause handling for AzureManagedControlPlane #3783
Conversation
(squash reminder) |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #3783 +/- ##
==========================================
+ Coverage 54.43% 54.74% +0.30%
==========================================
Files 187 187
Lines 19029 19051 +22
==========================================
+ Hits 10359 10429 +70
+ Misses 8113 8057 -56
- Partials 557 565 +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
(My multiline string comment is just a style thing.) Looks good. I compared it to #3735.
LGTM label has been added. Git tree hash: 5320f19a7b31e47664d07f40ba54f284e06d30ee
|
if err = c.Watch( | ||
&source.Kind{Type: &clusterv1.Cluster{}}, | ||
handler.EnqueueRequestsFromMapFunc(amcpr.ClusterToAzureManagedControlPlane), | ||
predicates.ClusterUnpausedAndInfrastructureReady(log), | ||
predicates.ResourceNotPausedAndHasFilterLabel(log, amcpr.WatchFilterValue), | ||
predicates.Any(log, predicates.ClusterCreateInfraReady(log), predicates.ClusterUpdateInfraReady(log), ClusterUpdatePauseChange(log)), |
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.
For predicates.Any()
, doesn't it return true if any of the predicates inside return true? If so, in this case shouldn't we be only returning true if all three are true?
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 was adapted from ClusterUnpausedAndInfrastructureReady
to essentially remove the ClusterCreateNotPaused
condition and replace ClusterUpdateUnpaused
with ClusterUpdatePauseChange
. https://github.com/kubernetes-sigs/cluster-api/blob/54dfd423d80e42f79c33c0149f9719dba3863f11/util/predicates/cluster_predicates.go#L221
These update predicates only look at one particular change of a resource and not just its updated state, so ClusterUpdateInfraReady
only passes if the old object's infra is not ready and the updated object's is, and that likely won't correspond to the same update when a Cluster is paused/unpaused, so we need Any
to check if any of those things happened in a particular update and ignore all other ones.
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 squash of commits.
LGTM label has been added. Git tree hash: 1826820a17dd7df50db4e60021f79eb3f2e9dd91
|
2a939cc
to
150f44f
Compare
squashed! |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mboersma 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 adds the capability for the AzureManagedControlPlane controller to react when resources are paused using the same pattern as #3735. See that PR for more context.
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:
TODOs:
Release note: