#helmfile (2021-10)
Questions and discussion around helmfile https://github.com/roboll/helmfile and https://github.com/cloudposse/helmfiles
Archive: https://archive.sweetops.com/helmfile/
2021-10-01
2021-10-04
Hi, I’ve been getting segfaults when trying to use toYaml. I made a bug report, does anyone have this issue also? https://github.com/roboll/helmfile/issues/1978
When using toYaml in a release's values, helmfile fails to render the release and ends with a segfault. I was able to reproduce the bug with this setup: helmfile.yaml environments: default: val…
Hey!
I think the problem you’re having is that in the values:
-section of a release you have to refer to a values file and not list the values themselves. A file path is expected. So the release part should look like this:
releases:
- name: "prometheus"
chart: prometheus/kube-prometheus-stack
values:
- values.yaml
However the code should catch illegal paths and log a helpful error message instead of throwing this exception. Hope that helps.
When using toYaml in a release's values, helmfile fails to render the release and ends with a segfault. I was able to reproduce the bug with this setup: helmfile.yaml environments: default: val…
Hi, in my code the use case is a bit more complicated of course. I do not wish to use a whole file, I only want to include part of a file in my values which is why I need to use toYaml. Also that particular use of toYaml is given as an exemple here https://github.com/roboll/helmfile/blob/master/docs/writing-helmfile.md#re-using-environment-state-in-sub-helmfiles which is why I am expecting it to work :)
Deploy Kubernetes Helm Charts. Contribute to roboll/helmfile development by creating an account on GitHub.
In the example you shared the toYaml
is used in the values:
-section of the helmfiles:
-section. You’re using it in the release:
-section. That’s a different thing I guess…
I don’t believe so, but I think I found out why I’m having problems. It’s just that helmfile excepts a list here and that doesn’t work too well with toYaml. The workaround is simply to load the yaml in a .yaml.gotmpl and then give this file to the values (which is also much easier). I’m leaving my bug report because this shouldn’t be a segfault anyways Also FYI it is absolutely possible to use plain values in this list, I have that a lot in my code.
2021-10-05
2021-10-06
2021-10-07
2021-10-11
Hello! How i can use {{ }} templates inside helmfile?
i have following block:
labels:
forwarder: "vector"
file: '{{ file }}'
stream: "{{ stream }}"
source_type: "{{ source_type }}"
k8s_pod_namespace: "{{ kubernetes.pod_namespace }}"
k8s_pod_name: "{{ kubernetes.pod_name }}"
k8s_pod_uid: "{{ kubernetes.pod_uid }}"
k8s_pod_ip: "{{ kubernetes.pod_ip }}"
k8s_pod_ips: "{{ kubernetes.pod_ips }}"
k8s_pod_node_name: "{{ kubernetes.pod_node_name }}"
k8s_app: "{{ kubernetes.pod_labels.app }}"
k8s_kubernetes_io_instance: '{{ kubernetes.pod_labels.app\.kubernetes\.io/instance}}'
k8s_kubernetes_io_component: '{{ kubernetes.pod_labels.app\.kubernetes\.io/component }}'
k8s_kubernetes_io_name: '{{ kubernetes.pod_labels.app\.kubernetes\.io/name }}'
k8s_container_name: "{{ kubernetes.container_name }}"
k8s_container_image: "{{ kubernetes.container_image }}"
i tried
file: {{` '{{ file }}' `}}
with no luck
remove the ‘’
2021-10-18
hello all, we have 2 environments. dev and prod… for dev we can simply run helmfile apply, for prod we need to select prod env with helmfile -e production apply… that caused mistakes in the past. is there a way to ask helmfile to select the right environment
What sort of mistakes? We’ve been doing this for years without major issues:) However, for dev we are also specifying the environment via -e.
we set the dev as default and that can cause issue… maybe we should not use default and have to set -e alltime ?
the best would be if the helmfile could decide based on a configmap entry … so on init time we have to set as env and later it could get it from configmap and if it is prod then set -e production if entry is dev then use default
if i tis possible
2021-10-19
Hey all, is there a guide explaining about helmfile templating, I’m specifically looking for explanation how to use valuesTemplate
in conjunction with values
directive within a release.
I use them together and I still don’t think I could give a coherent explanation of how they’re different.
@bradym I’ve been reading about them the whole day and still can’t figure them out
My issue is that I’d like to have a template that render a release based on a directory structure but still have values passed within the release
I do something like this:
templates:
default: &default
valuesTemplate:
- global.yaml.gotmpl
- envs/{{ .Environment.Name }}.yaml.gotmpl
- appName: "{{`{{ .Release.Name }}`}}"
- environment: {{ .Environment.Name }}
releases
- name: exampleApp
<<: *default
labels:
app: "{{`{{ .Release.Name }}`}}"
repo: exampleApp
values:
- values-apps/exampleApp.values.yaml.gotmpl
- repo: exampleApp
While I’m not entirely clear on the difference between valuesTemplate
and values
, I do know that when you do inheritance like that it overwrites, does not merge.
So if you use valuesTemplate
in one place and values
in the other, it works.
I’m fairly certain this is not how the two are intended to be used… but it works. So….
it works
It worked, finally! Thank you so much!!
yay!
@bradym one more question, is it possible to pass an environment variable to through the values
directive?
I’ve tried the following but giving me map has no entry for key
templates:
default: &default
valuesTemplate:
- global.yaml.gotmpl
- envs/{{ .Environment.Name }}.yaml.gotmpl
- appName: "{{`{{ .Release.Name }}`}}"
- environment: {{ .Environment.Name }}
environments:
default:
values:
- envVal:val
releases
- name: exampleApp
<<: *default
labels:
app: "{{`{{ .Release.Name }}`}}"
repo: exampleApp
values:
- values-apps/exampleApp.values.yaml.gotmpl
- repo: {{.Values.envVal}} # also
- repo2: "{{ `{{.Values.enval}}`}}"
As far as I know, you cannot do that. Maybe try in valuesTemplate
? Maybe it’ll work there? If there’s a reason why I put valuesTemplate
in the template and values
in the release, I don’t remember it..
I feel like I have to rediscover how rendering actually works every time I need to make changes.
Using the valuesTemplate
instead of values
in the release directive works!!! :party_parrot:
templates:
default: &default
values:
- global.yaml.gotmpl
- envs/{{ .Environment.Name }}.yaml.gotmpl
- appName: "{{`{{ .Release.Name }}`}}"
- environment: {{ .Environment.Name }}
environments:
default:
values:
- envVal:val
releases
- name: exampleApp
<<: *default
labels:
app: "{{`{{ .Release.Name }}`}}"
repo: exampleApp
valuesTemplate:
- values-apps/exampleApp.values.yaml.gotmpl
- repo: {{.Values.envVal}} # also
- repo2: "{{ `{{.Values.enval}}`}}"
Yay! Now I know one difference between the two.
I enabled the debug flag and my assumption of what’s happening is that in the first two passes of helmfile rendering the environment values aren’t merged yet it becomes available after the seconds pass is finished so valuesTemplate
delicate the rending to the helm chart itself at which the "{{
{{.Values.enval}} }}
is rendered to {{.Values.enval}}
and the environment variables defined in the environment
directive is also merged so it rendered correctly
@bradym haha yeah just need to write it down and put it in a safe place
Hello friends. In the past I have used helmfile and defined my 4-5 environments and each environment had a file that would drive the data for all of the release that got installed. Where our releases would just be data values that we created in a structured manner.
I’m now in need of slightly something different I have around 100 environments and I would like them to be dynamic so I don’t have to hard code them all.
environment:
env1:
values: [env/1.yaml]
... repeat 100 times
Do we have any way to do something like this dynamically or should I write something that either wraps helmfile or I use to generate this boiler plate. Also taking other advice.
From the top of my head:
{{range $i, $e := until 100}}
env{{$i}}:
values: [env/{{$i}}.yaml]
{{ end }}
Does that work?