kube
kube copied to clipboard
Move `ApiCapabilities` into `ApiResource` and add `Scope` trait
Generally simplified code everywhere. The main edge cases worth documenting here is that ApiResource can be constructed in multiple ways, and some of these will not yield all the fields on it.
- ~~Merged~~Moved
ApiCapabilitiesdata intoApiResource - Add
shortnamestoApiResourcefor #1002 - Removed separate
ApiCapabilitiesreturns (always constructed together withApiResource, so now returned as one) - Added a
Scopetrait implemented for allk8s-openapi::ResourceScope+ ourDynamicResourceScope - Refined the
Resourcetrait to require the associated Scope type to implement the newScopetrait - Added
Resource::is_namespacedusingScopetrait or dyn type inspection - Extended
ApiResource::eraseto be able to determinenamespacedbool from theScopetrait - Reclassified
ApiResourcectors (removedApiResource::from_gvk_with_pluralin favour ofApiResource::new) - Added setters of properties previously in
ApiCapabilitiestoApiResource - Extended kube-derive to default verbs on its
ApiResource - LATER: Extend kube-derive to provide subresources on its
ApiResource(todo in #1037) - Re-documented everything related / fix tests
Codecov Report
Merging #1038 (39f8116) into main (a26e7f3) will decrease coverage by
0.46%. The diff coverage is66.25%.
Additional details and impacted files
@@ Coverage Diff @@
## main #1038 +/- ##
==========================================
- Coverage 72.29% 71.82% -0.47%
==========================================
Files 65 66 +1
Lines 4681 4699 +18
==========================================
- Hits 3384 3375 -9
- Misses 1297 1324 +27
| Impacted Files | Coverage Δ | |
|---|---|---|
| kube-client/src/lib.rs | 93.75% <ø> (ø) |
|
| kube-core/src/crd.rs | 82.92% <ø> (ø) |
|
| kube-core/src/dynamic.rs | 63.63% <0.00%> (-3.04%) |
:arrow_down: |
| kube-core/src/object.rs | 77.41% <0.00%> (-2.59%) |
:arrow_down: |
| kube-derive/src/custom_resource.rs | 13.83% <ø> (ø) |
|
| kube-runtime/src/reflector/store.rs | 95.16% <ø> (ø) |
|
| kube-runtime/src/utils/mod.rs | 62.96% <ø> (ø) |
|
| kube-core/src/scope.rs | 16.66% <16.66%> (ø) |
|
| kube-core/src/discovery.rs | 86.66% <36.84%> (-11.09%) |
:arrow_down: |
| kube-client/src/discovery/parse.rs | 93.75% <91.66%> (-0.85%) |
:arrow_down: |
| ... and 6 more |
Eyes on this would be appreciated @kube-rs/maintainers .
Clarity on how to convert between scope requirement on dynamic and static types is needed for a good way forward on the new client api in #1037, but this should stand well on its own without that (even though it doesn't go all the way with subresources).
Going to put this on hold until 0.77. I have some ideas for it, but it's been a while since a release and will get that out the door first.