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 resource validation #898

Merged
merged 1 commit into from
Jan 29, 2021

Conversation

paulfantom
Copy link
Member

@paulfantom paulfantom commented Jan 29, 2021

Adding validation of generated resources. This is an updated version of #785

@yannh
Copy link
Contributor

yannh commented Jan 29, 2021

👋 Hi there, you might want to review whether instrumenta/kubernetes-json-schema#26 might be a problem for you. I'm now maintaining a fork of kubernetes-json-schema which is more up to date.

Validation works with:
$ ./bin/kubeconform -summary -schema-location 'https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/{{ .NormalizedKubernetesVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}.json' fixtures/valid.yaml
Summary: 1 resource found in 1 file - Valid: 1, Invalid: 0, Errors: 0, Skipped: 0

This is now the default, I should add an alias for it when passing multiple schema locations though.

Co-Authored-By: Yann Hamon <[email protected]>
Co-Authored-By: Kemal Akkoyun <[email protected]>
Signed-off-by: paulfantom <[email protected]>
@paulfantom
Copy link
Member Author

Thank you @yannh! Seems like this is working with default kubernetes-json-schema, but good to know there might be some issues in the future. I added a note in code to follow that issue if anything is breaking.

@paulfantom
Copy link
Member Author

This is also finalizing a thread started in #775

@yannh
Copy link
Contributor

yannh commented Jan 29, 2021

It depends what version of Kubernetes you ll be validating against - by leaving the default it ll be the latest in kubernetesjsonschema.dev which is about a year old. Hopefully it ll get updated again soon :)

Copy link
Member

@kakkoyun kakkoyun left a comment

Choose a reason for hiding this comment

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

Looks great! 🥇

I have just a question inlined.

Makefile Show resolved Hide resolved
@kakkoyun kakkoyun merged commit 8588e30 into prometheus-operator:master Jan 29, 2021
@paulfantom paulfantom deleted the validation branch May 25, 2021 12:56
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.

3 participants