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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Watch external objects for machine before deleting #10041

Merged

Conversation

g-gaston
Copy link
Contributor

What this PR does / why we need it:
This fixes a race condition in the machine controller when the controller is restarted after a machine has been marked for deletion but before the infra machine or bootstrap config are deleted. In that case, the controller doesn't have watches on those external objects, so the reconciliation is not triggered once they are deleted. This means that Machines stay in Deleting state for the resync period, the default is 10 minutes.

/area machine

@k8s-ci-robot k8s-ci-robot added area/machine Issues or PRs related to machine lifecycle management cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 23, 2024
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 23, 2024
@g-gaston g-gaston force-pushed the race-condition-machine-controller branch from ae978a0 to 639fbb0 Compare January 23, 2024 17:44
Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Very nice! Just one finding

@sbueringer
Copy link
Member

/assign @fabriziopandini @chrischdi

This fixes a race condition in the machine controller when the controller is restarted after a machine has been marked for deletion but before the infra machine or bootstrap config are deleted. In that case, the controller doesn't have watches on those external objects, so the reconciliation is not triggered once they are deleted. This means that Machines stay in Deleting state for the resync period, the default is 10 minutes.
@g-gaston g-gaston force-pushed the race-condition-machine-controller branch from 639fbb0 to d3e5979 Compare February 15, 2024 15:29
@sbueringer
Copy link
Member

Thx!

/lgtm

/assign @fabriziopandini @vincepri @chrischdi

I think we should backport

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 15, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: cd62ed545b544f666be181291293817ebbcb8126

Copy link
Member

@chrischdi chrischdi left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chrischdi

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 Feb 16, 2024
@k8s-ci-robot k8s-ci-robot merged commit d28a1c9 into kubernetes-sigs:main Feb 16, 2024
20 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.7 milestone Feb 16, 2024
@g-gaston
Copy link
Contributor Author

/cherry-pick release-1.6

@k8s-infra-cherrypick-robot

@g-gaston: #10041 failed to apply on top of branch "release-1.6":

Applying: Watch external objects for machine before deleting
Using index info to reconstruct a base tree...
M	internal/controllers/machine/machine_controller.go
M	internal/controllers/machine/machine_controller_phases.go
M	internal/controllers/machine/machine_controller_test.go
Falling back to patching base and 3-way merge...
Auto-merging internal/controllers/machine/machine_controller_test.go
Auto-merging internal/controllers/machine/machine_controller_phases.go
CONFLICT (content): Merge conflict in internal/controllers/machine/machine_controller_phases.go
Auto-merging internal/controllers/machine/machine_controller.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Watch external objects for machine before deleting
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-1.6

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.

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. area/machine Issues or PRs related to machine lifecycle management 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants