Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Parsing Resource Version Is Not Allowed #466

Open
stevekuznetsov opened this issue Nov 28, 2022 · 3 comments
Open

Parsing Resource Version Is Not Allowed #466

stevekuznetsov opened this issue Nov 28, 2022 · 3 comments
Labels
type/bug Something isn't working

Comments

@stevekuznetsov
Copy link

Overview of the Issue

The Kubernetes API explicitly disallows parsing the metadata.resourceVersion field on an object as an integer. This project, however, does so as of this commit: cb0486e

During a review of code that would be affected by non-numerical resourceVersions, I came upon this code. I'm hoping to better understand what this codebase is using the parsing logic for and if there are other means to that end without using non-supported API behavior. I can see that uses of the parsing seem to all be in precondition functions passed to Upsert* methods on a store. This looks analogous to the resource version precondition provided by the Kubernetes API server, but the only implementation of the store I found was an in-memory one here - so I'm not entirely sure how the Kubernetes client and server get involved here.

@nathancoleman
Copy link
Member

Hi @stevekuznetsov , thanks for reporting!

Personally, I wasn't aware of that note RE: metadata.resourceVersion. We're just parsing as an integer today to guard against incorrectly updating to an older version; however, it looks like the watcher probably handles that for us. If that's the case, we can just do an equality check as mentioned by the docs that you linked.

@nathancoleman nathancoleman added the type/bug Something isn't working label Nov 29, 2022
@nathancoleman nathancoleman linked a pull request Nov 29, 2022 that will close this issue
2 tasks
@stevekuznetsov
Copy link
Author

Gotcha - if you could help me understand the in-memory storage you have and when/if/how it gets synced to a running k8s API server, I could help fix it!

@nathancoleman
Copy link
Member

@andrewstucki provided some additional context over on my PR
#467 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants