-
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.
} | ||
func (r *MachinePoolReconciler) reconcileDelete(ctx context.Context, cluster *clusterv1.Cluster, machinepool *expv1.MachinePool) error { | ||
deleteAllowed, clusterClient, err := r.isDeleteMachinePoolAllowed(ctx, 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.
how is the Node timeout check related to the PR title/issue? If not can we have a separate PR for that?
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.
they are related , delete the machinePool either with unreachable clusters or when the delete timeout pass.
if err := r.reconcileDeleteNodes(ctx, cluster, mp); err != nil { | ||
// Return early and don't remove the finalizer if we got an error. | ||
return err | ||
// Delete nodes when cluster accessor available & there are nodes to delete. |
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.
should this PR be scoped only to retrieve the cluster client and skip if not functional and is deleting?
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