#helmfile - August 2019

August 2019
ag
agover 7 years ago
are you only able to pull .Environment.Values into a values.yaml.gotmpl?
ag
agover 7 years ago
like something like this doesnt work
ag
agover 7 years ago
      "<http://service.beta.kubernetes.io/aws-load-balancer-ssl-cert|service.beta.kubernetes.io/aws-load-balancer-ssl-cert>": {{  .Values.cert.arn }} 
ag
agover 7 years ago
if my values: is setup like
ag
agover 7 years ago
    values:
    - ../../values/kube2iam/values.yaml.gotmpl
    - ../../values/kube2iam/{{ .Environment.Name }}.values.yaml
ag
agover 7 years ago
values.yaml.gotmpl contains the .Values.cert.arn and environment.values.yaml has an entry like
ag
agover 7 years ago(edited)
cert.arn: "fdjklfsj"
ag
agover 7 years ago
there is no way to reference that value from another values template
ag
agover 7 years ago
or would i need to do some {{ readFile }} magic
mumoshu
mumoshuover 7 years ago
@ag Hey! Yeah, you need readFile magic, or leverage sub-helmfiles like https://github.com/roboll/helmfile/issues/756#issuecomment-514013382

Helmfile values and chart(release) values are completely different things
mumoshu
mumoshuover 7 years ago
@ag We're discussing about setting values from a template rendered in a custom context(=.Values)

https://github.com/roboll/helmfile/issues/745#issuecomment-510737741


