Skip to content
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

🐛 Wait for MachinePools to be deleted before deleting KCP Machines #4646

Merged

Conversation

CecileRobertMichon
Copy link
Contributor

What this PR does / why we need it: As per #3863 (comment) when doing when "Waiting for worker nodes to be deleted first" inside reconcileDelete, KCP should wait for MachinePools to be deleted as well.

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 #3880

@CecileRobertMichon CecileRobertMichon changed the title 🐛 Wait for MachinePools to be deleted before deleting KCP Machines 🐛 Wait for MachinePools to be deleted before deleting KCP Machines May 20, 2021
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 20, 2021
@CecileRobertMichon
Copy link
Contributor Author

MHC flake

/retest

},
}

initObjs := []client.Object{cluster.DeepCopy(), kcp.DeepCopy(), workerMachinePool.DeepCopy()}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This deepCopy is fine though is a bit redundant. I see this is calling newFakeClient which calls NewFakeClientWithScheme which already deepCopy the objects

objsWithResourceVersion := initObjs[i].DeepCopyObject().(client.Object)

Also the fakeClient tracker itself deepCopy as well.

https://github.com/kubernetes/client-go/blob/master/testing/fixture.go#L373-L376

@enxebre
Copy link
Member

enxebre commented May 21, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 21, 2021
@fabriziopandini
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 21, 2021
@k8s-ci-robot k8s-ci-robot merged commit 9acee8c into kubernetes-sigs:master May 21, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.4 milestone May 21, 2021
// Verify that only control plane machines remain
if len(allMachines) != len(ownedMachines) {
if len(allMachines) != len(ownedMachines) || len(allMachinePools.Items) != 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we sum all the dependents in a single integer? If later on we add more classes it might be easier to reason about

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KCP should consider MachinePools when doing delete
5 participants