#helmfile - April 2020

hari
hariover 6 years ago(edited)
Hello Everyone,
How can we differentiate the configmaps with different environments (Dev,Int,Prod).
We don't use the helmfile
what is the recommended approach ? should we allow helm to create the configmaps by keeping the configmaps under template directory?
for example if i keep the configmap-dev.yaml, configmap-int.yaml, configmap-prod.yaml under template directory
it will try to create the configmap object for all 3 config files with same name as the spec will be as below
kind: ConfigMap
metadata:

name: envconfig-configmap-{{ .Release.Name }}
hari
hariover 6 years ago
may i know recommended approach to sort it out please
Jim
Jimover 6 years ago(edited)
Hi. I've been struggling with a problem that I hope you guys may be able to help with.
I need a way for a values file used by multiple releases to substitute different values, based on what the release is.
Vadim Bauer
Vadim Bauerover 6 years ago(edited)
I have a question, the sample helmfile reference on https://github.com/roboll/helmfile#configuration do the values for the keys represent defaults?

or where can I find all the defaults values? if they aren't mentioned in the example?
eg:
 verify: true
    # wait for k8s resources via --wait. Defaults to `false`
    wait: true
    # time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks, and waits on pod/pvc/svc/deployment readiness) (default 300)
    timeout: 60
    # performs pods restart for the resource if applicable
    recreatePods: true
    # forces resource update through delete/recreate if needed
    force: true
    # set `false` to uninstall on sync
    installed: true
    # restores previous state in case of failed release
    atomic: true
    # when true, cleans up any new resources created during a failed release
    cleanupOnFail: false

its kind of confusing especially with the comments in

helmDefaults:
# defaults for verify, wait, force, timeout and recreatePods under releases[]
  verify: true
  wait: true
  timeout: 600
  recreatePods: true
  force: true

@mumoshu do you have a reference?
mumoshu
mumoshuover 6 years ago
well sorry i dont fully understand your question.

yes, its basically default values for each entry under releases[]
mumoshu
mumoshuover 6 years ago
the reference is the readme section you linked
DanP
DanPover 6 years ago
hello
DanP
DanPover 6 years ago(edited)
I'm trying to make the following scenario work. I have a helpers directory that contains a template file add_http_repos.tpl. When I try to import te template in my values.yaml.gotmpl file as follows:
{{ readFile "helpers/add_http_repos.tpl" | tpl . }}
DanP
DanPover 6 years ago
When I run helmfile I receive executing "stringTemplate" at <.>: wrong type for value; expected string; got state.EnvironmentTemplateData
DanP
DanPover 6 years ago
Do you know how can I fix this?
Andrew Nazarov
Andrew Nazarovover 6 years ago
I’m facing a stange issue using terraform-provider-helmfile. It seems that terraform plan triggers helmfile diff against the version stored in the tf state. Basically, we have a bunch of helmfiles refferencing a global helmfile like the following:
#my_env_helmfile.yaml
helmDefaults:
  verify: false
  wait: false
  timeout: 600
  recreatePods: false
  force: false

environments:
  my_env:
    values:
      - environments/dev/my_env.yaml

helmfiles:
  - path: git::<https://my_user>:{{ requiredEnv "REPO_TOKEN" <mailto:}}@gitlab.my|}}@gitlab.my>_<http://domain.com/my_project/my-repo.git@deployment/helmfile.yaml?ref={{|domain.com/my_project/my-repo.git@deployment/helmfile.yaml?ref={{> env  "INFRA_VERSION" }}
    values:
      - environments/dev/my_env.yaml

and in tf file we set INFRA_VERSION:
...
  environment_variables = {
    INFRA_VERSION = var.infra_version
    EXTERNAL_IP = data.google_compute_address.dev_ip_address.address
  }
...

We split up some release into many in a global helmfile(we made two out of one and renamed both) and start facing the issue with existed resources. But the cause is that terraform plan is run against the old INFRA_VERION . It’s obvious from logs. But as obvious as this that a new version of INFRA_VERSION is passed to the tf command.
Say, here is the arguments to cli
2020/04/12 17:37:17 [INFO] CLI args: []string{"/bin/terraform", "plan", "-out", "planfile", "-var", "environment=my_env", "-var", "helmfile_path=my_env_helmfile.yaml", "-var", "infra_version=v3.42"}

see v3.42
and here is the diff output
in ./my_env_helmfile.yaml: in .helmfiles[0]: in /builds/my_project/my_repo_2/.helmfile/cache/https_gitlab_my_domain_com_my_repo_git.ref=v3.37/deployment/helmfile.yaml: 2 errors:

