-
-
Notifications
You must be signed in to change notification settings - Fork 325
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
Split ListParams
and WatchParams
#1162
Conversation
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1162 +/- ##
==========================================
+ Coverage 72.59% 72.65% +0.05%
==========================================
Files 67 67
Lines 5123 5211 +88
==========================================
+ Hits 3719 3786 +67
- Misses 1404 1425 +21
|
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks a lot for doing this. Had missed this new feature, and now wondering how we should integrate it with the larger runtime setup!
I think the change as it stands from a kube-core/client POV is perfectly fine. However, infinite streams/controller flows via watcher
is the real usage point for most users here, it might be worth seeing how to best integrate the "most desired" resource version passing setup into the statemachinery there. The upstream reports indicate that we are doing the wrong thing (e.g. not setting resource_version=0
), if that's the case, maybe we should just do that by default on list-requests in watcher
also. Kubernetes 1.19 (where the feature was introduced) is already below the minimally supported Kubernetes version.
Also made a separate point in there that it might be worth us splitting ListParams
and create an alternate WatchParams
ala WatchOptional
to avoid a validation problem (which i think can also improve the watcher
interface that does not care about all the list options anyway). But that is obviously a bit of a breaking change that requires some extra thought. Happy to not deal with that for now if we can integrate with watcher
.
Ignore the lint failure. Duplicate versions of rustix way down the tree (and one of them is a dev-dep only) that should be added to deny.toml. |
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
@clux I've just realized that I made a huge mistake with these validations. I added a hack to make watchers work with resource version options (without e2e test for now). Could you please take a look and tell me whether you agree with the approach? |
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
253a51d
to
08b3cfc
Compare
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
Missed some doc tests errors. It should be fixed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments - the changes look thorough and well done in general though!
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
@clux I fixed clippy errors and added a couple of tests. Please tell me if something else is required. |
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is looking great now. have only left a couple of minor nits in there.
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me now. Thanks a lot!
Hey, I was doing some sanity checking and doc fixups in
Thus this means it's effectively impossible for us to configure This probably makes this unreleaseable in the current state and unless there's a smart way forward, we probably need to unroll this back into an unconnected enum :( |
@clux got it. I will think about the possible fix meantime. It seems worth opening an issue. |
@nabokihms : i have started a little bit of work on this to try to change it around. The pattern I am trying is back to the tri-state enum, but being a little cleverer about how to expose helpers to compensate. Will have a draft PR up in a little bit. |
ListParams
and WatchParams
Motivation
Split list and watch params
In client-go, some list options only work for watch requests, and some only for list requests. It is not convenient to validate such structures.
To add new field only for lists, it is required to add validations to watch calls to deny them.
Add resource version to ListParams
Speaking from experience, resource version options are helpful. My case is to reduce the Kubernetes API server load by providing the
resourceVersion=0
to avoid etcd hits and getting data from the cache.The full explanation of the resource version semantic can be found here.
Some issues to show the usefulness of the option
vectordotdev/vector#7943
kubernetes/kube-state-metrics#1548
Solution
Add resourceVersion and resourceVersionMatch options for ListParams (inspired by client-go)
resourceVersion
for get requests will be a breaking change, so I decided to go with just lists for nowSplit list and watch params: