-
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
Skip system pool validation while cluster is paused/moved #2774
Conversation
Welcome @pkbhowmick! |
Hi @pkbhowmick. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
@@ -267,6 +267,10 @@ func (m *AzureManagedMachinePool) validateLastSystemNodePool(cli client.Client) | |||
return nil | |||
} | |||
|
|||
if ownerCluster.Spec.Paused { |
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 think I'd prefer some other "clusterctl move"-specific indication that we're O.K. to delete the system node pool. Does a move operation result in an annotation or other metadata that we can detect?
Also, we should probably just implement this in the (m *AzureManagedMachinePool) ValidateDelete
method itself.
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.
Currently, I see there is no annotation is added in the move operation.
Move client library ref: https://github.com/kubernetes-sigs/cluster-api/blob/5eaf9e3c0e93d93b75e57675a7e9fb560d15ae37/cmd/clusterctl/client/cluster/mover.go#L334
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.
If we want to implement this in ValidateDelete method, we need to get the cluster object which is already done in func (m *AzureManagedMachinePool) validateLastSystemNodePool
method. I think, some code will be repeated then.
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.
@Jont828 @fabriziopandini does either of you know if there is any marker that indicates a delete is initiated as part of a move operation more specific than the pause annotation?
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.
currently, we don't add any markers to resources before the move.
cluster being paused is the only proxy information, but it is not 100% reliable because a cluster can be paused for any reason.
note: if required, adding a "move" marker on one or more move-hierarchies root (cluster, cluster class, crs) is something that makes sense; adding a "move" marker on all resources is a little bit more complex...
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 think I agree with @CecileRobertMichon
There are going to be edge cases with this change but I think they are sufficiently "weird" that preventing them isn't more important than addressing this broken core capi functionality for AKS.
My only feedback at this point would be a unit test for this (I think TestAzureManagedMachinePool_ValidateCreate
is a good copy/paste candidate for scaffolding a new UT for this func.
Thank you @pkbhowmick!
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.
So, should I only add a new UT for this func?
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.
Correct, in order to UT this new func, you'll need a new func (for example a new UT func TestValidateLastSystemNodePool
based on existing pattern in TestAzureManagedMachinePool_ValidateCreate
).
You will be doing the project an extra credit favor by adding coverage for an existing func that we don't have coverage for, thank you!
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.
Got it! Thank you!
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 think TestAzureManagedMachinePool_ValidateCreate
does this already
Hey @pkbhowmick, how is this PR coming along? |
Hi @nawazkh , While deleting objects for move operation, child objects are deleted first. So, we can say that, while deleting last system pool if there is a paused Cluster object without delation time stamp set, this is clear indication for cluster move operation. If we agree with this, then we can proceed with current fix. Moreover, I am using this fix, which works fine so far. |
/assign @jackfrancis To decide how we want to move this forward |
Signed-off-by: Pulak Kanti Bhowmick <[email protected]> Add unit test for validateLastSystemNodePool method Signed-off-by: Pulak Kanti Bhowmick <[email protected]>
/ok-to-test |
@jackfrancis is this ready to go (pending tests)? |
/lgtm |
LGTM label has been added. Git tree hash: 0e82085bda3f02bde656234cf981fb0e800be069
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jackfrancis 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 |
/retest-required |
/retest |
1 similar comment
/retest |
Signed-off-by: Pulak Kanti Bhowmick [email protected]
What type of PR is this?
/kind bug
What this PR does / why we need it:
Fix bug for cluster move operation
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 #2656
Special notes for your reviewer:
Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.
TODOs:
Release note: