yannh / kubeconform

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

Multi schema-location doesn't work properly #191

Closed hosein-yousefii closed 1 year ago

hosein-yousefii commented 1 year ago

Hello,

I faced an issue today by using multi schema-location, Kubeconform just check the code against the first schema-location.

kubeconform

In the first command the servicemonitor came first so it just validate it. In the second command the kafkaconnector came first so it just validate it.

so when you have multi CRDs schema you would face a problem.

eyarz commented 1 year ago

this is the expected behavior. you're "forcing" kubeconform to validate servicemonitor and kafkaconnector against the same schema. to validate both resources, replace the multiple schema location with this:

kubeconform --schema-location '{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' 
hosein-yousefii commented 1 year ago

Thanks for that, I just realized how it works.