yannh / kubeconform

A FAST Kubernetes manifests validator, with support for Custom Resources!
Apache License 2.0
2.21k stars 122 forks source link

Prometheus CRDS validation failing post upgrade #294

Open varunthakur2480 opened 2 days ago

varunthakur2480 commented 2 days ago

I have been trying to upgrade to Prometheus v0.14 https://github.com/prometheus-operator/kube-prometheus/tree/release-0.14 but my pipelines fail during kubeconfm validation . With following error stdin - CustomResourceDefinition prometheuses.monitoring.coreos.com failed validation: error unmarshalling resource: error converting YAML to JSON: yaml: line 1737: did not find expected key I have tried skipping the crds using -skip "monitoring.coreos.com/v1,monitoring.coreos.com/v1alpha1" which does not seem to work , its worth mentioning that the validation fails even if I remove the schemas from validation path with same error and I also have --ignore-missing-schemas enabled which leads me to believe that kubeconfm is actually failing before it can even start to match the schema

varunthakur2480 commented 1 day ago

I have an update to share: We were using kustomize command to generate the yaml config and passing it onto kubeconform directly like this ` - alias kubeconform='kubeconform -schema-location "/usr/local/share/kubernetes-json-schema/master-standalone/{{ .ResourceKind }}{{ .KindSuffix }}.json" -schema-location "/usr/local/share/custom-json-schema/{{ .ResourceKind }}-{{ .ResourceAPIVersion }}.json" -ignore-missing-schemas -verbose -summary '

kustomize build . | kuebconform`

However it was constantly failing with stdin - CustomResourceDefinition prometheuses.monitoring.coreos.com failed validation: error unmarshalling resource: error converting YAML to JSON: yaml: line 1737: did not find expected key

Playing around I decided to save the output first to a file and then run kubeconform against that file `