This repository has been archived by the owner on Dec 8, 2023. It is now read-only.
event-watcher: don't parse resource version #12
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.
Parsing the resourceVersion as an integer is strictly prohibited by the Kubernetes API [1]. During a review of code that would be affected by non-numerical resourceVersions, I came upon this code.
It looks like this code was using resource version comparison to only handle "new" objects. The Kubernetes watch API ensures that events on a watch stream are delivered once and only once, and always in order. Therefore, no check of this sort is necessary as each new event will always be unique and newer than any previous event.
[1] https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions
Signed-off-by: Steve Kuznetsov [email protected]