instrumenta / kubeval

Validate your Kubernetes configuration files, supports multiple Kubernetes versions
https://kubeval.com
Other
3.16k stars 229 forks source link

Add Support for .kubevalignore file #358

Open rufreakde opened 1 year ago

rufreakde commented 1 year ago

Hi there, a tool like this - that can be used accross a lot of different repositories - would benefit in its flexibility by a lot if we could configure it to ignore specific files even if they are in the recursive list of resources.

Example scenario we have a repository with a lot of k8s files and this is fine but now we got additionally a kustomize patch and this is where it breaks.


echo "# Kubeval - Checking dev/"
kubeval  --ignore-missing-schemas --directories ./dev || exit 4

Ideally we would like to add a ".kubevalignore" with something like this:

# Match only directories containing kustomization or overlay
*kustomization*/
*overlay*/

This way we can ignore the patches and other kustomization that is not a valid manifest.

rufreakde commented 1 year ago

Currently teams have to define a path pattern for ignored folders e.g.

--ignored-path-patterns ".*kustomization.*"

This makes it hard to use the same pipeline CI task on many different teams.

rdelpret commented 1 year ago

@rufreakde I would also like a kubeval ignore file but for your use case, wouldn't you want to do a

kustomize build . | kubeval

to evaluate the final set of manifests?