it grabs v3.37
Version 3.37 could be taken only from the tf state file. I can’t see any other option right now.
Paul Catinean
Paul Catineanover 6 years ago
Hi guys, I'm trying to setup a scenario where I can bootstrap multiple clusters with cert-manager which I don't pass custom variables much
Paul Catinean
Paul Catineanover 6 years ago
The plan is to give a list of cluster contexts and have helmfile install/upgrade them on the respective clusters and also prep the cluster by adding the CRD's
Paul Catinean
Paul Catineanover 6 years ago
To do this efficiently I would have to first check the kubernetes version and apply the standard or legacy crd's depending on that
Paul Catinean
Paul Catineanover 6 years ago
Now I have a python script that does this check but I need to execute it in the hooks for each cluster separately
Paul Catinean
Paul Catineanover 6 years ago
My questions would be 1) How do i execute a script that's relative to the helmfile (without absolute path) and 2) Do I have to manually switch the context with the script in order to communicate with the proper cluster?
Paul Catinean
Paul Catineanover 6 years ago
A similar requirement is on this issue I see: https://github.com/roboll/helmfile/issues/891
Balazs Varga
Balazs Vargaover 6 years ago
hello all. have you ever seen that helm /helmfile cannot delete all resource during destroy ?
Gourav
Gouravover 6 years ago
Hi All.. I have created a project using helmfile. Is there anyway to generate the application yaml files rather than directly applying ?I tried using helmfile template --file <<filename> --output-dir /tmp but some how not getting the mainfest files in yaml format.

Could someone please guide me on the same?
Gourav
Gouravover 6 years ago
Got it.. i think need to use template at the end.
Nelson Jeppesen
Nelson Jeppesenover 6 years ago
Heavy user of helmfile here. Question, are there any options to patch a helm chart? I'd rather not fork it. It seems like helm-x could be used for this but it's not 100% clear to me from the docs
Zachary Loeber
Zachary Loeberover 6 years ago
maybe, I always cloned/forked when I got to the point where it required modifications beyond what the original chart offered. Using the git plugin (https://github.com/aslafy-z/helm-git.git) means you don't even have to technically build/publish the chart afterwards either
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
Yep, we use this plugin all the time.
Vadim Bauer
Vadim Bauerover 6 years ago(edited)
I am trying to structure my helmfile according to https://github.com/roboll/helmfile/blob/master/docs/writing-helmfile.md#layering-state-files. However it doesn't work

>cat base.yaml
environments:
  stage:
  prod:

helmDefaults:
  wait: true
  verify: true

>cat helmfile.yaml

bases:
- base.yaml


repositories:
 ...
 redacted

releases:
  - name: letsencrypt-cert-issuer
    namespace: cert-manager
    chart: incubator/raw
    values:
       - {{ .Environment.Name }}-values.yaml
       - email: {{ .Values.acme_email }}

The values form {{ .Environment.Name }}-values.yaml aren't processed.

in stage-values.yaml I have a simple entry:
acme_email: "<mailto:org+certs+stage@example.com|org+certs+stage@example.com>"

The message is: "stringTemplate" at <.Values.acme_email>: map has no entry for key "acme_email"
Vadim Bauer
Vadim Bauerover 6 years ago(edited)
I want to create with incubator/raw a ConfigMap for grafana dashabord
example. https://github.com/xiaoping378/k8s-monitor/blob/master/manifests/grafana-import-dashboards-configmap.yaml

However the dashboard .json content contains mustache syntax {{short_version}}"
Now Helmfile is trying to interpret the content so I am not sure how to accomplish to import something as plain text.
https://grafana.com/api/dashboards/9628/revisions/4/download
Meerkat
Meerkatover 6 years ago
Anyone know how to deploy a helm chart that has a requirements.yaml for the dep charts? My goal is to deploy DAPR (https://github.com/dapr/dapr/tree/master/charts/dapr) using Tilt + Helmfile, but that isn't working out for me. It will deploy the main components, but it doesn't load in the requirements.yaml and load up the RBAC charts.
Ryan Smith
Ryan Smithover 6 years ago
Is there a way to add files on the helmfile side, that are accessible from the helm side?
https://github.com/helm/charts/blob/master/stable/locust/templates/worker-cm.yaml#L12

Like how can I add more files to tasks/*?
oza_shu
oza_shuover 6 years ago(edited)
Hi. Could you someone help me? A problem I’ve been struggling with a problem for a while.
I’m trying to install datadog with helmfile, I can decrypt api_key encrypted by sops.
But I can’t pass it to template file.
I wrote a VALUES file using this document as a reference, do you know what’s wrong with it?
https://github.com/roboll/helmfile#environment-secrets

err: release "datadog" in "helmfile.yaml" failed: helm exited with status 1:
 Error: Failed to render chart: exit status 1: Error: failed to parse /tmp/values104369418: error converting YAML to JSON: yaml: line 2: did not find expected key

I can’t get a value with {{ .Values.apikey }}, is there something wrong with the way I wrote it?
And I try {{ .Enviroment.Values.apikey }} in dev values yaml , but can’t deploy it.

bash-4.2# egrep apikey -n -B1 -A1 helm/datadog/datadog/values/dev.yaml
datadog:
 apiKey: {{ .Values.apikey }}
yuri
yuriover 6 years ago(edited)
hey guys, is anyone used DAG aware install with multiple helmfiles?
my helmfile:
helmfiles:
 - releases/docker-creds.yaml
 - releases/core-a.yaml
 - releases/core-b.yaml

how do i reference core-a to be depended on docker-creds release, referring by name does not work
Wanderley Teixeira
Wanderley Teixeiraover 6 years ago
Just ran into this issue https://github.com/roboll/helmfile/issues/760 ... hopefully it will get implemented soon
Alucas
Alucasover 6 years ago
Hmm, I'm assuming it's not possible to append to a nested value that's defaulted in a chart or another values file?