cloud66-oss / copper

A configuration file validator for Kubernetes.
https://help.cloud66.com/copper/
Apache License 2.0
274 stars 15 forks source link

Rules for validating the filename and/or path #3

Closed bgagnon closed 6 years ago

bgagnon commented 6 years ago

I don't see a way to write Copper rules on the filename. We have a policy that the .yaml manifest file must be named in a certain way. For example, NAME-TYPE.yaml where NAME must match .spec.metadata.name. and TYPE must match .spec.kind.

Similarly, I might want to enforce rules on the parent directories of the manifest. For example, if the directory structure has some correspondence on the .spec.medata.labels values.

Would that be possible to implement, perhaps by exposing the raw filepath to a rule?

khash commented 6 years ago

We're going to add this very soon! Thanks for the suggestion

khash commented 6 years ago

The latest version (0.0.2) has a filename data type which gives you access to configuration filename details like path, expanded_path, name and ext. This should help you achieve what you need.