datreeio / CRDs-catalog

Popular Kubernetes CRDs (CustomResourceDefinition) in JSON schema format.
MIT License
440 stars 169 forks source link

kubeconform + monitoring.coreos.com #257

Closed fals closed 3 months ago

fals commented 5 months ago

I'm using kubeconform to validate my schemas, but I can't make it work with monitoring.coreos.com, and checking the last week commits had some fixes in the repo but still.

$ kubeconform -schema-location default -schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' -summary dev.yaml
helm-charts/artifacts/dev.yaml - CustomResourceDefinition alertmanagers.monitoring.coreos.com failed validation: could not find schema for CustomResourceDefinition
helm-charts/artifacts/dev.yaml - CustomResourceDefinition probes.monitoring.coreos.com failed validation: could not find schema for CustomResourceDefinition
helm-charts/artifacts/dev.yaml - CustomResourceDefinition podmonitors.monitoring.coreos.com failed validation: could not find schema for CustomResourceDefinition
helm-charts/artifacts/dev.yaml - CustomResourceDefinition alertmanagerconfigs.monitoring.coreos.com failed validation: could not find schema for CustomResourceDefinition
helm-charts/artifacts/dev.yaml - CustomResourceDefinition prometheusagents.monitoring.coreos.com failed validation: could not find schema for CustomResourceDefinition
helm-charts/artifacts/dev.yaml - CustomResourceDefinition prometheusrules.monitoring.coreos.com failed validation: could not find schema for CustomResourceDefinition
helm-charts/artifacts/dev.yaml - CustomResourceDefinition scrapeconfigs.monitoring.coreos.com failed validation: could not find schema for CustomResourceDefinition
helm-charts/artifacts/dev.yaml - CustomResourceDefinition servicemonitors.monitoring.coreos.com failed validation: could not find schema for CustomResourceDefinition
helm-charts/artifacts/dev.yaml - CustomResourceDefinition prometheuses.monitoring.coreos.com failed validation: could not find schema for CustomResourceDefinition
helm-charts/artifacts/dev.yaml - CustomResourceDefinition thanosrulers.monitoring.coreos.com failed validation: could not find schema for CustomResourceDefinition
Summary: 152 resources found in 1 file - Valid: 142, Invalid: 0, Errors: 10, Skipped: 0

Am I missing something?

kubeconform v0.6.4

Skaronator commented 3 months ago

Yeah, you need to define a schema location for CustomResourceDefinitions (don't confuse it with actual CR).

I had the same issue and documented my findings in the kubeconform repository: https://github.com/yannh/kubeconform/issues/51#issuecomment-1991390413

fals commented 3 months ago

@Skaronator this is exactly what I needed. I believe this should be somehow part of the documentation, it is quite confusing indeed the usage of the CDRs vs CRs