releases:
- name: myapp`
  chart: my-chart
  valuesFrom:
  - templateFile:
      path: values/values-file.yaml.gotmpl
      valuesFrom:
      # Instead of implicitly passing helmfile's Values to the values-file.yaml.gotmpl
      # Overrides it with `releaseName: myapp`
      - inlineTemplate:
          releaseName: `{{.Release.Name}}` #<- you'll need {{` `}} to defer rendering until the evaluation time of inlineTemplate. otherwise this fails due to that .Release.Name isn't available at loading-time of your helmfile.yaml :)
Yevhenii Demchenko
Yevhenii Demchenkoover 7 years ago(edited)
Hi guys,
I'm having troubles with installing chart via helmfile.
helfile

repositories:
- name: stable
  url: <https://kubernetes-charts.storage.googleapis.com>
- name: helm
  url: <utl>
  username: <username>
  password: <password>

helmDefaults:
  tillerNamespace: kube-system
  verify: true
  wait: true
  timeout: 600
  recreatePods: true
  force: true
  tls: false

# The desired states of Helm releases.
#
# Helmfile runs various helm commands to converge the current state in the live cluster to the desired state defined here.
releases:
  - name: consul
    namespace: default
    chart: helm/consul
    version: 0.8.1
    values:
    - charts/chart-consul/values.yaml


I'm getting an error Error: failed to download "helm/consul" (hint: running helm repo update may help)
If I try to install via helm, everything works fine.
When tracing, I found out that helm tries to download tgz.pov chart file, while in index.yaml there is only tgz one.
Any ideas?
mumoshu
mumoshuover 7 years ago
Interesting. How a successful helm command look like?
Can you compare it with the helm command being run by Helmfile if you run helmfile --log-level=debug?
Yevhenii Demchenko
Yevhenii Demchenkoover 7 years ago
will try to run same command as helmfile now
Yevhenii Demchenko
Yevhenii Demchenkoover 7 years ago
Okay, have the same problems. Seems like a bug in the helm, will check. Thanks for the direction
Nelson Jeppesen
Nelson Jeppesenabout 7 years ago(edited)
If I do the following:
1. deploy a chart (deployment) with helmfile
2. edit that deployment with kubectl

should a helmfile diff show a change?
Nelson Jeppesen
Nelson Jeppesenabout 7 years ago(edited)
Because when I run helmfile diff with a manual edited deployment, it shows no changes. This is with helmfile 0.80.2 and tested with helm 2.13.1, 2.14.1 and 2.14.3
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)about 7 years ago
yes, it should, however helmfile just calls out to helm-diff https://github.com/databus23/helm-diff
mumoshu
mumoshuabout 7 years ago
as far as i understand, helm diff doesn't show diff for actual k8s resources
mumoshu
mumoshuabout 7 years ago
helm persists the desired state of k8s manifests per each helm release in a release configmap/secret in tiller namespace
mumoshu
mumoshuabout 7 years ago
helm-diff shows diffs from that, not from the current state of your cluster
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)about 7 years ago
aha, wow, didn't know that.
mumoshu
mumoshuabout 7 years ago
so the downside of helm-diff is that you cant use it to detect "skews" due to manual changes
mumoshu
mumoshuabout 7 years ago
i wonder if kubectl diff is useful in that case though 🤔

maybe it can be used like this:


helm get $YOUR_RELEASE_NAME --template {{.Release.Manifest}} | kubectl diff -f -
Jeremy G (Cloud Posse)
Jeremy G (Cloud Posse)about 7 years ago
Yes, I recently encountered this behavior. helm diff diffs the new desired state against the old desired state. It is blind to manual changes in the state. I didn't even know kubectl diff existed.
Nelson Jeppesen
Nelson Jeppesenabout 7 years ago
Thank ya'll, that's very helpful. I was not aware of kubectl diff either.
Nelson Jeppesen
Nelson Jeppesenabout 7 years ago
Guess I need to keep some hands out of the kubectl pot in the future 🙂
Nelson Jeppesen
Nelson Jeppesenabout 7 years ago
darn, can't use kubectl diff with k8s 1.11 it seems
Shikhar Goel
Shikhar Goelabout 7 years ago
Hi....Is ordering possible in helmfile for single helmfile.yaml....say i have 10 helm charts in a single helmfile and i want to run run them in the order they are defined is it possible?
Shikhar Goel
Shikhar Goelabout 7 years ago
Without labels it is working with --concurrency=1 but with labels it is not
ag
agabout 7 years ago
use helmfiles:
ag
agabout 7 years ago
is how im doing it
Shikhar Goel
Shikhar Goelabout 7 years ago
what you are specifying in helmfile
Shikhar Goel
Shikhar Goelabout 7 years ago
can you give example
ag
agabout 7 years ago
helmfiles:
- path: releases/external-dns/helmfile.yaml.gotmpl
  values:
  - versions.yaml
- path: releases/prometheus-operator/helmfile.yaml.gotmpl
  values:
  - versions.yaml
- path: releases/prometheus-pushgateway/helmfile.yaml.gotmpl
  values:
  - versions.yaml
ag
agabout 7 years ago
will deploy them in that order
Shikhar Goel
Shikhar Goelabout 7 years ago
but i want to use only one helmfile i dont want to use multiple helmfiles....ok if this i do is it possible to have helmfile specific to envvironment
Shikhar Goel
Shikhar Goelabout 7 years ago
like i have three environments i want each corresponding helmfile for them
ag
agabout 7 years ago
not sure with a single helmfile
Shikhar Goel
Shikhar Goelabout 7 years ago
i want that the helmfile with --environment set should work
Shikhar Goel
Shikhar Goelabout 7 years ago
can i have helmfile per environment
Shikhar Goel
Shikhar Goelabout 7 years ago
Thanks....Hi is it possible to read the values in gotmpl file from the configmap in k8s?
Travis Groth
Travis Grothabout 7 years ago
@mumoshu so i have https://github.com/roboll/helmfile/pull/790 open but looking at the environmentSecrets, i'm thinking a package scoped cache might be better so that exec contexts don't need to be threaded everywhere
Travis Groth
Travis Grothabout 7 years ago
LMK thoughts on that approach. i think its an easy evolution of that patch.
Nelson Jeppesen
Nelson Jeppesenabout 7 years ago
When running helmfile deps, how to scope it to a single release?
Nelson Jeppesen
Nelson Jeppesenabout 7 years ago(edited)
I tried helmfile --selector name=my-app-1 deps, but that removes everything except my-app-1 from helmfile.lock
Erik Forsberg
Erik Forsbergabout 7 years ago
I have a chart, namely prometheus-msteams that reads in a file via Files.Get. I'd like to override the contents of that file, i.e what's in card.tmp. Is there some way of doing so when installing the chart via helmfile?

I can of course modify the chart so that it has the option to specify what configmap to use, but if I don't have to because helmfile already can do this for me, I will be eternally happy 🙂

https://github.com/bzon/prometheus-msteams/tree/master/chart/prometheus-msteams
Travis Groth
Travis Grothabout 7 years ago
@mumoshu do you know when you're anticipating a new helmfile release?
Shiva Gopal
Shiva Gopalabout 7 years ago
#helmfile I am thinking of the following structure

*modules*   readme.md sites

./modules:
postgresql prometheus

./modules/postgresql:
postgresql.yaml

./modules/prometheus:
prometheus.yaml

./sites:
minikube

./sites/minikube/local:
helmfile.yaml          postgresql_values.yaml prometheus_values.yaml
./sites/infra/dev:
helmfile.yaml
./sites/infra/staging:

Where the sites folder would have the components that needs to be installed in an environment, and the modules holding the common modules. I saw the helmfiles.d/ and values/ separation, here it would give us better view on what is going on per site. What are the problems with the above structure? Since nothing much has been actually done, it would be very easy to change at this point. Thanks 🙏
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)about 7 years ago
@Shiva Gopal I don't see any use of "environments"
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)about 7 years ago
just want to make sure that's on your radar
Shiva Gopal
Shiva Gopalabout 7 years ago
@Erik Osterman (Cloud Posse) - the structure is ./sites/customer/{env,namespace} - At least that's the idea
Shiva Gopal
Shiva Gopalabout 7 years ago
#helmfile - I want to run https://github.com/helm/charts/tree/master/stable/grafana repeatedly, with the adminPassword set in values.yaml file

I have tried different combinations, the secret is getting generated each time. What am I doing wrong? Thanks @mumoshu
Andrew Nazarov
Andrew Nazarovabout 7 years ago
It’s too bad we cannot see the full history here. I wanted to recall something by checking out old messages, but got hit by this limitation.
nutellinoit
nutellinoitabout 7 years ago
@Andrew Nazarov you can use https://archive.sweetops.com/helmfile/
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)about 7 years ago
by our very own @stobiewankenobi
sung kang
sung kangabout 7 years ago
Hey ya’ll, I feel like I’m misunderstanding something about environments feature in helmfile and was hoping someone could point me in the right direction. Trying to do this but my environment values aren’t getting passed down to my sub helmfiles

environments:
   beta:
    values:
      - externaldns:
          installed: false
        namespaces:
          installed: false

helmfiles:
  - path: releases/external-dns
    values:
     - installed: {{ Environment.Values.externaldns.installed }}
  - path: releases/namespaces
    values:
     - installed: {{ Environments.Values.namespaces.installed }}
sung kang
sung kangabout 7 years ago
Am I missing something here entirely?
sung kang
sung kangabout 7 years ago
I know environments aren’t shared down to sub-helmfiles but I’d thought I could expose them through the state this way
devoperandi
devoperandiabout 7 years ago
Hello, anyone around to answer a question?
Shiva Gopal
Shiva Gopalabout 7 years ago(edited)
@Erik Osterman (Cloud Posse) / @mumoshu / others with terraform experience. Has anyone studied the pros/cons of using terraform helm provider vs helmfile? I am obviously biased towards helmfile (don't have much experience with the tf helm provider though) and would like to present any known items of one vs the other. Thanks
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)about 7 years ago
(I jumping on a call but will get back to you today)
Shiva Gopal
Shiva Gopalabout 7 years ago
Thanks @Erik Osterman (Cloud Posse)
Shiva Gopal
Shiva Gopalabout 7 years ago
@devoperandi - welcome , loved your blog and still using git2consul 🙂
devoperandi
devoperandiabout 7 years ago
@Shiva Gopal Thanks man. I have utterly failed to blog over the last year. Need to get back to it.
Daniel Johansson
Daniel Johanssonabout 7 years ago
Hi, I have a set of helmfiles in helmfiles.d and a values.gotmpl created by other people. I get an error complaining about .Values.clusterRegion not being set, even though it looks to me that it should be set. Is there a way to render the .gotmpl-file to see that that is ok and/or see what helmfile thinks should be in the .Values variable ?
Daniel Johansson
Daniel Johanssonabout 7 years ago
I've tried with: helmfile --log-level debug template
and also adding a dummy parameter with {{ .Values | toYaml }}
But nothing showed presumed contents of the .gotmpl
Robert
Robertabout 7 years ago
@Robert has joined the channel