GoogleCloudPlatform / prometheus-engine

Google Cloud Managed Service for Prometheus libraries and manifests.
https://g.co/cloud/managedprometheus
Apache License 2.0
191 stars 87 forks source link

Export Schemas as json #922

Open userbradley opened 5 months ago

userbradley commented 5 months ago

I am trying to use Kubeconform with the CRD's from this repo, but I cant find the schema json files.

Please can you publish them similar to https://github.com/fluxcd-community/flux2-schemas

Thanks

bwplotka commented 5 months ago

👋🏽 Hello

Nice! First time I see https://github.com/yannh/kubeconform -- I assume it allows to validate your configuration on CI e.g. before your GitOps just by fetching local definitions.

Also checked Prometheus Operator for reference, they don't have such thing yet, but have some requests for it: https://github.com/prometheus-operator/prometheus-operator/issues/4713 and https://github.com/prometheus-operator/prometheus-operator/issues/4259

The work that needs to be done is similar to what's explained in https://github.com/prometheus-operator/prometheus-operator/issues/4259#issue-994738586

Apply some modifications: add // +k8s:openapi-gen=true comment to the apis/externalsecrets/v1alpha1 and apis/meta/v1 packages
Using kube-openapi we are generating OpenAPI specs
Using openapi2jsonschema we are generating Json Schema definitions and insert them to our Helm Charts schemas.

I think we could consider that, adding extra deps to our CI are not ideal, but maybe it's not too bad.

This is an OSS project, so contributions welcome! Help wanted, not sure when maintainers will have time to develop this.

userbradley commented 5 months ago

Thanks for getting back to me @bwplotka! I'd be more than happy to help create a PR.

I'm still quite new to the CRD side of Kubernetes, and then the extra layer of generating the schemas in Go.

Would you be able to point me to a single file where I need to add those comments, then I can figure it out from there?

Thanks