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

🐛 Fix deletion patch error #163

Merged
merged 4 commits into from
Jun 25, 2024
Merged

🐛 Fix deletion patch error #163

merged 4 commits into from
Jun 25, 2024

Conversation

lubedacht
Copy link
Contributor

What is the purpose of this pull request/Why do we need it?

This PR fixes a bug that occurs during the deletion of machines.

The patch helper will always calculate a diff and patch the resource and status accordingly. At the time of the deletion when removing the finalizer, we need to make sure, that there is no more change in the status anymore. We are always checking for requests at the beginning of a reconcile function. Those requests are stored in the status and upon completion, those will be removed from the status. The machine controller will patch the status in the end.

The order of the patch helper is

  1. Patch object
  2. Patch status

When the finalizer is removed and the object patch completed, the resource is gone. The next patch request against the status will therefore fail with a NotFound error.

Description of changes:

Adds a check to the checkRequestStates function that will patch the object and requeue before proceeding with the deletion logic.

Checklist:

mcbenjemaa
mcbenjemaa previously approved these changes Jun 25, 2024
Copy link
Member

@mcbenjemaa mcbenjemaa left a comment

Choose a reason for hiding this comment

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

LGTM

I'm aware of this

Co-authored-by: Jonas Riedel <138458199+jriedel-ionos@users.noreply.github.com>
Copy link

@lubedacht lubedacht merged commit a593b60 into main Jun 25, 2024
10 checks passed
@lubedacht lubedacht deleted the ignore-not-found-error branch June 25, 2024 15:33
jriedel-ionos added a commit that referenced this pull request Jun 26, 2024
Co-authored-by: Jonas Riedel <138458199+jriedel-ionos@users.noreply.github.com>
jriedel-ionos added a commit that referenced this pull request Jun 26, 2024
**What is the purpose of this pull request/Why do we need it?**

Cherry pick of #163 for release 0.2.1

Co-authored-by: lubedacht <132355999+lubedacht@users.noreply.github.com>
Mattes83 pushed a commit to Mattes83/cluster-api-provider-ionoscloud that referenced this pull request Jun 26, 2024
Co-authored-by: Jonas Riedel <138458199+jriedel-ionos@users.noreply.github.com>
Mattes83 pushed a commit to Mattes83/cluster-api-provider-ionoscloud that referenced this pull request Jun 27, 2024
Co-authored-by: Jonas Riedel <138458199+jriedel-ionos@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants