helm-docs
helm-docs copied to clipboard
Enable filtering `valuesTable` to a subset of values
In the couchdb helm chart, values are segregated into subsections that are relevant to one another.
This can be a very useful pattern to highlight values appropriate in particular contexts, and cuts down on the "overload" that can happen with a giant values table.
It would be nice to auto-generate these sub-sections, which requires some type of change to helm-docs AFAICT (the workaround is currently to overload the charts.valuesTable definition and do a bunch of manual if/else checking).
It would be ideal to expose this functionality to the user (i.e. does not need to be a dedicated feature in helm-docs), although a feature / dedicated template here may be nice as well.
I believe #155 would provide a solution with omit, in particular (although this would probably need to be within the range since "filtering" an array is tricky). Perhaps something like this from the user's perspective could work (pseudocode):
{{- $sectionKeys := list "One" "Two" "Three.Four" }}
{{- $tmpValues := list }}
{{- range .Values }}
{{- if has $sectionKeys .Key }}
{{- $tmpValues := append $tmpValues (deepCopy .) }}
{{- end }}
{{- end }}
{{ $section := deepCopy . }}
{{ $section.Values = $tmpValues }}
{{ template "chart.valuesTable" $section }}