Kubernetes Conftest Against a Set of YAML Files in a Folder

5/12/2020

I'm planning to use conftest to enforce some policies on the Kubernetes YAML files. I had a look at the documentation and there is a flag called --combine with which I can specify multiple YAML files for the test. But my understanding is that the YAML files that I'm combining should be related to each other.

For example., a service and a deployment having a selector that matches.

$ conftest test --combine deployment.yaml service.yaml

This is to some extent good, but can't conftest do some bootstrapping to find this by itself so that I only specify the folder where my YAML files are and conftest does the rest with the rego files that I have in my policy directory?

-- sparkr
conftest
kubernetes

0 Answers