#helmfile (2020-09)
Questions and discussion around helmfile https://github.com/roboll/helmfile and https://github.com/cloudposse/helmfiles
Archive: https://archive.sweetops.com/helmfile/
2020-09-01

Hello! Helmfile chart deletion (from the last chart to first) order is not correct if we have more than 6 files in sub-charts folder. For example, for 7 files we have the next deletion order - firs…

v0.126.2: Fix wrong deletion order (#1451) 5f1698d (HEAD, tag: v0.126.2, origin/master, origin/HEAD, master) Fix wrong deletion order (<a class=”issue-link js-issue-link” data-error-text=”Failed to load title” data-id=”689932583” data-permission-text=”Title is private”…

v0.127.0: Bump sprig to v3 (#1452) Resolves #1294 Resolves <a class=”issue-link js-issue-link” data-error-text=”Failed to load title” data-id=”689490982” data-permission-text=”Title is private”…
Resolves #1294 Resolves #1447
Hello, I am wondering if upgrading the Sprig library to v3 is on the roadmap? I am a bit too uninvolved to see if it would require a considerable amount of effort to upgrade or not, anyhow I am rea…

v0.127.0: Bump sprig to v3 (#1452) efd26f2 (HEAD, tag: v0.127.0, origin/master, origin/HEAD, master) Bump sprig to v3 (<a class=”issue-link js-issue-link” data-error-text=”Failed to load title” data-id=”689956556” data-permission-text=”Title is private”…
Resolves #1294 Resolves #1447

Hey @mumoshu, I found a bug caused by https://github.com/roboll/helmfile/pull/1442 related to needs:
. I have a helmfile that works perfectly fine on v0.125.8 but breaks on v0.125.9. The break is caused by the helmfile thinking a needs:
item is invalid when in reality it is completely valid.

err: "preprod_us-phoenix-1_deployment/infra-monitoring/thanos" depends on nonexistent release "infra-monitoring/prometheus-oper-iad-controlplane"
changing working directory back to "/home/jmwitkow/osvc-infra/helm/helmfile-releases"
in infra-monitoring/helmfile-infra-monitoring.yaml: "preprod_us-phoenix-1_deployment/infra-monitoring/thanos" depends on nonexistent release "infra-monitoring/prometheus-oper-iad-controlplane"

If i switch to v0.125.8 it works, v0.125.9 it does not. I am generating the needs:
block dynamically, but that probably shouldn’t matter?

the needs block looks like this:
needs:
# Generate list of releases that thanos has a dependency on
{{- range $realmRegions }}
{{- $regionMap := . }}
{{- $region := .name }}
{{- $region_key := .key }}
{{- range $k8sClusters}}
{{- $cluster := . }}
{{- if and ($regionMap | get "deploy_region" false) (eq $cluster "deployment") }}
- infra-monitoring/prometheus-oper-{{ $region_key }}-{{ $cluster }}
{{- else if ne $cluster "deployment" }}
- infra-monitoring/prometheus-oper-{{ $region_key }}-{{ $cluster }}
{{- end }}
{{- end }}
{{- end }}

I’ve created https://github.com/roboll/helmfile/issues/1453 with details

@jason800 thanks for reporting!
could you share me the output of helmfile build
for debugging, via a slack direct message if you prefer?

ah i think i’ve spotted the cause. can you prepend preprod_us-ashburn-1_controlplane/
to needs
entries?

helmfile since v0.125.9 started to treat kubecontext as a part of release id

that’s because different kubecontext can point to different release in another cluster

In our releases we build dynamic needs: parameters sometimes. An example of that looks like: needs: # Generate list of releases that thanos has a dependency on {{- range $realmRegions }} {{- $regio…

oh wow thanks

i will try that now

Hey @mumoshu unfortunately this does not appear to fix things

$ helmfile -e dev -f infra-monitoring/helmfile-infra-monitoring.yaml sync
Affected releases are:
grafana (stable/grafana) UPDATED
prometheus-oper-fra-controlplane (bitnami/prometheus-operator) UPDATED
prometheus-oper-fra-dataplane (bitnami/prometheus-operator) UPDATED
prometheus-oper-fra-deployment (bitnami/prometheus-operator) UPDATED
prometheus-oper-lhr-controlplane (bitnami/prometheus-operator) UPDATED
prometheus-oper-lhr-dataplane (bitnami/prometheus-operator) UPDATED
thanos (bitnami/thanos) UPDATED
panic: invalid state: no nodes have remaining edges: nodes=[dev_eu-frankfurt-1_deployment/infra-monitoring/thanos]

ok, this was related to me changing release names without destroying them first, but I actually am hitting what I believe to be another bug related to dynamic releases and static release names @mumoshu
STDERR:
Error: failed to untar: a file or directory with the name /tmp/341109564/infra-monitoring/prometheus-operator/bitnami/prometheus-operator/0.31.0/prometheus-operator already exists

it looks like the multiple releases which are unique are using the same temporary directory due to the changes I made for release names to be non-dynamic

and therefore they run into conflicts with files already existing as it loops over the many releases with the same namespace/name

@voron you may have some of your typical wisdom here as well?

Looks like this was reported in https://github.com/roboll/helmfile/issues/1384
helmfile lint fails when same release name is used (in multiple namespaces) STDERR: Error: failed to untar: a file or directory with the name /tmp/299510502/keycloak/8.1.0/codecentric/keycloak/keyc…

I’m wondering if the kubeContext uniqueness change broke it again

you may have some of your typical wisdom here as well?
I’m afraid no, we don’t use dynamic releases widely.

I actually believe I have a code fix for it

just trying to figure out how to build helmfile

https://github.com/roboll/helmfile/blob/master/Makefile, make build
?
Deploy Kubernetes Helm Charts. Contribute to roboll/helmfile development by creating an account on GitHub.


don’t forget to pass tests locally before submitting a PR

I’m afraid this may be beyond my experience at this point. I’m getting an error building on my diff but I have no idea why?

diff --git a/pkg/state/state.go b/pkg/state/state.go
index 4eddbd0..9c9422d 100644
--- a/pkg/state/state.go
+++ b/pkg/state/state.go
@@ -972,6 +972,10 @@ func (st *HelmState) PrepareCharts(helm helmexec.Interface, dir string, concurre
pathElems = append(pathElems, release.Namespace)
}
+ if release.KubeContext != "" {
+ pathElems = append(pathElems, release.KubeContext)
+ }
+
chartVersion := "latest"
if release.Version != "" {
chartVersion = release.Version
git ls-files --exclude-standard --modified --deleted --others -x vendor | grep -v '^go.' | diff /dev/null -
0a1
> pkg/state/state.go
make: *** [pristine] Error 1

almost looks like its upset just because there is a diff

make clean
goes fine. make pristine
fails, make test
succeeds.
PASS
coverage: 65.7% of statements
ok github.com/roboll/helmfile/pkg/tmpl 0.258s coverage: 65.7% of statements
? github.com/roboll/helmfile/test [no test files]
(osvc-infra) [jmwitkow@9464ba3995f6 helmfile]$ echo $?
0

so I’m guessing maybe i shouldn’t be running make pristine
?

i built a binary and confirmed it fixed my issue as well

Fix bug where KubeContext is not taken into account in temporary directories. Fixes #1470

I’m trying to use environments
and bases
at the same while using variables in helmfile.yaml
, I’m not sure if this is a bug or I’m doing something wrong, https://github.com/roboll/helmfile/issues/1454
I'm trying to use environments and layers at the same time while using a variable in my helmfile.yaml: bases: - environments.yaml repositories: - name: stable url: https://kubernetes-charts.sto…

@K H Thanks for reporting! Just replied in the issue.
I'm trying to use environments and layers at the same time while using a variable in my helmfile.yaml: bases: - environments.yaml repositories: - name: stable url: https://kubernetes-charts.sto…
2020-09-02

I have an app that I want to deploy to stage only when the branch being deployed matches the branch name specified in an aws ssm parameter. I’m attempting to use installed template
on my release, but I haven’t been able to figure out the correct syntax or even if this is possible.
A simple version that doesn’t include ssm (that I’ve confirmed works) would be:
installedTemplate: {{- if eq .Values.branch "master" }} true {{ else }} false {{ end }}
What I’ve tried for the ssm version:
installedTemplate: {{- if eq .Values.branch `{{ <ref+awsssm://DOWNLOAD_WORKER_BRANCH?region=us-west-1> }}` }} true {{ else }} false {{ end }}
Does anyone know if it’s possible to do this? Any pointers in the right direction?

When I run helmfile build
on it with the ssm version there are no errors, but it always returns false
. I assume this is because it’s not rendering the ssm value and just using it as a string.

Just discovered fetchSecretValue
, now to figure out how to correctly use it

And this is what works:
environments:
stage:
values:
- downloadWorkerBranch: <secretref+awsssm://stage/DOWNLOAD_WORKER_BRANCH>
prod:
values:
- downloadWorkerBranch: <secretref+awsssm://prod/DOWNLOAD_WORKER_BRANCH>
Then in the release:
installedTemplate: {{- if eq (.Values.branch | quote) (.Values.downloadWorkerBranch | fetchSecretValue | quote) }} true {{ else }} false {{ end }}
If anyone sees that I’m doing something dumb, I’d love your feedback!
2020-09-03

v0.128.0: Bump sprig to v3.1.0 and mergo 3.11 (#1456) 9d2c0d4 (HEAD, tag: v0.128.0, origin/master, origin/HEAD, master) Bump sprig to v3.1.0 and mergo 3.11 (<a class=”issue-link js-issue-link” data-error-text=”Failed to load title” data-id=”691909066” data-permission-text=”Title is private”…
9d2c0d4 (HEAD, tag: v0.128.0, origin/master, origin/HEAD, master) Bump sprig to v3.1.0 and mergo 3.11 (#1456) Build Info
- Bump sprig to v3.1.0 test for mergeOverwrite * Let mergo not (accidentally) try to merge unexported fields This is also a good chance separate
HelmState
with the config loaded from YAML,…
2020-09-04

anyone know if helmfile supports overriding a chart’s appVersion somehow? (along the lines of what is discussed in this helm issue: https://github.com/helm/helm/issues/8194)
A significant number of comments and requests from #3555 were to have the ability to set .Chart.AppVersion at install and upgrade time without having to download and repackage the chart. Those comm…

@Carlos R. would probably want this
A significant number of comments and requests from #3555 were to have the ability to set .Chart.AppVersion at install and upgrade time without having to download and repackage the chart. Those comm…

This would be nice as we frequently use our monochart
to deploy a wide range of applications and would like to set the .Chart.AppVersion
as well

yeah - like many in that thread, I end up with many deployments out there that show an appVersion that isn’t actually what is deployed

+1

@Carlos R. has joined the channel

What is currently the best practice for installing CRDs before deploying something that needs them? For example, the instructions for using the Helm Operator are to:
- Install the
HelmRelease
CRD usingkubectl apply
- Deploy the operator using Helm
If I want both to happen with one
helmfile apply
, what’s the best way right now to do that? I’m thinking of the incubator/raw helm chart, but that sounds kinda kludgey

@Erik Osterman (Cloud Posse) I’m pretty sure its been talked about in OO at some point but I don’t remember what was said

Hah, this topic comes up for us in our engagements all the time. We haven’t found the holy grail yet, but can share the best practices we follow. I am on my phone right now. Will set a reminder


We’ve already tried different things: helmfile hooks, incubator/raw, home-made charts. Cannot say we are pleased with something specific. Also, we try to use needs: as much as we can to make a dependency tree. When we install third-parties with crds folder we use disableValidation flag that tells helm-diff not to fail if something cannot find a certain object type.

Found the helmfile for cert-manager that uses presync hooks. Looks promising.
https://github.com/cloudposse/helmfiles/blob/master/releases/cert-manager.yaml
Comprehensive Distribution of Helmfiles for Kubernetes - cloudposse/helmfiles

HI, When reading the process to install the cert-manager chart (https://hub.helm.sh/charts/jetstack/cert-manager), you can see two steps before installing the chart: installing some CRD prior to th…

@Jeremy G (Cloud Posse) if he has time can maybe share something quick.

You can do everything with helmfile
hooks, although I find that unwieldy for all but the simplest commands, so for more complicated stuff, like installing, upgrading, and removing cert-manager CRDs, I prefer to use the hook to run a custom script (which mainly runs kubectl
commands, because until last week, jetstack was warning that helm
still had issues with CRDs, apparently just resolved in the past few days with the release of helm
3.3.1).
For cert-manager specifically, I have a presync
hook that calls the script to install or upgrade the CRDs, a postuninstall
script (actually the same script with different arguments) to remove the CRDs, and a postsync
hook that does nothing but sleep
so that cert-manager has time to set up its CA and webhooks before the next release runs.
The next release, BTW, is in the same helmfile.yaml
and “needs” the first one, installs ClusterIssuers. It also has to have
disableValidation: true
because otherwise helmfile apply
will fail to install the releases because the CRDs are not yet installed and so the ClusterIssuers are not valid resources yet.
Source code for the cert-manager.io website, including project documentation - cert-manager/website

I’m about halfway through @mumoshu’s way to do it with the helmfiles:
section. I’ll report back on how that goes and also try the hooks way if I run into any issues.
So far so good though.

- name: cert-manager
chart: jetstack/cert-manager
namespace: cert-manager
version: v0.13.1
verify: false
values:
- ../charts/cert-manager/values.yaml
hooks:
- events: ["prepare"]
showlogs: true
command: "/bin/sh"
args: ["-c", "kubectl apply --validate=false -f <https://raw.githubusercontent.com/jetstack/cert-manager/release-0.13/deploy/manifests/00-crds.yaml>"]
- name: prometheus-operator
chart: stable/prometheus-operator
namespace: monitoring
version: 9.3.1
verify: false
values:
- ../charts/prometheus-operator/values.yaml
- ../charts/prometheus-operator/values-{{ requiredEnv "CI_ENVIRONMENT_SLUG" }}.yaml
hooks:
- events: ["prepare"]
showlogs: true
command: "/bin/sh"
args:
- "-c"
- "kubectl apply -f <https://raw.githubusercontent.com/coreos/prometheus-operator/release-0.38/example/prometheus-operator-crd/monitoring.coreos.com_alertmanagers.yaml>"
- events: ["prepare"]
showlogs: true
command: "/bin/sh"
args:
- "-c"
- "kubectl apply -f <https://raw.githubusercontent.com/coreos/prometheus-operator/release-0.38/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml>"
- events: ["prepare"]
showlogs: true
command: "/bin/sh"
args:
- "-c"
- "kubectl apply -f <https://raw.githubusercontent.com/coreos/prometheus-operator/release-0.38/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml>"
- events: ["prepare"]
showlogs: true
command: "/bin/sh"
args:
- "-c"
- "kubectl apply -f <https://raw.githubusercontent.com/coreos/prometheus-operator/release-0.38/example/prometheus-operator-crd/monitoring.coreos.com_prometheusrules.yaml>"
- events: ["prepare"]
showlogs: true
command: "/bin/sh"
args:
- "-c"
- "kubectl apply -f <https://raw.githubusercontent.com/coreos/prometheus-operator/release-0.38/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml>"
- events: ["prepare"]
showlogs: true
command: "/bin/sh"
args:
- "-c"
- "kubectl apply -f <https://raw.githubusercontent.com/coreos/prometheus-operator/release-0.38/example/prometheus-operator-crd/monitoring.coreos.com_thanosrulers.yaml>"

this is what I am doing so far

Prepare hooks will be executed even for helmfile template
. Is this intended?

As for ClusterIssuer we move it from hooks to a separate Helm release as we had issues when it was not applied. Say, if you fix just a ClusterIssuer manifest helmfile diff
won’t see a diff of a cert-manager release and a presync/postsync hook won’t be executed.
2020-09-06

I would like to use this functionality powered by vals: https://github.com/roboll/helmfile/pull/906
As far as I understood it will be rendered only under a release:
block. WIn our case we have a common helmfile, and then we reuse this helmfile by referencing form other helmfiles via helmfiles:
(sorry for such a cluncky explanation). In the repo with a common helmfile there is no credentials to connect to third-parties to grab the actual value. So, helmfile lint
failed.
Does anybody know if any possibility to overwrite this or hide the error exists?
Fields which are rendered: Release.Values, Release.SetValues.Value, Release.SetValues.Values Example: values: - foo: <ref+vault://mykv/foo?address=http://127.0.0.1:8200#/mykey> set: - name: xyz val…

Ok, I think simply wrapping the ref+
link into an if not
conditional in a common helmfile might work
Fields which are rendered: Release.Values, Release.SetValues.Value, Release.SetValues.Values Example: values: - foo: <ref+vault://mykv/foo?address=http://127.0.0.1:8200#/mykey> set: - name: xyz val…

Yes it works

I think you’ve already got it! If I can add anything, it works by replacing ref+
urls in yaml hash in values.yaml files, after the go template is rendered to produce the yaml document in the first place.

you can also use fetchSecretValue
and expandSecretRefs
for more advanced use-cases

Deploy Kubernetes Helm Charts. Contribute to roboll/helmfile development by creating an account on GitHub.
2020-09-07

I am thinking loud, but..
Would be nice to have k8s service similar to https://github.com/jetstack/version-checker, of course there it possible to use https://github.com/roboll/helmfile#integrations renovate for gitops version check, but some active checking on actually deployed charts would be a great idea ( with metrics support of course )…
Related: https://github.com/FairwindsOps/nova/
@mumoshu ping
Thanks
EDIT: I have hard time to keep charts updated, or at least have some overview about newer versions available…

Hey! Yeah this makes sense a lot. It should probably be implemented as a K8s controller that runs some code similar to https://github.com/bacongobbler/helm-whatup
A Helm plugin to help users determine if there’s an update available for their installed charts. - bacongobbler/helm-whatup

Just want to mention that we are very satisfied with Renovate. But I understand your pain;)

@Andrew Nazarov Are You using regex matching, or direct helmfile support ?

We are using regexps
2020-09-08

Did something change recently on how {{ .Namespace }} works?
i just installed v0.128 and i get the following:
helmfile --file helmfile-preip.yaml --selector default=true --selector app=besu --namespace cyan-besu-15 apply
in ./helmfile-preip.yaml: in .helmfiles[0]: in helmfiles/1-before-all.yaml: failed processing release ingress: failed to render values files "values/nginx-ingress-values.yaml.gotmpl": failed to render [values/nginx-ingress-values.yaml.gotmpl], because of template: stringTemplate:6:19: executing "stringTemplate" at <.Namespace>: can't evaluate field Namespace in type state.releaseTemplateData
and the values file contains
controller:
publishService:
enabled: true
scope:
enabled: true
namespace: {{ .Namespace }}
extraArgs:
default-ssl-certificate: "{{ .Namespace }}/wildcard"
service:
enabled: true
replicaCount: 2
minAvailable: 1
resources:
limits: {}
#cpu: 500m
#memory: 512Mi
requests:
cpu: 50m
memory: 128Mi
nameOverride: {{ .Namespace }}-ingress

Seems like a regression introduced recently. I’ll fix it today. Thanks for reporting!

This is the commit that broke it
https://github.com/roboll/helmfile/commit/7b11ce851a2483f3176079210ce3274271d0237a
This adds the ability to utilize .Release
inside of gotmpl files as discussed here. Resolves: https://github.com/roboll/helmfile/issues/760 …

And this is what you’re relying on: https://github.com/roboll/helmfile/commit/7b11ce851a2483f3176079210ce3274271d0237a#diff-114928b5b56bd96452914832f2804038R16-R17
According to the code comment, it’s not intended to be accessible from with values.yaml templates… But we might better fix(repurpose) it if everyone is already using it
This adds the ability to utilize .Release
inside of gotmpl files as discussed here. Resolves: https://github.com/roboll/helmfile/issues/760 …

It was accidentally removed in #1424, and had been unexpectedly unavailable between v0.126.0 and v0.128.1.


thx! I modified everything already to make it work so i cannot really test it

using {{ .Release.Namespace }} works. If i have to guess, https://github.com/roboll/helmfile/pull/1424 is the culprit
This adds the ability to utilize .Release inside of gotmpl files as discussed here. Resolves: #760 Added a simple test that passed once implemented and all tests are running green.
2020-09-09

v0.128.1: Fix index out of range [1] with length 1
error on env2map (#1463)
0482ba3 (HEAD, tag: v0.128.1, origin/master, origin/HEAD, master) Fix index out of range [1] with length 1 error on env2map (<a class=”issue-link js-issue-link” data-error-text=”Failed to load title” data-id=”695488078”…
0482ba3 (HEAD, tag: v0.128.1, origin/master, origin/HEAD, master) Fix index out of range [1] with length 1 error on env2map (#1463) Build Info
This happened only when helmfile is run in an environment that any environment variable definition does not include =
and the right side.

Anyone here got an answer to the following… https://stackoverflow.com/questions/63811855/using-nested-values-defined-in-environment
I have the following helmfile releases: - name: whoami-mn namespace: whoami-mn-{{ .Environment.Name }} chart: tons/whoami-mn version: {{ .Values.chartVersions.whoami }} installed:…

In the readme there’s an example environments.production.values[].vault.enabled: false so I’m surprised my yaml doesn’t work

has anyone figured out a way in helmfile to deploy jobs without hitting the immutable field issue?

Error: UPGRADE FAILED: cannot patch "vault-config-setup" with kind Job: Job.batch "vault-config-setup" is invalid: spec.template:
...
: field is immutable

force: true/false
does not get around it

I ran into similar issues. I believe the fix was updating to a newer version of helm 3.

oh , i think i am still on 3.2.4

let me check

Hmm, 3.2.4 is what I’m using. What version of helmfile are you on?

3.2.4

that’s helm, what about helmfile?

0.125.8

hmm, that’s pretty recent. Doesn’t seem like a version issue then.

No, i mean this is a very well known and long-discussed issue in helm

I just thought maybe someone had worked around it in helmfile

Yeah, I know the issue. I thought the way I got around it was by upgrading helm. But clearly that’s not the case since we’re using the same version of helm.

https://github.com/helm/helm/pull/7431 and related. I cannot understand why can’t we get the same selective replace as we have in helm2.
An additional optional flag –recreate can be passed on upgrade (or rollback) of a release. In combination with the –force flag the following strategies are employed when updating a resource (whic…

worked around it in helmfile
it’s helm-level issue, I don’t thinks it’s possible to provide stable solution at helmfile level.
2020-09-10

v0.128.2: Re-add Release.Namespace in release values.yaml templates (#1466) It was accidentally removed in #1424, and had been unexpectedly unavailable between v0.126.0 and v0.128.1. Fixes <a class=”issue-link js-issue-link”…
It was accidentally removed in #1424, and had been unexpectedly unavailable between v0.126.0 and v0.128.1. Fixes #1464
This adds the ability to utilize .Release inside of gotmpl files as discussed here. Resolves: #760 Added a simple test that passed once implemented and all tests are running green.

v0.128.2: Re-add Release.Namespace in release values.yaml templates (#1466) 832dcf4 (HEAD, tag: v0.128.2, origin/master, origin/HEAD, master) Re-add Release.Namespace in release values.yaml templates (<a class=”issue-link js-issue-link” data-error-text=”Failed to load title” data-id=”697291695”…
It was accidentally removed in #1424, and had been unexpectedly unavailable between v0.126.0 and v0.128.1. Fixes #1464
2020-09-11

Hi there :wave:
Is it possible to use remote values from S3 using the go-getter
syntax?

I’m getting the following error:
# helmfile.yaml
environments:
default:
values:
- s3::<https://s3.amazonaws.com/my-s3-bucket/v1/values.yaml>
$ helmfile template
in ./helmfile.yaml: failed to read helmfile.yaml: environment values file matching "s3::<https://s3.amazonaws.com/my-s3-bucket/v1/values.yaml>" does not exist in "."

Btw, this works with their CLI:
$ go-getter s3::<https://s3.amazonaws.com/my-s3-bucket/v1/values.yaml> /tmp/test/
2020/09/11 08:05:51 success!

What version of helmfile are you using? Looks like it should be supported: https://github.com/roboll/helmfile#loading-remote-environment-values-files
Deploy Kubernetes Helm Charts. Contribute to roboll/helmfile development by creating an account on GitHub.

The latest one I think
helmfile version v0.128.2


I have never had chance to try it with s3. This might be a bug or not. I thought it wasn’t trivial to make go-getter as a go library behave the same as the go-getter cli

it may work depending on url format(i don’t have specific idea yet, though..

It did reproduce this locally. Let me see what I can do..

Ah gotcha. @Gabriel Tiossi Could you try s3::<https://s3.amazonaws.com/my-s3-bucket/[email protected]>
? Please notice the part before @
is the path to the directory and after is the file name(object key, in s3 term)

I admit this isn’t intuitive, but we had to introduce this dialect of go-getter url to stabilize go-getter’s behaviour for helmfile’s use-case

Thank you @mumoshu and @Jonathan :grin: I found it intuitive and worked like a charm :+1:
I would like to point that this behavior only works with environments._environmentName_.values
, and not with releases[n].values
. Don’t know if this is expected or not.
When I use the exact same sucessful string in a releases[n].values
, this is the output:
in ./helmfile.yaml: values file matching "s3::<https://s3.amazonaws.com/my-s3-bucket/[email protected]>" does not exist in "."
To work around it, I’m doing something like this:
environments:
default:
values:
- s3::<https://s3.amazonaws.com/my-s3-bucket/[email protected]>
repositories:
- name: my-repo
url: <https://my-repo.com>
releases:
- name: my-release
chart: my-repo/my-chart
values:
- {{ .Environment.Values | toYaml | indent 8 | trim }}
I don’t know if there is a more elegant way to solve it, but it works now

haha don’t thank me, @mumoshu did all the work, I’m just the one who summoned him Glad you solved it!

@Gabriel Tiossi Thanks for confirming! Glad to hear it mostly worked.
environments.environmentName.values , and not with releases[n].values
I haven’t tried using it under releases.values so this might be a bug(or just not-implemented-yet)
Let me see what I can do

v0.129.0: Add experimental write-values command for writing values files only (… 0fad9f0 (HEAD, tag: v0.129.0, origin/master, origin/HEAD, master) Add experimental write-values command for writing values files only (<a class=”issue-link js-issue-link” data-error-text=”Failed to load title” data-id=”699300090”…
0fad9f0 (HEAD, tag: v0.129.0, origin/master, origin/HEAD, master) Add experimental write-values command for writing values files only (#1469) Build Info
2020-09-12

v0.129.1: Add tailormed to users (#1467) Update USERS.md
2020-09-13

I’ve got a configmap template that contains othernodes = {{ .Values.orion.otherNodes }}
where othernodes is an array of strings. but in this specific config i need each of the strings to be wrapped in quotes but it comes out as [ string, string ]
without quotes. Is there a quick way to quote each item in the list?

Never mind, othernodes = {{ .Values.orion.otherNodes | toJson }}
returns what i need!

v0.129.1: Add tailormed to users (#1467) 134d5be (HEAD, tag: v0.129.1, origin/master, origin/HEAD, master) Add tailormed to users (<a class=”issue-link js-issue-link” data-error-text=”Failed to load title” data-id=”698282052” data-permission-text=”Title is private”…
- Update USERS.md
2020-09-14

Ref variantdev/vals#34
I've downloaded the latest release for both tfstate-lookup and val but running val causes a runtime error when running against state stored in an s3 bucket tfstate-lookup -s .terraform/terrafor…

v0.129.2: Bump vals (#1475) 5dd65e8 (HEAD, tag: v0.129.2, origin/master, origin/HEAD, master) Bump vals (<a class=”issue-link js-issue-link” data-error-text=”Failed to load title” data-id=”700691836” data-permission-text=”Title is private”…

Is anyone relying on the undefined behaviour of Helmfile that a multiple negated conditions in a single selector like helmfile -l foo!=foo,bar!=bar
is unexpectedly treated as an OR sometimes?
I’m redefining it to be always AND, so that the behavior is consistent:
https://github.com/roboll/helmfile/pull/1478
This might be just a bug but I wanted inform you all for clarity because this seems like a long-standing bug anyway. Thanks!
Helmfile had been historically combining multiple -l foo=bar selectors and its equivalent in helmfile.yaml, helmfiles[].selectors[], by OR. I believe this isn't consistent with kubectl get -l f…

v0.129.3: Treat selector with multiple conditions an AND (#1478) 028bcc5 (HEAD, tag: v0.129.3, origin/master, origin/HEAD, master) Treat selector with multiple conditions an AND (<a class=”issue-link js-issue-link” data-error-text=”Failed to load title” data-id=”701512861” data-permission-text=”Title…
028bcc5 (HEAD, tag: v0.129.3, origin/master, origin/HEAD, master) Treat selector with multiple conditions an AND (#1478) Build Info
2020-09-15

New to helmfile, I was thinking to use this for testing helm charts after deployment in K8S env.

What I am fuzzy about it how to inject values into values.yaml per release. I wanted to avoid creating massive directory structure for different types of tests with env.sh
, but rather just define values in the releases.
charts:
dgraph:
name: dgraph
enabled: true
namespace: dg-1
chart: ./charts/charts/dgraph
env:
- path/to/env.sh
values:
- charts/dgraph/helmfile/base.yaml.gotmpl

or maybe:
env:
DGRAPH_ALPHA_ACL_ENABLED: false
DGRAPH_ALPHA_ACL_FILE_CONTENT: secret
DGRAPH_ALPHA_ACL_SECRET_FILE: /dgraph/acl/secret_file

Is there a way to do something like this?

I cannot get off the ground with helmfile. Running into this, not sure what to do:
in ./helmfile.yaml: error during helmfile.yaml.part.1 parsing: template: stringTemplate:2:17: executing "stringTemplate" at <.Values.charts>: map has no entry for key "charts"
I setup simple charts.yaml:
charts:
azuregateway:
name: minio
enabled: true
namespace: minio
repository:
name: minio
url: <https://helm.min.io/>
chart: minio/minio
values:
- envs/aks/tf.minio_config.yaml
and helmfile.yaml with:
helmDefaults:
timeout: 600
recreatePods: false
tillerless: true
force: true
environments:
default:
values:
- ./charts.yaml
- ./values.yaml
{{- if env "ENV_DIR" }}
- {{ requiredEnv "ENV_DIR" }}/charts.yaml.gotmpl
- {{ requiredEnv "ENV_DIR" }}/values.yaml.gotmpl
{{- end }}
repositories:
{{- range .Values.charts }}
{{- if and .enabled (hasKey . "repository") }}
- name: {{ .repository.name }}
url: {{ .repository.url }}
{{- end }}
{{- end }}
releases:
{{- range .Values.charts }}
{{- if .enabled }}
- name: {{ .name }}
namespace: {{ .namespace }}
chart: {{ .chart }}
version: "{{ . | getOrNil "version" }}"
values:
{{- range .values }}
- {{ . }}
{{- end }}
secrets:
{{- range . | getOrNil "secrets" }}
- {{ . }}
{{- end }}
{{- end }}
{{- end }}

How do your values files look like?

I got it working eventually. There were some issues with starter kit that I was trying to use.

The values.yaml
is
_: {}

Glad you got it working! The reason I was asking is that it seemed you were missing .Values.charts
in your values file, but you seem to have solved it nonetheless!

I’m stuck at trying to render set, having the toughest time.

I tried adding this snippet in the helmfile:
releases:
{{- range .Values.charts }}
{{- if .enabled }}
{{- if hasKey . "set" }}
set:
{{- range . | getOrNil "set" }}
- {{ . }}
{{- end }}
{{- end }}
...
{{- end }}
But when I try to use this:
charts:
azuredgraph:
...
values:
- ./charts/dgraph/helmfile/base.yaml.gotmpl
- ./envs/aks/tf.dgraph_config.yaml
set:
- backups.destination: <minio://minio.minio.svc:9000/dgraph-backups>
- image.tag: v20.03.4
- backups.incremental.enabled: true
- backups.full.enabled: true

But I cannot get set to work in this context.

It tells me:
second-pass rendering result of "helmfile.yaml.part.0":
0:
1: helmDefaults:
2: timeout: 600
3: recreatePods: false
4: tillerless: true
5: force: false
6:
7: environments:
8: default:
9: values:
10: - ./charts.yaml.gotmpl
11: - ./values.yaml
12: - ./envs/aks/charts.yaml.gotmpl
13: - ./envs/aks/values.yaml.gotmpl
14:
15: repositories:
16: - name: minio
17: url: <https://helm.min.io/>
18:
19: releases:
20: - name: dgraph
21: namespace: default
22: chart: /home/joaquin/workarea/charts/charts/dgraph
23: version: "0.0.11"
24: values:
25: - ./charts/dgraph/helmfile/base.yaml.gotmpl
26: - ./envs/aks/tf.dgraph_config.yaml
27: set:
28: - map[backups.destination:<minio://minio.minio.svc:9000/dgraph-backups>]
29: - map[image.tag:v20.03.4]
30: - map[backups.incremental.enabled:true]
31: - map[backups.full.enabled:true]
32: - name: minio
33: namespace: minio
34: chart: minio/minio
35: version: "6.1.2"
36: values:
37: - ./envs/aks/tf.minio_config.yaml
38:
err: failed to read helmfile.yaml: reading document at index 1: yaml: unmarshal errors:
line 29: cannot unmarshal !!str `map[bac...` into state.SetValue
line 30: cannot unmarshal !!str `map[ima...` into state.SetValue
line 31: cannot unmarshal !!str `map[bac...` into state.SetValue
line 32: cannot unmarshal !!str `map[bac...` into state.SetValue
in ./helmfile.yaml: failed to read helmfile.yaml: reading document at index 1: yaml: unmarshal errors:
line 29: cannot unmarshal !!str `map[bac...` into state.SetValue
line 30: cannot unmarshal !!str `map[ima...` into state.SetValue
line 31: cannot unmarshal !!str `map[bac...` into state.SetValue
line 32: cannot unmarshal !!str `map[bac...` into state.SetValue

Statically if fails too

I am not sure how to use both set or values (docs: https://github.com/roboll/helmfile#configuration)
Deploy Kubernetes Helm Charts. Contribute to roboll/helmfile development by creating an account on GitHub.

I dont thing helmfile likes having
map[...]
as values,
you should be able to set them like this:
set:
# single value loaded from a local file, translates to --set-file foo.config=path/to/file
- name: foo.config
file: path/to/file
# set a single array value in an array, translates to --set bar[0]={1,2}
- name: bar[0]
values:
- 1
- 2

I spotted a little bit after. I did the name/values. Now it is injecting the values.

I’m using helmfile to run a battery of values easily, as the app I am supporting has 40+ combinations…

too challenging to keep track of combinations

I seem to be failing. I changed the values to these
- name: backups.destination
value: <minio://minio.minio.svc:9000/dgraph-backups>
- name: image.tag
value: v20.03.4
But I am not having them picked up.

So I went with pure values… that seems to work. I wonder if you have values, then set won’t work

Thanks for your help.
2020-09-16

hitting an issue where helmfile apply, appears to run without error

Experienced something similar a week or so ago. I had to change some values and run again to actually apply a thing. But I thought in my case it was not related to helmfile. And it was really difficult to reproduce

but my release is not actually installed.

hey all, is there a way to default to an empty map/list ? {{ .Values | get "my-value" {} }}
something like this?

something like this?
version: {{ .Environment.Values | default (env "COMPONENT_VERSION") | default "" }}

well helmfile uses the get
syntax, so I’m really just looking for a way to express “empty map” or “empty list”

but yes, something along the lines as what you have

doing
{{ .Values | get "domain" "[dev.example.com](http://dev.example.com)" }}
will try to get from .Values.domain
, but default to getting from “dev.example.com” if that value does not exists. if you want to assign a default value to the get request, I think this is how you want to do it:
{{ .Values | get "my-domain" "default-domain" | default "{}" }}

man I am banging my head against the wall. I have a helmfile template test that I run locally and it works perfectly and then my gitlab-ci runs it (in the same container) and it fails

in kafka/helmfile-kafka.yaml: "kafka/appmm" depends on nonexistent release "preprod_us-ashburn-1_dataplane/kafka/appkafka"

It makes no sense that the needs:
would fail on the exact same code in the CI test

Can Helmfile work with manifests? I am seeing more and more use operators directly rather than Helm charts.

Yes. Check out the incubator/raw chart

Or maybe I should look at Kustomize. Any good articles on helmfile driving kustomize?

I would like to use some Kustomize in non-helmchart releases

I’ve not used kustomize myself, but there’s this: https://github.com/roboll/helmfile/blob/master/docs/advanced-features.md#deploy-kustomizations-with-helmfile
Deploy Kubernetes Helm Charts. Contribute to roboll/helmfile development by creating an account on GitHub.

I’m using helmify-kustomize
, works great.
Deploy Kubernetes Helm Charts. Contribute to roboll/helmfile development by creating an account on GitHub.


It’s been one year since we moved GitLab.com to Kubernetes. We unpack the challenges and learnings from this major migration.

How do you do dependencies between to releaeses?

I have a CRD that depends on the operator to be installed, so I am looking for easy way to have that CRD depend on the helm chart to install the operator

This look like this was added with needs
:
https://github.com/roboll/helmfile/pull/914
Introduces DAG-aware installation/deletion ordering to Helmfile. needs controls the order of the installation/deletion of the release: relesaes: - name: somerelease needs: - [TILLER_NAMESPACE/]…

Maybe you would find this useful:
https://sweetops.slack.com/archives/CE5NGCB9Q/p1599247141077800
What is currently the best practice for installing CRDs before deploying something that needs them? For example, the instructions for using the Helm Operator are to:
- Install the
HelmRelease
CRD usingkubectl apply
- Deploy the operator using Helm
If I want both to happen with one
helmfile apply
, what’s the best way right now to do that? I’m thinking of the incubator/raw helm chart, but that sounds kinda kludgey

The needs
worked perfectly for me

I also had to use a manifest to use the operator, and then a helm chart after the manifest

So for this I used kustomized with a hook to create a helm chart on the fly, then use that.
Combined with needs
I can mix operators, helm charts, kustomize
, all together and use ordering.
2020-09-17

@mumoshu Hopefully a quick question for you: is there any control/configuration over Helmfile’s exec
behavior around errors/non-zero exit codes? Specifically I’d like to do something like:
{{ (contains "error: the server doesn't have a resource type" (exec "kubectl" (list "-n" (env "KUBE_NAMESPACE") "get" "<resource>")))) }}
Seems like there is no way to proceed with exec
if it errors/exits with non-zero?

@Cameron Boulton Hey! Good question - Yes, unfortunately there’s no way for now


Okay, thank ya. I’ll consider adding a feature request issue to GitHub.

Thanks! Looking forward to it

{{exec}} is a great feature of Helmfile and adds a lot of power by enabling the use of any external command/script. However, the current behavior only: Returns stdout but only on success On error (…
2020-09-18

I just installed helmfile with brew (helmfile version v0.129.3
). I’m trying to use repositories I always use, but helmfile gives me this: Error: repository name (jaegertracing) already exists, please specify a different name
repositories:
- name: jaegertracing
url: <https://jaegertracing.github.io/helm-charts>
- name: dgraph
url: <https://charts.dgraph.io>

I guess this is underlying problem with helm. I never had it not be idempotent.

helm
has broken idempotence in versions 3.3.2
and 3.3.3
.
Thus you cannot use helmfile
with those versions.

Oh, I see https://github.com/helm/helm/issues/8771 and the PR https://github.com/helm/helm/pull/8772
Description The command helm repo add <name> <url> fails as it is no longer idempotent. This worked fine in version v3.3.1 and earlier. It now fails in v3.3.2 and v3.3.3. This is a brea…
Signed-off-by: yxxhero [email protected] What this PR does / why we need it: resolve: #8771 We could just return exit code zero if the same repo is attempted to be added twice with the same name. …

The issue is annoying. Before in 2010s, there was a big push to write automation (especially with change configuration) to make idempotent automation. If the state is already in the desired state, do not raise an error.
But now these days, with kubectl and helm, others, it’s like
*idempotent, shemdepotent*

well, I think it’s a good idea to pin versions in automation. on interactive usage it’s possible to use pre-existing helm repos and don’t add it in helmfile

I’m trying to have documentation for customers that may not be at dev/ops level to manipulate helmfile. helmfile
is useful to orchestrate several components that need to work together with no-fuss, no-muss.

I added a note to the PR requesting that --force-update
only be added when Helm versions 3.3.2 and 3.3.3 are used. I believe the security issues that Helm addressed with this change are valid, and a PR is being worked that would return the idempotent nature as long as the name and URL are both the same as they were before
https://github.com/roboll/helmfile/pull/1488#discussion_r492055821
Bump Helm version to the latest as it contains several security fixes. Ref: https://github.com/helm/helm/releases/tag/v3.3.2 https://github.com/helm/helm/releases/tag/v2.16.11

Though, I just thought about what would happen if I am using the helm-git plugin (which I do frequently). Changing the ref to another tag or git SHA would be considered a change to the URL, causing the error to be thrown

WDYT about --force-update
directive from helmfile side ?

meaning you’d run helmfile apply --force-update
?

Not sure, could also do
repositories:
- name: polaris
url: git+<https://github.com/reactiveops/polaris@deploy/helm?ref=tags/1.2.3>
forceUpdate: true

tagging some others for more visibility - @Erik Osterman (Cloud Posse) @mumoshu

Actually, I didn’t know about the helmfile apply --force-update
. I had been using helmfile for less than a week…

Sorry I could have been more clear. That was in response to a suggestion. The --force-update
flag does not currently exist for helmfile apply

I switched to another laptop, installed latest version of helm, and discovered this issue. I think I may have convinced helm folks to change it so that if it will not change the repo name for the same url, not to exit 1.

meaning you’d run helmfile apply --force-update
?
No, I was talking about some helmDefaults
config option

with per-repository override, like you’ve offered above

I used the default helmDefaults

I would prefer that if I have it already to do nothing, that would be nice behavior.

@Joaquin Menchaca we’re talking about feature request of non-existing helmfile functionality

oh

yeah

makes sense.

Sorry, not enough coffee


So that would be fine. But also we get into a situation, that if they have a force-update
, and the helm version doesn’t support that option, it craps out on them

They aren’t removing --force-update
from Helm, just adding a check for whether the name and url are both the same as they were before

So it would nice to have it do whatever it needs to do regardless of helm3 version. So if not force-update, then it skips adding it again.

thus, we have 3 helm versions
- pre 3.3.2
- 3.3.2-3.3.3
- and 3.3.4 with https://github.com/helm/helm/pull/8777
A security issue fixed in 3.3.2 caught repos with the same name being added a second time and produced an error. This caused an issue for tools, such as helmfile, that will add the same name with t…
2020-09-19

Is it possible to helmfile apply
for only a single release instead of all of them in specified in the helmfile.yaml
?

You can use selectors for this, but I bet it’s not what you are looking for
2020-09-20

~I’ve got the following string in my helmfile.yaml:~
...
values:
- ...
backendBaseUriPattern: "https://$instance$.dev.my-domain.com"
...
~And it get’s rendered during helmfile apply
given the value of instance from the following range
construction:~
{{- range $instance, $map := .Environment.Values.instances }}
~In the end after rendering it looks like~
backendBaseUriPattern: "<https://my-instance.dev.my-domain.com>"
~Is this an expected behaviour? Btw, the aforementioned ~values:
block doesn’t belong to this range.

I don’t think that promoting range iterators to global variables is expected behavior. It doesn’t match with gotmpl
A variable's scope extends to the "end" action of the control structure ("if", "with", or "range") in which it is declared, or to the end of the template if there is no such control structure.
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Ok, that was my fault. I checked the wrong commit of our codebase, my colleagues forgot to put a tag on the fresh code and I didn’t notice this and examined the fresh one.
So, nevermind the question)

…486) Resolves #1483
When running helmfile test on a helmfile with conditional releases, releases with condition: false are still tested. Example: repositories: - name: stable url: https://kubernetes-charts.storage.goo…

v0.129.4: Enable helmfile test
testing only enabled and selected releases (#1…
b176408 (HEAD, tag: v0.129.4, origin/master, origin/HEAD, master) Enable helmfile test testing only enabled and selected releases (<a class=”issue-link js-issue-link” data-error-text=”Failed to load title” data-id=”703982737”…

contains the fix for the “repository name already exists” error due to the helm update

v0.130.0: Add support for ChartCenter (#1492) 942b9a6 (HEAD, tag: v0.130.0, origin/master, origin/HEAD, master) Add support for ChartCenter (<a class=”issue-link js-issue-link” data-error-text=”Failed to load title” data-id=”705302089” data-permission-text=”Title is private”…
2020-09-21
2020-09-22

Hey, I’m getting a bit confused about how state values files are propagated. I’m pointing helmfile at a directory of helmfiles. They contain templating for {{ .Values.bla }}
which I provide with --state-values-file
…or so I thought. Helmfile complains that it can’t find bla
in .Values

Did you tried to debug it with helmfile build --log-level=debug
and your --state-values-file
or --state-values-set
during debug ?

I’ll give that a try, thanks

Hi all - what is the best way to share some values between all releases in helm file ? I just don’t want to copy the same set of values or include values file in each release ?
I tried to declare values via environments, but it seems the environment values are not automatically assigned to releases
is it via release templatting ? https://github.com/roboll/helmfile/blob/master/docs/writing-helmfile.md#release-template--conventional-directory-structure

Yeah release templating is the best way I’ve found to share values like that.

But you should take this into account: https://github.com/roboll/helmfile/blob/master/docs/writing-helmfile.md#layering-release-values

good remainder again, thnx

I’m a bit unclear on how the selectors mechanism works – do the selectors only apply within helmfiles: []
or can they be applied to individual releases too?

Ok, I was using selectors
instead of labels
within the releases. But it looks like selectors get applied after templating the state files with {{ .Values.bla }}
.

selectors are intended to select some releases instead of all releases, based on labels

Hi, is it possible to define custom templates inside values template files ? like in Helm charts
{{- define "my.values.template" -}}
...
{{- end -}}

as far as i know you cannot use template for the values files.

you can if you name the values files the .yaml.gotmpl
extension

Hello @Bart M. - how can I share those templates between various .yaml.gotmpl files ?
via readFile
?

not sure, haven’t actually tried that, I just know you can use go templating in values files (which we use for small stuff)

Ok thnx
2020-09-23

Are there any best practices for annotating a namespace that gets created by Helm during sync?

anyone here who uses the vals
tool standalone?

not sure where I would have to go with questions about this, seems pretty interlinked with helmfile


How do I use bases:
when I have a directory of helmfiles?

I have
bases:
- ../base.yaml
at the top of every helmfile but it seems to get ignored

sometimes we use something like {{- tpl (readFile "../common/templates.yaml") . | nindent 0 }}
instead of bases

hmm, I guess it’s because bases get combined as independent YAML documents

so if I define templates:
in a base, it isn’t useable

@voron is {{- readFile "../common/templates.yaml" | toYaml }}
not sufficient?

toYaml
shouldn’t be required imho

try and get an answer

hmm, I just seem to end up with a blank string (even though the file exists)

oh nevermind it only appears on the third pass

any ideas what this error means: err: no releases found that matches specified selector() and environment(local), in any helmfile
? This only seems to happen when I have a helmfiles
section.

the YAML that gets generated looks fine to me:
3: repositories:
4: - name: incubator
5: url: <https://kubernetes-charts-incubator.storage.googleapis.com>
6: - name: uswitch
7: url: <https://uswitch.github.io/kiam-helm-charts/charts>
8: - name: bitnami
9: url: <https://charts.bitnami.com/bitnami>
10: - name: traefik
11: url: <https://containous.github.io/traefik-helm-chart>
12: - name: pomerium
13: url: <https://helm.pomerium.io>
14:
15: helmfiles:
16: - path: ./cluster.d
17: values:
18: - ../deployments/local/config.yaml.gotmpl
19: - path: ../deployments/local/helmfile.d
20: values:
21: - ../deployments/local/config.yaml.gotmpl

I suppose you need to define environments in your root helmfile

That’s what we have in our root helmfile
bases:
- "common/repositories.yaml"
- "common/helm-defaults.yaml"
environments:
dev:
prod:
helmfiles:
- dev/helmfile.yaml
- prod/helmfile.yaml
and in env-specific prod/helmfile
bases:
- "../common/repositories.yaml"
- "../common/helm-defaults.yaml"
environments:
prod:
{{- tpl (readFile "../common/templates.yaml") . | nindent 0 }}
releases:
...

oh I see, so you can include all the environment-specific helmfiles but they only get selected if they have a key in the environments
block

do you have a way of sharing releases between environments (with different values)?

use the same helmfile with multiple envs inside

use installed(installedTemplate):/condition:
to get conditional deploy.

releases are not environment-scoped by default

values/valuesTemplate supports dynamic file names, this feature is super.

combine it with missingFileHandler: Debug
to jam missing file warnings, and you may get like 10 values files in template

values/valuesTemplate supports dynamic file names, this feature is super.
what do you mean by this?

what do you mean by this?
I mean syntax like
valuesTemplate:
- ../common/values-{{`{{ .Release.Labels.app }}`}}.yaml.gotmpl
- {{ .Environment.Name }}/values-{{`{{ .Release.Labels.app }}`}}.yaml.gotmpl
- {{ .Environment.Name }}/values-{{`{{ .Release.Name }}`}}.yaml.gotmpl

Ah, ok, I see. Yes, this is quite handy indeed

I thought there might be some other functionality I’m not aware of:)

anyone running containerized Shibboleth and have a helm chart they started with?

Guys?
How can I reference Release.Namespace
in values?
Like:
releases:
- name: test
namespace: default
createNamespace: true
chart: incubator/raw
version: 0.2.3
values:
- resources:
- apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: test.example.com
namespace: {{ .Release.Namespace }}
spec:
secretName: test.example.com-tls
issuerRef:
name: {{ .Values.issuer }}
dnsNames:
- test.example.com
Thanks

{{
{{ .Release.Namespace }}}}
might work

nope
failed to read test.yaml: reading document at index 1: yaml: invalid map key: map[interface {}]interface {}{".Release.Namespace":interface {}(nil)}

What about just {{ .Namespace }}
?

No

Its rendered and deployed as namespace: null

Ah, probably {{ .Namespace }} is rendered when you pass it via --namespace
key. Ok, we don’t use this anyway)

How are You setting namespaces in CRs ? ( Deployed via raw chart.. )

Its should be possible according to this https://github.com/roboll/helmfile/blob/master/docs/writing-helmfile.md#release-template--conventional-directory-structure
Deploy Kubernetes Helm Charts. Contribute to roboll/helmfile development by creating an account on GitHub.

I’m very confused – I have a simple helmfile with a single release, but when I run helmfile -f simple.yaml diff
I get:
err: no releases found that matches specified selector() and environment(default), in any helmfile

do you actually have an environment defined anywhere?

no, no environments block and no --environment
flag

then its basically just saying it doesn’t see any releases in the default path

is it a single helmfile with a releases:
block ?

yeah

paste?

oh wait, I think it’s because I had a condition: bla.enabled
in the release - I passed in --state-values-set bla.enabled=true
but that didn’t do anything.


Hey All, Is there any way to set --allow-no-matching-release
in helmDefaults ?

I guess there’s no way to pass through state values from --state-values-file
to helmfiles included with helmfiles: []
2020-09-24

We occasionally have releases failing with a message like this. After the message rendering of template fails on first missing value that is in secrets file. We suspect some sort of race condition, since it’s not consistent. Does this error message ring any bells?
/home/jenkins/agent/workspace/frontend-nu_release_8.38.0/deploy/helmfile/environments/staging/secrets-nunl.sops.yaml.dec is newer than /home/jenkins/agent/workspace/frontend-nu_release_8.38.0/deploy/helmfile/environments/staging/secrets-nunl.sops.yaml

I was reading the cloudposse page on helmfile and it sounds like the best practice recommendation is to have one big helmfile with all your releases, and then filter things using selectors – does anyone here have experience with doing that?

Right now I’ve split things up into environment-specific helmfiles, and then include a “shared” helmfile using helmfiles: []
. It works, but it feels like there are a lot of moving parts to manage.

well, despite of a lot of moving parts it’s much better than manage values & secrets manually keeping things DRY.

hmm, should hooks be running for charts that have installed: false
?

installed:false
means delete release
, so I expect all delete-related hooks may take place. If you wanna skip the release - use condition:

What’s the upside of using Helmfile instead of the helm-operator and HelmRelease Crds?

helm-operator is kinda tied to fluxcd and all weave stack. It’s more about push VS pull model of changes delivery into k8s. Helm-operator doesn’t support sops natively yet, and it’s hard to get layered templated configuration as it’s possible w/ helmfile.

Is there any way to merge a glob of files containing some YAML lists into one resulting list and use it as values for a chart?
What I’m trying to do is to use incubator/raw
chart, but split templates:
into multiple files in a directory with a pattern ????-*.yaml.gotmpl
, for e.g.:
• config/0001-first-bunch.yaml.gotmpl
• config/0002-second-bunch.yaml.gotmpl
• config/9999-last-bunch.yaml.gotmpl Any advice much appreciated!

it looks like helmfile cannot merge arrays in values, as well as helm cannot do this.

Hey All, I’m using bases:
and I have two files that define an environment:
environments.yaml
0: environments:
1: prod:
2: missingFileHandler: Error
3: values:
4: - ../vars/helmfile/realms/prod.yaml
and global_vars.yaml
0: environments:
1: prod:
2: values:
3: - vault_image: my_vault_image:1.5.3
I’m using these via
bases:
- environments.yaml
- global_vars.yaml
and I’m putting that in every file down the helmfile chain. My helmfile that has a releases
block is erroring because it can’t see .Values.vault_image
executing "stringTemplate" at <.Values.vault_image>: can't evaluate field Values in type interface
Anyone know what I’m doing wrong?

I guess list
object in go template cannot be merged together

why don’t you use following environments.yaml
0: environments:
1: prod:
2: missingFileHandler: Error
3: values:
4: - ../vars/helmfile/realms/prod.yaml
5: - ../vars/helmfile/global/vars.yaml
with vars.yaml
like
vault_image: my_vault_image:1.5.3
2020-09-25

Greetings! I was wondering if anyone could explain the difference (keeping helmfile context in mind I guess) between values[templates[]]
and values[resources[]]
within incubator raw chart? Or maybe point at the doc to read about it? Thank you!

resources
are static YAML - so there is no templating (except for helmfile’s templating with yaml.gotmpl
files).
templates
are strings that will be templated by Helm itself during the install process, so you can use any values that have been passed to the chart alongside the templates.

Hi there! I am trying to integrate helm secrets with my configuration of helfile,
The current setup is based on local chart which is rendered using 3 files: configuration1.yaml configuration2.yaml secret_resource.yaml Where secret_resource.yaml contains
kind: Secret
apiVersion:
metadata:
name: dummy_secret_name
data:
sseret-key: secret
Following the samples where I specified encoded secret.yaml(with sseret-key: secret
) along with .sops.yaml. Then I changed my secret_resource.yaml to secret_resource.yaml.gotmpl and changed line sseret-key:
to sseret-key: {{ index .Values "
sseret-key`”}}. The bummer is that helmfile do not detect gotmpl and because of that the secret resource is not created. Question is: Is there any workaround?

Hey! Not sure if that will be of any help for your question… But would you consider taking secret deployment out of you chart altogether? Say to separate helmfile release or maybe use event hook (release or global) within the same helmfile release?

You should have your kind: Secret
using something like
data:
{{- range $key, $val := .Values.secret }}
{{ $key }}: {{ $val | b64enc | quote }}
{{- end }}
inside your helm chart, while you use sops-encrypted secret file with helm values in your helmfile, f.e:
secret:
key0: encrypted-value0
key1: encrypted-value1
sops:
...
and tell helmfile about this secret file using secrets:
directive in your release or template
secrets:
- secrets-{{`{{ .Release.Name }}`}}.yaml
helmfile will decrypt secrets file in runtime and pass it’s values as helm values under secret.
, and your chart generates k8s secret data:
from it.

@Vugar Indeed, it worked. You are my survivor. Thank yoou. I followed example from https://github.com/roboll/helmfile/issues/1484 Thx @voron I check this out as more of those secrets are waiting to be fixed :p
helmfile.yaml repositories: - name: incubator url: https://kubernetes-charts-incubator.storage.googleapis.com values: - domain: example.com releases: - name: test chart: incubator/raw values: - res…

@tomaszjdul glad to hear this! Personally I don’t deploy charts outside of helmfile context at all… so keeping things within helmfile releases and/or hooks works better for me. But what happens if someone say in your team (especially fresh join) will decide to use this chart in the future outside of helmfile? Depending on your environment and requirements I would give what @voron has suggested earlier a second consideration… The only thing I can add is that within helmfile context I prefer remotely sourced (e.g. from AWS SSM) secrets, these are pretty well documented here and here
Deploy Kubernetes Helm Charts. Contribute to roboll/helmfile development by creating an account on GitHub.
Helm-like configuration values loader with support for various sources - variantdev/vals

How do you install helm charts with values that use operators? For example:
- name: gamma-monitor
namespace: monitoring
chart: stable/prometheus-operator
version: 9.3.0
values:
- ./prometheus_grafana.yaml
- grafana:
adminPassword: {{ requiredEnv "GRAFANA_ADMIN_PASSWORD" }}
I will all sorts of errors:
Error: Failed to render chart: exit status 1: Error: unable to build kubernetes objects from release manifest: [unable to recognize "": no matches for kind "Alertmanager" in version "monitoring.coreos.com/v1", unable to recognize no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1", unable to recognize "": no matches for kind "Prometheus" in version "monitoring.coreos.com/v1", unable to recognize "": no matches for kind "PrometheusRule" in version "monitoring.coreos.com/v1", unable to recognize "": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com

Found answer disableValidation: true
2020-09-26
2020-09-28

Do the --set
and --values
arguments that get passed to helmfile sync/apply/write-values
refer to Helm values or to Helmfile state values? If it’s the former, should they take precedence over values files specified in the helmfile?
Experimenting with helmfile write-values
, it seems like passing --set
doesn’t do override anything provided in the helmfile.

I’ve just tested it with helmfile diff --set image.tag=123
and it shows me the diff with image tag change to 123
instead of dev
specified by helmfile itself.

I see correct output with hemfile template
but helmfile write-values
ignores --set

@vixus0 submit a PR or file a bug to fix it pls

@voron Will do :)
2020-09-29

@voron https://github.com/roboll/helmfile/pull/1503/files - any suggestions for getting a passing test would be handy

what about --values
?

--values
functions as expected

my change appends the parsed values from --set
to the list of files provided by --values

or did you mean I should be testing --values
as well?

--set
contains raw values, not files

or did you mean I should be testing --values
as well?
no

--values
functions as expected
same from my side, --values
affects generated with helmfile
write-values
file

--set
contains raw values, not files
yup, so the values need to be parsed first – https://github.com/roboll/helmfile/blob/cbbbb7bdc91e678d1ea50dde4f4555594aced5c0/pkg/state/state.go#L1284
Deploy Kubernetes Helm Charts. Contribute to roboll/helmfile development by creating an account on GitHub.

I am using helmfile to deploy different variants and I don’t want to map an variant to an environment instead I would like to pass the values.yaml and secrets.yaml file as an argument to helmfile,£
I found --state-values-file
but I couldn’t find the equivalent cli argument for the secret.