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

Feature: Make json-schema files available #1411

Closed
bjartek opened this issue Apr 20, 2021 · 5 comments
Closed

Feature: Make json-schema files available #1411

bjartek opened this issue Apr 20, 2021 · 5 comments

Comments

@bjartek
Copy link

bjartek commented Apr 20, 2021

We are using https://kubeval.instrumenta.dev/ to validate kubernetes manifests against their schema. Currently we are skipping kinds that does not have a schema since we do not have access to the AZO schema files. Can you make them available in the release in github or in some other way?

@matthchr
Copy link
Member

@bjartek - I'm not super familiar with kubeval, but their documentation on CRDs says:

Currently kubeval relies on schemas generated from the Kubernetes API. This means it's not possible to validate resources using CRDs.

Since all ASO resources are CRDs, it seems validating them using kubeval isn't supported?

The schemas for the CRDs are the CRDs themselves, which are really OpenAPI schemas and should adhere to the Kubernetes structural schema.

@bjartek
Copy link
Author

bjartek commented Apr 20, 2021

That documentation is wrong. I will get them to fix it.

Here is how the flux ppl do it https://github.com/fluxcd/flux2-kustomize-helm-example/blob/main/scripts/validate.sh

@matthchr
Copy link
Member

I see, and they generate those schemas by running an action which you can see defined here. Specifically they seem to be executing this python script to extract the JSON schema from the OpenAPI specification.

To workaround our lack of schemas right now you can just transform the CRD YAMLs into JSON schemas yourself by using that same script/Dockerfile. The YAMLs are in included in the ASO release in the setup.yaml file.

I'm a bit surprised that Kubeval doesn't just understand how to do that itself though - it seems awkward to require CRD authors to do what amounts to some simple transformations on the CRDs they're publishing. Kubeval could just as easily do those transforms on their side and it'd work for every CRD out of the box. Actually I see that even others have pointed this out in this issue (this issue also has some docs around how to do the conversions).

@bjartek
Copy link
Author

bjartek commented Apr 20, 2021

Awesome research! I will look into this :)

@theunrepentantgeek
Copy link
Member

theunrepentantgeek commented Jul 5, 2021

This discussion seems to have resolved the original request; closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants