#helmfile - September 2019

September 2019
Shikhar Goel
Shikhar Goelabout 7 years ago
Hi...Actually I have made a docker file that runs helmfile apply i want to get the status of 'helmfile apply'.So that my job can fail if helmfile fails.
sung kang
sung kangabout 7 years ago(edited)
Can anyone help me debug why
values:
  - runnerRegistrationToken: ""
    installed: true

releases:
  - name: {{ .Environment.Name }}
    namespace: "gitlab"
    labels:
      chart: "gitlab-runner"
      repo: "gitlab"
      namespace: "gitlab"
      vendor: "gitlab"
    chart: "gitlab/gitlab-runner"
    version: "v0.9.0"
    wait: true
    installed: {{ .Values.installed }}
    tillerNamespace: "gitlab"
    values:
      - imagePullPolicy: Always
        gitlabUrl: <http://git.url.com|git.url.com>
        runnerRegistrationToken: {{ .Values.runnerRegistrationToken }}
        runners:
          tags: {{ .Environment.Name }},eks
          serviceAccountName: "admin"
        rbac:
          create: true

bases:
  - defaults.yaml

Results in releases/gitlab-runner.yaml: error during gitlab-runner.yaml.part.0 parsing: template: stringTemplate:16:25: executing "stringTemplate" at <.Values.installed>: map has no entry for key "installed"
sung kang
sung kangabout 7 years ago
Calling it from my root helmfile like so:

  # Deployment Stack
  - path: releases/gitlab-runner.yaml
    values:
    - installed: {{ .Environment.Values | get "namespaces.installed" true }}
      runnerRegistrationToken: {{ .Environment.Values.gitlab.runnerRegistrationToken }}
sung kang
sung kangabout 7 years ago
I see this happen every now and then and can never figure out what I did to have it render properly
sung kang
sung kangabout 7 years ago(edited)
I believe the states do get merged properly from the debug logs

first-pass produced: &{utility map[installed:false runnerRegistrationToken:foo] map[]}

first-pass rendering result of "gitlab-runner.yaml.part.0": {utility map[installed:false runnerRegistrationToken:foo] map[]}

second-pass rendering failed, input of "gitlab-runner.yaml.part.0":

sung kang
sung kangabout 7 years ago
Hmm very odd, may be a bug. Unless I pass down a nested state value helmfile doesn’t seem to want to render.
Nelson Jeppesen
Nelson Jeppesenabout 7 years ago(edited)
Is it possible to have helmfile rollback a deployment if the pods return ErrImagePull?
Nelson Jeppesen
Nelson Jeppesenabout 7 years ago
Have atomic, force and wait set to true but it does not seem to do that
Nelson Jeppesen
Nelson Jeppesenabout 7 years ago
RESOURCES:
==> v1/Pod(related)
NAME                                                             READY  STATUS        RESTARTS  AGE
testreplease-578d4r5sg  0/1    ErrImagePull  0         3s
testreplease-77b4n22hc  0/1    Terminating   0         6m12s
Nelson Jeppesen
Nelson Jeppesenabout 7 years ago
here you see it killing the old working pod with a new pod in ErrImagePull status but reporting a success and not rolling back
Nelson Jeppesen
Nelson Jeppesenabout 7 years ago
I think I've got it figured out, in a way. If I use a replica greater than 1, it works as I'd hope
TBeijen
TBeijenabout 7 years ago
Hi. I recently started using Helmfile and now try to have 2 environments (clusters) deployed using Jenkins parallel pipeline steps. But one of them results in error because of missing env vars. It works fine if I disable the 'other parallel step'. So... I think under the hood Helmfile does some in place intermediate rendering that doesn't play nice when 2 processes are operating on the same underlying workspace.

Does this look familiar or does anyone have tips on how to debug or where to dig for more information? (Short-term fix will be: No parallelisation)
erik-stephens
erik-stephensabout 7 years ago
Hi, anyone able to get --args working? I like helmfile diff --args='--context=2' but it fails when using helmfiles feature. I see this in debug log:
Building dependency release=foo, chart=../foo

exec: helm dependency build ../foo --context=2

Basically, how do I inform it to only use --context=2 when doing helm diff?
Steve Nolen
Steve Nolenabout 7 years ago
potentially a simple (albeit weird) question: Is there a way to inject the value passed to helmfile via --kube-context into a variable of a release?
Steve Nolen
Steve Nolenabout 7 years ago
or potentially less abstractly, I'd like to know if there is a way to inject the name of the current cluster I'm operating on into a variable
yuri
yuriabout 7 years ago
hey guys, helmfile newbie here, i’m looking to keep my all charts values in 1 file that defines an environment
ppe.yaml
namespace: ppe-test

nginx:
  replicas: 2
  tag: 1.0.79
  chart: stable/nginx

traefik:
  replicas: 2
  tag: 1.0.79
  chart: stable/traefik

templates.yaml
templates:
  default: &default
    namespace: "{{ .Values.namespace }}"
    missingFileHandler: Error
    chart: "{{ `{{ .Release.Name }}`.chart }}"
    values:
      - envs/{{ .Environment.Name }}.yaml

helmfile.yaml
bases:
  - envs/environments.yaml
---
{{ readFile "templates.yaml" }}

releases:
- name: nginx
  <<: *default

