4
votes

I'd like to check that my kubernetes helm chart does not define unused values in values.yaml. This should include any subcharts such that if you've defined subchart.foo.bar: ??? in the top-level values.yaml that key is definitely used in the subchart, or possibly as a short-cut mentioned in the subchart/values.yaml.

This is needed to prevent us from shipping bogus "documentation" in the values.yaml, for example if a key in a subchart has been changed or removed.

Ideally there would also be some possibility to report on which subchart values have not been overridden in the top-level chart, though this is less concerning.

Are there any existing tools that can help with this?

2

2 Answers

1
votes

Since the Helm v3 release you can now define a schema for your values. On commands like helm install your provided values are automatically validated against the schema.

Please see the official documentation: https://helm.sh/docs/topics/charts/#schema-files

Schema validation works for subcharts too, this is also mentioned in the documentation on the link above.

0
votes

AFAIK, there isn't a tool for that. However, it shouldn't be that hard to make one, even using bash. For example, you need to export all key/value pairs like this test.test1.test2 and grep for that string recursively in the templates folder. If you want to read yaml using bash, you can install shyaml. If you know how to code in Python, even better.