-
-
Notifications
You must be signed in to change notification settings - Fork 371
Replace serde_yaml with serde-saphyr in kube-client #1848
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: John Vandenberg <[email protected]>
Signed-off-by: John Vandenberg <[email protected]>
632b265 to
c0ebc7e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1848 +/- ##
=======================================
- Coverage 74.6% 74.6% -0.0%
=======================================
Files 84 84
Lines 7910 7905 -5
=======================================
- Hits 5900 5895 -5
Misses 2010 2010
🚀 New features to boost your workflow:
|
clux
left a comment
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. I like the progress on saphyr and am positive on merging this myself. Maybe @nightkr has opinions.
Btw, there is still a lot of usage of serde-yaml in the examples, might be worth converting at least one of the non-trivial ones there (like the kubectl example) also if you have time.
| documents.push(kubeconfig); | ||
| } | ||
| Ok(documents) | ||
| serde_saphyr::from_multiple(text).map_err(KubeconfigError::Parse) |
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 seems sensible and we are already changing the error type in a breaking way anyway here so if the old error falls away then that's probably ok.
|
A global replace of As a result, doing the examples is best done by someone with more familiarity with them. For example, here is a test failure in
all the other tests in |
|
IMO if this is merged, it should be put through its paces a bit by devs before releasing. I suspect there would be a subset of kube config files which may no longer parse, due to weird indentation for example. If we wanted perfect compatibility with |
|
Pure Rust would, of course, be nice, but I'm still not massively sold on taking on the new dependency from authors that I'm not really familiar with. In general, I'd lean towards serde-norway instead (from what I have seen of cafkafk, and because sticking to basically-the-same-serde-yaml-as-before seems less likely to break things), but I also haven't really been keeping track of which way the overall tide is turning. Us sticking to a serde-yaml fork doesn't do much for the supply chain if the rest of the ecosystem ends up pulling in serde-saphyr anyway. That said, going through the README I do have a few questions:
I also haven't reviewed the code itself or looked too deep into saphyr-rs. |
|
Note serde_norway is maintained, but has the same problems in the unsafe code in it that caused the maintainer of serde_yaml to deprecate it. serde_yaml has a pending RUSTSEC PR, but serde_norway will also have one after the first has settled down. https://github.com/romnn/yaml-spanned doesnt have the same problem, because it uses https://github.com/simonask/libyaml-safer which doesnt have unsafe code. |
|
ping @bourumir-wyngs so they can consider the points raised above. |
|
Motivation
#1770
Solution
Use https://github.com/bourumir-wyngs/serde-saphyr in kube-client as the first phase of solving this.
The other uses of serde_yaml are in dev-dependencies.