13 messages
Questions and discussion around helmfile https://github.com/roboll/helmfile and https://github.com/cloudposse/helmfiles
Archive: https://archive.sweetops.com/helmfile/
Ivoalmost 3 years ago(edited)
What is the best way to check for a directory existence in a helmfile.yaml template? Value files can be safely ignored if they don't exist, but I have a use-case for conditionally including a chart folder. And if that folder doesn't exist, the release will fail.
Ivoalmost 3 years ago
I currently have this little snippet but it's failing for me with the following error: can't evaluate field Environment in type fs.DirEntry
{{ range $index,$item := readDirEntries "./policies" }}
{{- if eq $item.Name .Environment.Name -}}
- name: policies-{{ .Environment.Name }}
chart: ./policies/{{ .Environment.Name }}
{{- end -}}
{{- end -}}Ivoalmost 3 years ago
Seems a little stupid to iterate over all the directories but I couldn't find a 'direct' check. Is there any way to avoid the dot being evaluated as a fs.DirEntry and use the environment name instead?
Ivoalmost 3 years ago
Putting it in a variable outside the loop
{{ $env := .Environment.Name }} seems to trigger the same error.Alexander Taranalmost 3 years ago
Hi gents
Is it possible to somehow use template values un Chart.yaml?
I have a library chart and based on environment I need to specify registry for the lib chart.
Chart.yaml example that I want to achieve but this doesnβt work:
Is it possible to somehow use template values un Chart.yaml?
I have a library chart and based on environment I need to specify registry for the lib chart.
Chart.yaml example that I want to achieve but this doesnβt work:
apiVersion: v2
name: datasources
version: 0.1.0
description: Chart to deploy
dependencies:
- name: common
version: 1.2.0
repository: "{{ .StateValues.registry.helm }}"Brandon Nasonalmost 3 years ago(edited)
I've just stumbled upon helmfile and it looks like it can really solve some of my pain points with helm and my workarounds (custom shell scripts). The main thing I need is the ability to add new manifests (with env vars). It looks like this is done by using a dependency
incubator/raw which expects the manifests to be inline. so 1) Is there a way to put those manifests into their own files with requiredEnv support and 2) it appears incubator/raw is deprecated. Should I be using something different?voronalmost 3 years ago
I'm curious is there an option to specify helmfile environment (
helmfile -e ) via OS environment variable ?Nathanaelalmost 3 years ago(edited)
I'm try to use
We do nested helmfiles (terraform-module-like) but we also want to 'gotemplate the sub-helmfile itself. We used
(no i do not intend to use selectors so no labels, no selectors are used)
why is that? and is our entire concept borken with v1 ? π
HELMFILE_V1MODE=true because we want to be prepared but i think our concept does break with v1 π€We do nested helmfiles (terraform-module-like) but we also want to 'gotemplate the sub-helmfile itself. We used
helmfile.yaml for the sub-helmfile and with the HELMFILE_V1MODE=true i'm forced to change the filename to helmfile.yaml.gotmpl if i do that, the main execution of the parrent helmfile returns this error:err: no releases found that matches specified selector() and environment(stagename), in any helmfile(no i do not intend to use selectors so no labels, no selectors are used)
why is that? and is our entire concept borken with v1 ? π
Dominic Cardellinoalmost 3 years ago
I got a question and maybe it is already answered a thousand times π
I really love to use helmfile, but how do I handle the creation of Kubernetes Manifests(like ConfigMaps, Secrets etc.) outside of a Helm Chart.
Currently I use terraform to deploy kubernetes resources (kubernetes provider) and helm releases (helm provider), but it just feels kind of wrong at sometime to use terraform for this
I really love to use helmfile, but how do I handle the creation of Kubernetes Manifests(like ConfigMaps, Secrets etc.) outside of a Helm Chart.
Currently I use terraform to deploy kubernetes resources (kubernetes provider) and helm releases (helm provider), but it just feels kind of wrong at sometime to use terraform for this
Aljoscha Weberalmost 3 years ago
Hey together, hopefully a small question: how does one apply a helmfile which includes sub-helmfiles?
My current unexpected result is "no releases found that match my selector() and environment(dev)
I'm trying to setup a layered helmfile and staying as DRY as i can - my use case is for example multiple mongdb-databases and they are 90% the same with only minor diffs in the values (persistence size for example):
070-my-service-mongodb.yaml.gotmpl:
000-environments.yaml.gotmpl:
_mongodb.helmfile.yaml.gotmpl:
Output of
In the debug i can find the 2 releases and they look as i would expect it, but then they are not found for applying?
My current unexpected result is "no releases found that match my selector() and environment(dev)
I'm trying to setup a layered helmfile and staying as DRY as i can - my use case is for example multiple mongdb-databases and they are 90% the same with only minor diffs in the values (persistence size for example):
070-my-service-mongodb.yaml.gotmpl:
bases:
- 000-environments.yaml.gotmpl
- 000-repositories.yaml
---
helmfiles:
- path: _mongodb.helmfile.yaml.gotmpl
values:
- {{ toYaml .Values | nindent 4 }}
- releaseName: my-service-mongodb
releaseNamespace: {{ .Values.myMainNamespace }}000-environments.yaml.gotmpl:
environments:
default:
values:
- "../environments/dev.values.yaml"
dev:
values:
- "../environments/dev.values.yaml"
---
helmDefaults:
kubeContext: {{ .Values.kubeContext }}
verify: false
wait: true
timeout: 1800
tls: false_mongodb.helmfile.yaml.gotmpl:
---
releases:
- name: {{ .Values.releaseName }}
installed: true
namespace: {{ .Values.releaseNamespace }}
labels:
release: "{{`{{ .Release.Name }}`}}"
namespace: "{{`{{ .Release.Namespace }}`}}"
chart: bitnami/mongodb
version: {{ .Values.bitnamiMongoDbChartVersion }}
values:
- "../values/infrastructure/mongodb/mongodb.values.yaml.gotmpl"
wait: true
- name: {{ .Values.releaseName }}-backup
namespace: {{ .Values.releaseNamespace }}
labels:
release: "{{`{{ .Release.Name }}`}}"
namespace: "{{`{{ .Release.Namespace }}`}}"
type: backup
chart: myCharts/jobs
version: {{ .Values.jobsChartVersion }}
values:
- "../values/infrastructure/mongodb/mongodb-backup.values.yaml.gotmpl"
wait: trueOutput of
HELMFILE_V1MODE=true helmfile --debug -i -f ~/IdeaProjects/my-helmfile/helmfile.d/070-my-service-mongodb.yaml.gotmpl -e dev apply...
A LOT OF ENV + ENV_DEBUG
...
rendering result of "_mongodb.helmfile.yaml.gotmpl.part.0":
0: ---
1: releases:
2: - name: my-service-mongodb
3: installed: true
4: namespace: my-service-dev
5: labels:
6: release: "{{ .Release.Name }}"
7: namespace: "{{ .Release.Namespace }}"
8: chart: bitnami/mongodb
9: version: 13.9.4
10: values:
11: - "../values/infrastructure/mongodb/mongodb.values.yaml.gotmpl"
12: wait: true
13:
14: - name: my-service-mongodb-backup
15: namespace: my-service-dev
16: labels:
17: release: "{{ .Release.Name }}"
18: namespace: "{{ .Release.Namespace }}"
19: type: backup
20: chart: myCharts/jobs
21: version: 13.9.4
22: values:
23: - "../values/infrastructure/mongodb/mongodb-backup.values.yaml.gotmpl"
24: wait: true
25:
changing working directory back to "/Users/PRIVATE/IdeaProjects/my-helmfile/helmfile.d"
helm:XBjnS> v3.11.2+g912ebc1
helm:XBjnS>
Adding repo bitnami <https://charts.bitnami.com/bitnami>
exec: helm --kube-context my-aks repo add bitnami <https://charts.bitnami.com/bitnami> --force-update
helm:MRUSy> "bitnami" has been added to your repositories
helm:MRUSy>
"bitnami" has been added to your repositories
0 release(s) found in 070-my-service-mongodb.yaml.gotmpl:
changing working directory back to "/Users/PRIVATE/IdeaProjects/my-helmfile/helmfile.d"
err: no releases found that matches specified selector() and environment(dev), in any helmfileIn the debug i can find the 2 releases and they look as i would expect it, but then they are not found for applying?
Dominic Cardellinoalmost 3 years ago
Hey together,
Did anyone experience this message with helmfile?
Trying to render sth like this:
It is my prometheus alertmanager config which uses this functions
Did anyone experience this message with helmfile?
failed to render [values.yaml.gotmpl], because of template: stringTemplate:113: function "toUpper" not definedTrying to render sth like this:
templateFiles:
{{ define "slack.title" -}}
[{{ .Status | toUpper -}}
{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{- end -}}
] {{ .CommonLabels.alertname }}
{{- end }}
{{ define "slack.text" -}}It is my prometheus alertmanager config which uses this functions
Elisha Belloalmost 3 years ago(edited)
hey guys
I'm trying to achieve path base routing in an ALB created BY AWS Load Balancer Controller upon ingress object been initialise
For some reason it seems not to work
I'm trying to achieve path base routing in an ALB created BY AWS Load Balancer Controller upon ingress object been initialise
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>kind: Ingressmetadata:name: {{ .Chart.Name }}-ingress-rulesannotations:<http://alb.ingress.kubernetes.io/scheme|alb.ingress.kubernetes.io/scheme>: internet-facing<http://alb.ingress.kubernetes.io/target-type|alb.ingress.kubernetes.io/target-type>: ip<http://alb.ingress.kubernetes.io/group.name|alb.ingress.kubernetes.io/group.name>: {{ .Values.ingress.lbGroup }}<http://alb.ingress.kubernetes.io/load-balancer-name|alb.ingress.kubernetes.io/load-balancer-name>: {{ .Values.ingress.lbGroup }}<http://alb.ingress.kubernetes.io/listen-ports|alb.ingress.kubernetes.io/listen-ports>: '[{"HTTP":80},{"HTTPS":443}]'<http://alb.ingress.kubernetes.io/ssl-redirect|alb.ingress.kubernetes.io/ssl-redirect>: "443"<http://alb.ingress.kubernetes.io/security-groups|alb.ingress.kubernetes.io/security-groups>: {{ .Values.ingress.securityGroup }}<http://external-dns.alpha.kubernetes.io/hostname|external-dns.alpha.kubernetes.io/hostname>: {{ .Values.ingress.host }}<http://external-dns.alpha.kubernetes.io/alias|external-dns.alpha.kubernetes.io/alias>: "true"spec:ingressClassName: albrules:- host: {{ .Values.ingress.host }}http:paths:- path: {{ .Values.ingress.intercomPath }}pathType: Prefixbackend:service:name: {{ .Values.ingress.intercomServiceName }}port:number: {{ .Values.ingress.intercomServicePort }}- path: {{ .Values.ingress.engagePath }}pathType: Prefixbackend:service:name: {{ .Values.ingress.engageServiceName }}port:number: {{ .Values.ingress.engageServicePort }}- path: {{ .Values.ingress.usersPath }}pathType: Prefixbackend:service:name: {{ .Values.ingress.usersServiceName }}port:number: {{ .Values.ingress.usersServicePort }}- path: {{ .Values.ingress.enrichPath }}pathType: Prefixbackend:service:name: {{ .Values.ingress.enrichServiceName }}port:number: {{ .Values.ingress.enrichServicePort }}For some reason it seems not to work