kube-rs / kopium

Kubernetes OPenapI UnMangler
Apache License 2.0
112 stars 21 forks source link

Add relaxed mode for partially invalid CRDs #215

Closed poelzi closed 5 months ago

poelzi commented 6 months ago

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.

clux commented 6 months ago

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.