roboll / helmfile

Deploy Kubernetes Helm Charts
MIT License
4.05k stars 566 forks source link

`helmfile values` to output final resolution of values and secrets #430

Open DarrenBishop opened 5 years ago

DarrenBishop commented 5 years ago

This is a feature request.

This is entirely for debugging purposes and should include secrets - maybe with a --secrets flag - and should also take into consideration environments.

I conjured up this idea while trying to figure out what was going on (or rather, not going on) when trying to leverage both helmfiles: and environments: with the concept of default (for all environments) values to be overridden by specific environment values.

Putting aside whether what I am attempting can work, a dump of the resolved values is less noisy than rendering the templates or doing a dry-run; that is, the charts are known to be sound, but the values being injected are perhaps not.

royjs commented 5 years ago

I stumbled into exactly the same issue. It's hard to debug templated values without it

DarrenBishop commented 5 years ago

I came up with a workaround; I created templates/values.yaml in my Helm chart with the following:

{{- if .Values.debug_values }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: debug-values
  labels:
    application: {{ .Values.application }}
    component: {{ include "chart.componentlabel" $ }}
    release: {{ .Release.Name }}
    chart: {{ include "chart.versionedname" $ }}
    heritage: {{ .Release.Service }}
data:
  values.yaml: |
{{ toYaml .Values | indent 4 }}
{{- end }}

Then use helm template -set debug_values=true,application=${APPLICATION} -x templates/values.yaml $HELM_CHART_REPO/my-chart

That aside still hope to see helmfile values in the near future.

mumoshu commented 5 years ago

@DarrenBishop @royjs Hey! Thanks for the request. I need it, too :)

Regarding implementation, how do you want the output to look like?

Would it be as easy as just printing the path to helmfile yaml file, and then the final environment values for it in YAML, repeated for every sub-helmfiles found recursively?

mumoshu commented 5 years ago

@DarrenBishop @royjs How should helmfile format the environment values across (sub-)helmfiles?

Would you be just ok with something not valid as YAML:

# path: path/to/helmfile.yaml
# environment: default
<environment values in yaml, for helmfile.yaml>

# path: path/to/subhelmfile.yaml
# environment: default
<environment values in yaml, for subhelmfile.yaml>

Or one that is a valid YAML?

- path: path/to/helmfile.yaml
  environment: default
  values: <environment values in yaml, for helmfile.yaml>
- path: path/to/subhelmfile.yaml
  environment: default
  values: <environment values in yaml, for subhelmfile.yaml>
royjs commented 5 years ago

For me it's really for debugging purposes so I would be ok with something that is not valid YAML.