is it possible to access the .Release.Name and to pass it to env values?
Shikhar Goel
Shikhar Goelabout 7 years ago
Is rollback possible in helmfile...similar to rollback in helm
starets
staretsabout 7 years ago
is there some “escape sequence” for variable values containing valid templating expressions, like:

abc: "{{  template "slack.general.text" . }}"

(in my case this value shouldn’t be rendered, but passed as-is)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)about 7 years ago
Use gotemplate escaping
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)about 7 years ago
{{{{Blah}}}}
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)about 7 years ago
Jakub Korzeniowski
Jakub Korzeniowskiabout 7 years ago
Hi All 👋 . I want to deploy Atlantis to be able to run helmfile instead of terraform. Using an official helm chart for that (https://www.runatlantis.io/docs/deployment.html#deployment-2). I was wondering whether someone has already built a docker image with helmfile and helm secrets installed that I could simply substitute the official one for.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)about 7 years ago
@Jakub Korzeniowski we use atlantis with helmfile
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)about 7 years ago
our strategy is to use geodesic. we bake our cloud automation toolchain into a container
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)about 7 years ago
then we can run that container anywhere (e.g. on our tty or with atlantis)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)about 7 years ago
Asaduzzaman Pavel
Asaduzzaman Pavelabout 7 years ago
hello
Asaduzzaman Pavel
Asaduzzaman Pavelabout 7 years ago
how do i add file to files to configmaps?
Asaduzzaman Pavel
Asaduzzaman Pavelabout 7 years ago

helmfile -f ../deployments/helmfile.yaml sync
could not deduce `environment:` block, configuring only .Environment.Name. error: failed to read helmfile.yaml.part.0: reading document at index 1: yaml: unmarshal errors:
  line 2: cannot unmarshal !!str `./depen...` into state.ReleaseSpec
  line 3: cannot unmarshal !!str `./depen...` into state.ReleaseSpec
  line 4: cannot unmarshal !!str `./servi...` into state.ReleaseSpec
in ../deployments/helmfile.yaml: failed to read helmfile.yaml: reading document at index 1: yaml: unmarshal errors:
  line 2: cannot unmarshal !!str `./depen...` into state.ReleaseSpec
  line 3: cannot unmarshal !!str `./depen...` into state.ReleaseSpec
  line 4: cannot unmarshal !!str `./servi...` into state.ReleaseSpec
Error: running "helmfile -f ../deployments/helmfile.yaml sync" failed with exit code 1

Asaduzzaman Pavel
Asaduzzaman Pavelabout 7 years ago
any idea whats going on?
Volodymyr Barna
Volodymyr Barnaabout 7 years ago
wow, there's a chat for helmfile, awesome! But unfortunately, I already created an issue for my question. Any helm help is appreciated! (can't find anything in docs and in other issues) https://github.com/roboll/helmfile/issues/867
yuri
yuriabout 7 years ago(edited)
hey guys, can i reference Release.Name in values?
for example, i deploy a db that creates an svc, and i need this db-svc to be referenced in another app values
yuri
yuriabout 7 years ago
based on that feature: https://github.com/roboll/helmfile/pull/439
i was assuming that i can use this:

releases:
- name: "appv1"
  chart: private/appv1
  <<: *default
  values:
  - fullnameOverride: "{{`{{ .Release.Name }}`}}"


template is passing fine, but sync results in:
List of releases in error :
RELEASE
appv1
err: release "appv1" in "app.yaml" failed: failed processing release appv1: helm exited with status 1:
  Error: release: "appv1" not found


in ./helmfile.yaml: in .helmfiles[0]: in apps/app.yaml: failed processing release appv1: helm exited with status 1:
Error: release: “appv1” not found```

if im just using - fullnameOverride: "appv1" it works just fine
mumoshu
mumoshuabout 7 years ago
Trying CUE as an alternative to go YAML+Go templates:

https://github.com/roboll/helmfile/issues/869
Volodymyr Barna
Volodymyr Barnaabout 7 years ago
Hello. I recreated kubernetes cluster (everything is deleted) but when I run helmfile list on a newly created cluster it still shows a list of relases with installed:true. Where's helmfile state is saved? I even removed ~/.helm folder and run helmfile destroy. It didn't help. Thanks!
Volodymyr Barna
Volodymyr Barnaabout 7 years ago
On the new cluster I want to run in tillerless mode. I followed the docs but it says tiller not found when I run helmfile apply. Or when I run helmfile status it says release: "blah" not found. So I guess it has something to do with the state saved locally.
Aaron Batilo
Aaron Batiloabout 7 years ago
Has anyone had success with generating a lock file for your helmfile?


root@d8760d0f2279:~/src/helmfiles/aws/us-west-2/l2v-dev# ls
helmfile.yaml
root@d8760d0f2279:~/src/helmfiles/aws/us-west-2/l2v-dev# cat helmfile.yaml
releases:
  - name: metrics-server
    chart: stable/metrics-server
root@d8760d0f2279:~/src/helmfiles/aws/us-west-2/l2v-dev# helmfile deps
root@d8760d0f2279:~/src/helmfiles/aws/us-west-2/l2v-dev# ls
helmfile.yaml
root@d8760d0f2279:~/src/helmfiles/aws/us-west-2/l2v-dev# helmfile -v
helmfile version v0.85.2


No matter what I do, I can't seem to create that lock file