This repository was archived by the owner on Sep 14, 2020. It is now read-only.
Avoid purging the annotations that are already absent #362
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What do these changes do?
Fix a potential bug when unnecessary state purging could prevent the following handling cycles from happening.
Description
This bug was not detected in practice (probably), but it could happen so that purging of a persisted annotation with a handler's state (by patching it with
None
) could lead to actual absence of changes on the server side if that annotation was already absent, but preventing a dummy-patch to be applied in Kopf because the main patch is not empty.This, in turn, could lead to no watch-events reported by Kubernetes API (as nothing has changed), and Kopf would not react with the following steps until the next (probably unrelated) change.
Now, with this fix, if the annotation is already absent in the body, it will not be nullified in the patch, letting a dummy-patch to be applied to trigger the next steps.
The only meaningful change is the
purge()
method. Other methods are switched to thedicts
methods for consistency with the status storage (it is easier to manage the annotations that way).Issues/PRs
Type of changes
Checklist
CONTRIBUTORS.txt