-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
🐛 Issue-10544 ignore unreachable cluster while deleting machinePool #10553
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Welcome @serngawy! |
Hi @serngawy. 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. |
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.
/ok-to-test
/area machinepools
@killianmuldoon: The label(s) 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-sigs/prow repository. |
I think this one goes into a different direction then described in: and /hold |
/cc @mboersma |
@mboersma would review the PR and let me know your thoughts. |
022d53e
to
6da8906
Compare
deleteAllowed, clusterClient, err := r.isDeleteMachinePoolAllowed(ctx, cluster) | ||
|
||
// Check for cluster allowing delete or machinePool delete timeout. | ||
if deleteAllowed || r.isMachinePoolDeleteTimeoutPassed(machinepool) { |
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.
Is this saying that if the cluster doesn't have a deletion timestamp and the time out is met we never get through this code path and so we never delete the finaliser blocking deletion?
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.
As I changed the logic based on the previous comment , I fix it now. It says if the machinePool delete allowed OR machinePool delete timeout pass go delete the machinePool external CRs and Nodes
} | ||
|
||
return r.deleteRetiredNodes(ctx, clusterClient, machinepool.Status.NodeRefs, machinepool.Spec.ProviderIDList) | ||
// Check if the target cluster client is reachable. | ||
clusterClient, err := r.Tracker.GetClient(ctx, util.ObjectKey(cluster)) |
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.
why is a function called isMachinePoolDeleteTimeoutPassed returning a clusterClient?
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.
the func name is isDeleteMachinePoolAllowed, it checks if the cluster client is reachable and return the client as it is required to delete the node instead of re-get the client to pass it to the deleteNode func. I will change it to deleteMachinePoolAllowed .
if len(machinepool.Status.NodeRefs) == 0 { | ||
return nil | ||
// isMachinePoolDeleteTimeoutPassed check the machinePool node delete time out. | ||
func (r *MachinePoolReconciler) isMachinePoolDeleteTimeoutPassed(machinepool *expv1.MachinePool) bool { |
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.
// isMachinePoolDeleteTimeoutPassed check the machinePool node delete time out.
should this be named then isNodeTimeoutPassed
? so we ref the specific "Node" time out and don't include the machinepool which implicit in the receiver
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.
we don't delete a specific node , we delete all the nodes belong to this machinePool.
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.
Then I think it should isMachinePoolNodesTimeoutPassed or similar. Current naming implies a machinepool deletion timeout which there isn't one?
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.
okay
if err != nil { | ||
return err | ||
// deleteMachinePoolAllowed check the cluster status and target cluster client accessor state. | ||
func (r *MachinePoolReconciler) deleteMachinePoolAllowed(ctx context.Context, cluster *clusterv1.Cluster, machinepool *expv1.MachinePool) (bool, client.Client, error) { |
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 this should be called isDeleteMachinePoolAllowed... consistently with the other function naming
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.
it was originally isDeleteMachinePoolAllowed but as per comment the func returning bool, client and error so suggest was to better make it deleteMachinePoolAllowed
// Check if the machinePool is deleted | ||
if !machinepool.DeletionTimestamp.IsZero() { | ||
// Check if the target cluster client is reachable. | ||
clusterClient, err := r.Tracker.GetClient(ctx, util.ObjectKey(cluster)) |
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.
Can you elaborate why does this determine if a machinePool deletion is allowed?
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.
when the cluster is unreachable, that makes deleting the nodes not doable. so it raise error and returning false.
Signed-off-by: melserngawy <melserng@redhat.com>
What this PR does / why we need it:
Ignore unreachable cluster while deleting machinePools
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 #10544