-
-
Notifications
You must be signed in to change notification settings - Fork 312
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
Minor fixes to ObjectList
#1398
Conversation
…tion The `serde` crate has a bug that prevents the proper deserialization of attributes that are using the `flatten` and `default` directives. See [1] and [2]. This bug affects the freshly introduced `ObjectList.types` attribute. It's not possible to deserialize an `ObjectList` that is missing the `apiVersion` and/or the `kind` values. This commit introduces a custom deserializer for the `types` attribute of `ObjectList`. On top of handling the deserialization case, the custom deserializer provides better default values compared to the ones of the stock `TypeMeta`. The `TypeMeta` struct has empty strings as default values. However, in the context of `ObjectList`, proper default values should be `v1` and `List` instead. [1] serde-rs/serde#1626 [2] serde-rs/serde#1879 Signed-off-by: Flavio Castelli <[email protected]>
Ensure `ObjectList` derive the `Clone` trait. Signed-off-by: Flavio Castelli <[email protected]>
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.
Ah, damn. Sorry about this, but thanks a lot for coming up with such a clean fix!
This all looks good to me. Happy to merge and do a patch release when CI is green.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1398 +/- ##
=======================================
+ Coverage 72.1% 72.1% +0.1%
=======================================
Files 75 75
Lines 6458 6470 +12
=======================================
+ Hits 4651 4663 +12
Misses 1807 1807
|
Signed-off-by: Flavio Castelli <[email protected]>
@clux thanks for the review. I've pushed a commit that fixes the rustfmt issue |
Thanks! Released in 0.88.1 |
kube 0.88.0 introduced a minor regression: kube-rs/kube#1398 That caused kwctl 1.10.0 to fail while running e2e tests under specific circumstances. Replaying a host capabilities sessions recorded with an older version of kwctl would cause Rego policies to fail. waPC policies would not fail. This patch release of kwctl addresses this specific regression. Signed-off-by: Flavio Castelli <[email protected]>
Motivation
Starting from the
0.88.0
release,ObjectList
has a new attribute namedtypes
. This attribute is serialized and deserialized using theflatten
directive of serde.However, it turns out that
serde
has a bug that prevents the proper deserialization of attributes that are using theflatten
anddefault
directives. See here and here.This serde bug affects the freshly introduced
ObjectList.types
attribute. It's not possible to deserialize anObjectList
that is missing theapiVersion
and/or thekind
values.Solution
This commit introduces a custom deserializer for the
types
attribute ofObjectList
that solves this problem.On top of handling the deserialization case, the custom deserializer provides better default values compared to the ones of the stock
TypeMeta
.The
TypeMeta
struct has empty strings as default values. However, in the context ofObjectList
, proper default values should bev1
andList
instead.There's also a second commit to this PR that makes
ObjectList
derive theClone
trait. This is not related with this specific issue, but is something that some code I've written would take advantage of. If you're not fine with this specific commit I can drop it from this PR.