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

AzureMachinePoolMachine remove finalizer and avoid recreation if VMSS is deleting #4959

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

mweibel
Copy link
Contributor

@mweibel mweibel commented Jul 2, 2024

What type of PR is this?
/kind bug

What this PR does / why we need it:
This PR fixes the issues related to deleting MachinePools with VMSS still existing. Copying from the linked issue:

  1. MachinePool delete deletes the VMSS
  2. Finalizer on AzureMachinePoolMachine gets removed because AzureMachinePool's deletionTimestamp is non zero
  3. Machine gets deleted because dependant AMPM was deleted due to removing the finalizer
  4. At this point however, the VMSS VM still exists
  5. Next reconcile of the AzureMachinePool recreates the AzureMachinePoolMachine again
  6. Now there is no Machine anymore for that AzureMachinePoolMachine and it can't get reconciled/deleted anymore

This PR fixes point 5 by avoiding to recreate the VMSS VM when it's already in Deleting/Deleted state. Additionally it fixes Point 6 (more as a safeguard) by removing a finalizer on an AMPM early on when the AzureMachinePool is deleting and the Machine does not exist.

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

Special notes for your reviewer:
possibly @Jont828 could review this.

  • cherry-pick candidate

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

fixes a few edge cases related to deleting a MachinePool

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 2, 2024
@k8s-ci-robot k8s-ci-robot requested review from Jont828 and nojnhuh July 2, 2024 12:18
@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 2, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @mweibel. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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-sigs/prow repository.

Copy link

codecov bot commented Jul 3, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 62.23%. Comparing base (e699f04) to head (f4153d3).
Report is 79 commits behind head on main.

Files Patch % Lines
.../controllers/azuremachinepoolmachine_controller.go 85.71% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4959   +/-   ##
=======================================
  Coverage   62.22%   62.23%           
=======================================
  Files         201      201           
  Lines       16886    16894    +8     
=======================================
+ Hits        10508    10514    +6     
- Misses       5585     5588    +3     
+ Partials      793      792    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mboersma
Copy link
Contributor

mboersma commented Jul 3, 2024

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 3, 2024
@mweibel
Copy link
Contributor Author

mweibel commented Jul 5, 2024

thanks @mboersma. I believe the failed test is due to #4939 being not merged yet.

@mweibel
Copy link
Contributor Author

mweibel commented Jul 29, 2024

/retest

@mweibel
Copy link
Contributor Author

mweibel commented Jul 29, 2024

nvm latest comment - could anyone please review this change? Tests pass :)

Copy link
Contributor

@mboersma mboersma left a comment

Choose a reason for hiding this comment

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

/lgtm
/assign @nojnhuh

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

LGTM label has been added.

Git tree hash: 89b209ef127313e094dbb69c0c6adffe03165e86

Copy link
Contributor

@nojnhuh nojnhuh 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: nojnhuh

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 Jul 29, 2024
@mweibel
Copy link
Contributor Author

mweibel commented Jul 30, 2024

/retest

@mweibel
Copy link
Contributor Author

mweibel commented Jul 30, 2024

feels like those test failures are not related to my changes, but maybe I'm wrong.

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jul 30, 2024

@mweibel: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-provider-azure-e2e-with-wi-optional f4153d3 link false /test pull-cluster-api-provider-azure-e2e-with-wi-optional

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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 understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot merged commit 57ea5b8 into kubernetes-sigs:main Jul 30, 2024
20 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.17 milestone Jul 30, 2024
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. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Deleting a MachinePool can result in stuck AzureMachinePoolMachine due to recreation
4 participants