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

update spec when updating status #2546

Merged
merged 2 commits into from Feb 20, 2024
Merged

update spec when updating status #2546

merged 2 commits into from Feb 20, 2024

Conversation

FxKu
Copy link
Member

@FxKu FxKu commented Feb 19, 2024

Four years ago I moved the setStatus code to the k8sutil package in order to update the status also in the controller scope and not only inside cluster. For this I removed the line c.setSpec(newspec) and left it to the caller to update Spec struct.

However, it was not reflected by all callers which leads to the situation that further Update calls during DELETE events (like removing the finalizer) can be blocked because

  1. the resourceVersion is already higher that it what is stored in c.Spec, in case the status changed (e.g. Running -> UpdateFailed).
  2. Delete() func is not calling c.setSpec unlike the Update() and Create() because without finalizer the Postgresql resource is already gone.

Instead of implementing extra logic to Delete() this PR attempts to bring back the behavior from 4 years ago to update the spec when updating the status.

@jopadi
Copy link
Member

jopadi commented Feb 19, 2024

👍

@jopadi
Copy link
Member

jopadi commented Feb 20, 2024

👍

1 similar comment
@FxKu
Copy link
Member Author

FxKu commented Feb 20, 2024

👍

@FxKu FxKu merged commit e34f19b into master Feb 20, 2024
9 checks passed
@FxKu FxKu deleted the delete-with-finalizer-test branch February 20, 2024 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants