Skip to content
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

Add relaxed mode for partially invalid CRDs #215

Merged
merged 2 commits into from
Apr 1, 2024

Conversation

poelzi
Copy link
Contributor

@poelzi poelzi commented Mar 21, 2024

Fixes #108

Argo workflows have 2 CRDs, minimal and full.
The full CRD is supposed to be used in the editor and can't be installed in kubernetes, but provide full validation. The minimal version has no validation and should be installed.

In --relaxed mode, entries like inline: {} are mapped to object like hashmaps, empty arrays are ignored.

You can't use the normal tests because the crds are not installable.

Fixes kube-rs#108

Argo workflows have 2 CRDs, minimal and full.
The full CRD is supposed to be used in the editor and can't be
installed in kubernetes, but provide full validation.
The minimal version has no validation and should be installed.

In `--relaxed` mode, entries like `inline: {}` are mapped to
object like hashmaps.

Signed-off-by: Daniel Poelzleithner <poelzleithner@b1-systems.de>
@clux
Copy link
Member

clux commented Mar 21, 2024

Hey, thanks a lot for this. I think the strategy chosen here makes complete sense given that it's a place we already bail!.

I see tests are difficult to do in the integration setting, but I have one simpler suggestion, if you are able; you could try to extract a unit test (in the style of the ones found in analyzer.rs) on one of these emptier blocks in the schema (we test subsections of the schemas), and we can verify that the output you produce in the new fallback actually happens.

src/main.rs Outdated Show resolved Hide resolved
Signed-off-by: Eirik A <sszynrae@gmail.com>
Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for this. ill try to fixup minor test things in main

@clux clux merged commit d5d6864 into kube-rs:main Apr 1, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Argo-Workflows crd's not working
2 participants