yannh / kubeconform

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

Edit strict mode to throw errors on additional properties, not found in the schema #234

Open llxp opened 9 months ago

llxp commented 9 months ago

This pull request changes the strict mode in such a way, that when there are additional properties in the schema, it throws an error. It sets additional properties to false in the schema, if strict mode is set. Also introduces an additional parameter to exclude specific properties using a yaml path. By default, if no exception is set, the metadata property is excluded, as most k8s yaml schemes are missing it and thus would give out false positives.

yannh commented 7 months ago

Hi @llxp ! Could you expand how this is different from the current behaviour for kubeconform? It should already mark tests as failed when -strict is set and additional properties are found? See this test:

https://github.com/yannh/kubeconform/blob/808e6d4aa585dd7fe51465b0a148fbc86d65a264/acceptance.bats#L136-L139

What exactly are you trying to achieve?