#helmfile - February 2020

February 2020
Jonathan
Jonathanalmost 7 years ago
Has anyone set up keycloak using helmfile? We used to have to set everything up manually, and had a startup script to add the custom realms as well as a role-mapping, but would like to move away from that. I've managed to add the realms properly, but I'm not sure how to add the role-mappings without using some sort of script.
Bart M.
Bart M.almost 7 years ago
I've done something like that a long time ago - but with Ansible
Bart M.
Bart M.almost 7 years ago
was a pain in the ass
Graeme Gillies
Graeme Gilliesalmost 7 years ago
I have a command that will call an external source and return json output, which I am currently using inside an {{ exec }} block in a helmfile template file for values, I don't suppose there is a way in template I can unmarshal that json into a struct or map so I can access inner attributes easily?
Josh Hudson
Josh Hudsonalmost 7 years ago
Has anyone had any luck getting inline values working with release templating? I cannot get this example from the best practices doc to work:
inline values map:
# ...
  valuesTemplate:
  - image:
      tag: `{{ .Release.Labels.tag }}`
# ...

Josh Hudson
Josh Hudsonalmost 7 years ago
In my case I'm trying to have access to .Release.Name in a values.yaml.gotmpl.
Josh Hudson
Josh Hudsonover 6 years ago
It seems like the issue is Environment.Values completely clobbers my values: and valuesTemplates: definitions from my template as I get:
executing "stringTemplate" at <.Values.releaseName>: map has no entry for key "releaseName"
error in first-pass rendering

When I strip out the environment section, the templates render without error, but I get: err: no releases found that matches specified selector() and environment(staging), in any helmfile.
bradym
bradymover 6 years ago
In my helmfile when I reference Release.Name I use:

{{`{{ .Release.Name }}`}}
bradym
bradymover 6 years ago
have you tried that?
Josh Hudson
Josh Hudsonover 6 years ago(edited)
I feel like I've tried every variation of the double bracket syntax. I can use it for the path to a values file but not inline values despite the example in the best practices doc.
This works:
  valuesTemplate:
  - config/{{`{{ .Release.Name }}`}}/values.yaml

This doesn't seem to:
  valuesTemplate:
  - releaseName: `{{ .Release.Name }}
`
bradym
bradymover 6 years ago
I think you need to wrap it in quotes when it's used at the start of the line:

    labels:
      app: "{{`{{ .Release.Name }}`}}"
bradym
bradymover 6 years ago
^^ that works in my helmfile
Josh Hudson
Josh Hudsonover 6 years ago
You are able to reference {{ <http://Values.labels.app|Values.labels.app> }} in a template?
Josh Hudson
Josh Hudsonover 6 years ago
Trying your syntax above I still get: executing "stringTemplate" at <.Values.releaseName>: map has no entry for key "releaseName" when I try to render it in a template.
bradym
bradymover 6 years ago
Oh, I'm using that in the helpfile, not in a template.
bradym
bradymover 6 years ago
May have mis-read what you posted.
Josh Hudson
Josh Hudsonover 6 years ago
Well I would love to call .Release.Name directly in a template, but because it's only in scope of the helmfile, the best practices suggests to use an inline value, but I can't get it to work.
Josh Hudson
Josh Hudsonover 6 years ago(edited)
I see something similar in a go test as your usage, but I don't think it tries it with a template: https://github.com/roboll/helmfile/blob/fc75f25293055003d8159a841940313e56a164c6/pkg/app/app_test.go#L3701-L3702
Josh Hudson
Josh Hudsonover 6 years ago
I would imagine using .Release.Name in a values template would be a common use case, so I feel like I'm missing something obvious.
bradym
bradymover 6 years ago
I'm doing a similar thing with .Environment.Name not sure if it would work with .Release.Name. Here's what I've got:

templates:
  default: &default
    chart: stable/{{`{{ .Release.Name }}`}}
    labels:
      app: "{{`{{ .Release.Name }}`}}"
    namespace: infra
    missingFileHandler: Error
    values:
      - environment: {{ .Environment.Name }}
      - config/{{`{{ .Release.Name }}`}}.values.yaml.gotmpl

I don't really understand the valuesTemplate thing, maybe try putting it in values and it'll work?
Josh Hudson
Josh Hudsonover 6 years ago
I've also tried it in values and valuesTemplate, but happy to try again.
bradym
bradymover 6 years ago
I'm new to helmfile, so I'm honestly just making some guesses and hoping they'll work. 😄
Josh Hudson
Josh Hudsonover 6 years ago
I am as well. I appreciate the help in any case 🙂
Josh Hudson
Josh Hudsonover 6 years ago
I ended up using helmfiles overrides as a workaround to hardcode my release names: https://github.com/roboll/helmfile/issues/387#issuecomment-513737164
erik-stephens
erik-stephensover 6 years ago
Anyone able to get --helm-binary declared in their helmfiles? I'd prefer user not have to know which version of helm should be used.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
@Jeremy G you are doing this right?
Jeremy G (Cloud Posse)
Jeremy G (Cloud Posse)over 6 years ago
No, I am using export HELM_BINARY=helm3 to set which binary helmfile should use. I don’t think you can select from within the helmfile itself.
DanB
DanBover 6 years ago
How can I reference a Value in my environments.yaml.gotmpl? This produces an error indicating clusterName is not set. This is odd because in my releases I use .gotmpl for values files and the same Value can be found in that context. I run this via helmfile -e developer apply with the CLUSTER_NAME and AWS_REGION env vars exported correctly.
Roderik van der Veer
Roderik van der Veerover 6 years ago
Has anyone done work to get helmfile (and diff etc) output in a computer readable format? Mostly looking for a JSON format of the info displayed after a release is completed.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
@Roderik van der Veer that's a cool idea! then we could use OPA to set up some policies.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago(edited)
@mumoshu have you seen anyone do that?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
@Roderik van der Veer what's your use-case for the JSON data?
Roderik van der Veer
Roderik van der Veerover 6 years ago
We are using helmfile to orchestrate dedicated k8s clusters + a lot of services from a web platform. The only feedback that i can five to the user waiting is “start helmfile run” and “helmfile run complete”. Having each “step” output a json log line, i can read those and show “deployed x” “deployed y” but also filter out failures when they happen.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
aha, ok - so a bit different use-case
Roderik van der Veer
Roderik van der Veerover 6 years ago
it might be as easy as supporting the json output from helm directly, we use that in some other cases (list releases etc)
mumoshu
mumoshuover 6 years ago(edited)
sounds more like a ndjson log format rather than json output, but interesting use-case!
mumoshu
mumoshuover 6 years ago
https://github.com/roboll/helmfile/issues/913 could be about adding --output json to helmfile.

this ndjson one could be about logging and possibly addressed by adding --log-format json where the default is text to helmfile.
Josh Hudson
Josh Hudsonover 6 years ago
Where in helmfiles is .Release in scope? As far as I can tell the only place I can access it is in Release Templates with double interpolation. I'm finding it very painful to get access to anything from .Release in my values templates. Anyone have any tips?
Josh Hudson
Josh Hudsonover 6 years ago
For example I have several values I'd like to do something like someUrl: {{ printf "https://%<http://s.mydomain.co|s.mydomain.co>" .Release.Namespace }} in my values.yaml.gotmpl.
David Hubbell
David Hubbellover 6 years ago
Is there a recommendation for storing the helm definition alongside the application code in the same git repo vs storing it in a separate infrastructure/IaC repo?
grv
grvover 6 years ago(edited)
Good question. We keep terraform things separate so I would like people to give their opinions here, cz I am soon switching to Helm structure as well. Currently we have a legacy setup of bunch of yaml files (deploy,service,ingress etc) in a separate repo. CI-CD systems read from the repo and control of that repo is with Devops/SRE people
DanB
DanBover 6 years ago
I'm reading the README and it isn't clear what the difference between apply and sync is. sync does upgrade --install, apply runs a diff before, but doesn't that mean the same thing?
James Huffman
James Huffmanover 6 years ago
just speaking for where i work, we do the following:
1. git repository for each microservice app
2. src folder contains the app source code
3. charts folder contains the helm chart source
4. build process generates container image and helm chart, pushes both to container/chart registry
James Huffman
James Huffmanover 6 years ago
as i understand it, apply is being deprecated and sync is the way forward
James Huffman
James Huffmanover 6 years ago
we recently migrated all our helmfile usage from apply to sync
grv
grvover 6 years ago
@James Huffman so you keep the source chart and a backup in some registry as well. What tooling you use for Helm chart for registry? S3 or something?
James Huffman
James Huffmanover 6 years ago
Azure Container Registry and Google Container Registry
James Huffman
James Huffmanover 6 years ago
you can store both container images and helm charts in those
Zachary Loeber
Zachary Loeberover 6 years ago
@James Huffman for #4, do you keep the whole chart there or do you use subcharts at all?
James Huffman
James Huffmanover 6 years ago
because we have dozens of microservices, we've made a "common" chart for which every app's chart is a thin subchart
James Huffman
James Huffmanover 6 years ago
that way we can add features to every app's chart just by changing the common one
grv
grvover 6 years ago
Does ECR support helm charts? We use ECR for dockerized images of microservices
Zachary Loeber
Zachary Loeberover 6 years ago
@James Huffman That sounds sane to me 🙂
James Huffman
James Huffmanover 6 years ago
yeah, keeps us from having 30 different ways of building charts 🙂
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
We use this pattern too
Zachary Loeber
Zachary Loeberover 6 years ago
I totally used that pattern today to migrate ingress on a cluster. It made me feel like a wizard.
Zachary Loeber
Zachary Loeberover 6 years ago
because, you know, my feelings are pertinent to this conversation...
Roderik van der Veer
Roderik van der Veerover 6 years ago
I’m having some issues with helmfile + helm3 + dynamic clusterIP’s. It is this issue: https://github.com/helm/helm/issues/7082#issuecomment-575514155 but when i put force to false in my helmfile i’m still hit with Error: UPGRADE FAILED: an error occurred while cleaning up resources. original upgrade error: failed to replace object: Service "violet-reindeer-mint-webserver" is invalid: spec.clusterIP: Invalid value: "": field is immutable: unable to cleanup resources: object not found, skipping delete
Roderik van der Veer
Roderik van der Veerover 6 years ago
it also puts my release in a failed state
Roderik van der Veer
Roderik van der Veerover 6 years ago
and i have cleanupOnFail set to true, but all the pods and services appear to be there
Roderik van der Veer
Roderik van der Veerover 6 years ago(edited)
and i do not have clusterIP in my templates in case you were wondering
Zachary Loeber
Zachary Loeberover 6 years ago
You must have clusterIP: "" somewhere in your source template or this would not occur right?
Zachary Loeber
Zachary Loeberover 6 years ago
in either case, I've found I've had to blow away the entire deployment to get around this three-way merge madness/issue myself :(*
DanB
DanBover 6 years ago
Hmm, so is there a consensus on the differences between apply and sync?
Bart M.
Bart M.over 6 years ago
hmm doesn't seem to be possible to define in a helmfile which helm version should be used?
Bart M.
Bart M.over 6 years ago
it only seems to be possible on the cli
Bart M.
Bart M.over 6 years ago
this is a bit messy since I currently have multiple environments using helm2 and helm3... now I have to specify the --helm-binary / -b every time
Nelson Jeppesen
Nelson Jeppesenover 6 years ago
From within helmfile.yaml, is there anyway I can detect if helmfile is being run with helm2 or helm 3?
Nelson Jeppesen
Nelson Jeppesenover 6 years ago
We have a shared repo that we'll be migrating namespace by namespace and I'd like to add logic that says "this helmfile.yaml is only deloyed with helm 2 or 3"
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago(edited)
I believe the right way is to set helm_binary inside each helmfile, then install both versions of helm.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
If you're using alpine linux, we distribute helm2 and helm3 packages
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
Alex Siegman
Alex Siegmanover 6 years ago
Wish there was a cloudposse group I could @ mention, but I have a very small PR to make a helmfile a bit more friendly: https://github.com/cloudposse/helmfiles/pull/224
creature
creatureover 6 years ago
they are very active on here...I bet you won't wait too long
Alex Siegman
Alex Siegmanover 6 years ago
Usually don't 😃
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
@Maxim Mironenko (Cloud Posse) is working full time on our PR backlog ☝️
Maxim Mironenko (Cloud Posse)
Maxim Mironenko (Cloud Posse)over 6 years ago
@Alex Siegman will put it on top of my queue
Alex Siegman
Alex Siegmanover 6 years ago
It's a 5 minute PR tops unless I missed some naming convention, I matched a similar one I found in Sentry helmfile 😃
Maxim Mironenko (Cloud Posse)
Maxim Mironenko (Cloud Posse)over 6 years ago
@Alex Siegman here it is: <https://github.com/cloudposse/helmfiles/releases/tag/0.92.0>
Roderik van der Veer
Roderik van der Veerover 6 years ago
Is there a way to have the u/p for a repository to come from a file? Trying to do the following where the ‘docker’ key is part of an environments values file. I tried making a base repositories file and make it a gotmpl but no joy there.
  - name: settlemint
    url: <https://harbor.settlemint.com/chartrepo/launchpad>
    username: {{ .Values.docker.username }}
    password: {{ .Values.docker.password }}
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
It’s probably related to the double rendering bug
Graeme Gillies
Graeme Gilliesover 6 years ago
is helmfiles: the only section of a helmfile that can take git repo refs/paths. E.g. can I reference another file in bases: or values: ?
Jillian Rowe
Jillian Roweover 6 years ago
hey all. has anyone deployed the elk stack with metricbeat on aws with helm? I'm going with the defaults and it sort of works, but i get an error on one of the monitoring services
Ievgenii Shepeliuk
Ievgenii Shepeliukover 6 years ago
Hi all, is helmfile usable with helm3 ?
Ievgenii Shepeliuk
Ievgenii Shepeliukover 6 years ago
Is there a way of pre render a single release,
i dont see any options in helmfile template --help
Jonathan
Jonathanover 6 years ago
helmfile -e your-environment -l name=name-of-release template
Ievgenii Shepeliuk
Ievgenii Shepeliukover 6 years ago
Hi all, how to make helmfile to delete chart, when I remove it from helmfile.yaml ?
Neither helm apply nor helm sync seems working for me
Maxim Mironenko (Cloud Posse)
Maxim Mironenko (Cloud Posse)over 6 years ago
try to use installed option. set it to false and do apply (here is documentation: <https://github.com/roboll/helmfile/blame/master/README.md#L160>)
Ievgenii Shepeliuk
Ievgenii Shepeliukover 6 years ago(edited)
Hi all, I'm doing helmfile -n myns apply and then helmfile -n myns status from my CI \ CD jenkins pipeline
Although helmfile apply executes successfully , helmfile status fails with following error
23:34:14  err: release "eshepelyuk-fastapi" failed: helm exited with status 1:
23:34:14    Error: release: not found
23:34:14  err: release "hrzn-docs" failed: helm exited with status 1:
23:34:14    Error: release: not found
23:34:14  in ./helmfile.yaml: 2 errors:
23:34:14  err 0: release "eshepelyuk-fastapi" failed: helm exited with status 1:
23:34:14    Error: release: not found
23:34:14  err 1: release "hrzn-docs" failed: helm exited with status 1:
23:34:14    Error: release: not found

Locally, both commands work,
Can anyone give an advice ?
Ievgenii Shepeliuk
Ievgenii Shepeliukover 6 years ago
Anyone plz, at least some clues where to start from ?
Zachary Loeber
Zachary Loeberover 6 years ago
maybe supply the namespace with helmfile status command?
Zachary Loeber
Zachary Loeberover 6 years ago
oh, seems like you are.
Ievgenii Shepeliuk
Ievgenii Shepeliukover 6 years ago
Well after checking debug log, i see that -n is not passed to helm status command from helmfile status


23:20:47  Getting status eshepelyuk-fastapi
23:20:47  exec: helm status eshepelyuk-fastapi
23:20:47  worker 1/2 started
23:20:47  Getting status hrzn-docs
23:20:47  exec: helm status hrzn-docs
Ievgenii Shepeliuk
Ievgenii Shepeliukover 6 years ago
Is it a bug ?
Ievgenii Shepeliuk
Ievgenii Shepeliukover 6 years ago
I found this PR https://github.com/roboll/helmfile/pull/1098
that should be fixed in 0.99.1
I am using 0.100.0, and bug is still here
Ievgenii Shepeliuk
Ievgenii Shepeliukover 6 years ago(edited)
Interesting observation when trying to workaround as suggested in that PR
1. when running helmfile status -n myns --args "--namespace myns" - I receive the same error
2. when running helmfile status --args "--namespace myns" - all works fine,
So, apparently there's a bug with -n flg in helmfile status command
Could someone confirm ?
Ievgenii Shepeliuk
Ievgenii Shepeliukover 6 years ago(edited)
Another question is about helmfile.lock
In case I'm not gonna use version ranges (ie 1.x or ~2.0) is there any reason to care about helmfile.lock
Can I put it to gitignore ?
Ievgenii Shepeliuk
Ievgenii Shepeliukover 6 years ago
Anybody here ?
George Kontridze
George Kontridzeover 6 years ago
👋
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
You can safely ignore the helmfile.lock if you're not going to use the functionality.
mumoshu
mumoshuover 6 years ago
@Ievgenii Shepeliuk Hey! Are you sure you're using the same version of Helm(3 or 2) on your machine and Jenkins?
mumoshu
mumoshuover 6 years ago
@Ievgenii Shepeliuk Thanks. One more thing - Does helm list -n myns show you eshepelyuk-fastapi on both your machine and Jekins?
Jillian Rowe
Jillian Roweover 6 years ago
I need to configure replica sets with different configurations for mongodb - https://github.com/helm/charts/tree/master/stable/mongodb-replicaset/templates. could anyone point me in the right direction?
Marco Ceppi
Marco Ceppiover 6 years ago
I've got a question about helmfile netsted helmfiles and the values key in nested helmfiles. What exactly is that meant to override and what format is expected?
Slackbot
Slackbotover 6 years ago
This message was deleted.
Ievgenii Shepeliuk
Ievgenii Shepeliukover 6 years ago(edited)
Guys, i don't know who are the maintainers, but please accept a great appreciation from our team to all of them.
we've been able to adopt helmfile in a day (sure with some issues, i've asked in this chat)
and this tool really enriched our CD pipelines, so many problems solved and so easy to adopt
it's really a great tool for k8s ecosystem
pity, we're not golang team and can't contribute freely as we do to JVM OSS projects
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
@UUB28NLDS let's keep tabs! 😉
Richard Gomes
Richard Gomesover 6 years ago
Hello. this is my first post here. 🙂
I would like to provision thousands of namespaces, one for each customer, or even several, namespaces per customer.
Every day more and more customers would join and more and more namespaces would be created.
Would `helmfile` accomodate that? What would be the best practices in this case, please?
Thanks a lot 🙂
Zachary Loeber
Zachary Loeberover 6 years ago
sure, but it may be more efficient to just script out the creation of namespaces based on your naming convention and flat yaml/json at those numbers.
Zachary Loeber
Zachary Loeberover 6 years ago
Richard Gomes
Richard Gomesover 6 years ago
@Zachary Loeber: Thanks a lot
Bart M.
Bart M.over 6 years ago
@Richard Gomes thousands would be the point where I'd consider writing a dedicated thing in Go if all these things are very similar...
you can for example use helm3 as a go library, and accessing the API is pretty easy...
Andrew Roth
Andrew Rothover 6 years ago
{{- $namespace := requiredEnv "GITLAB_KUBE_NAMESPACE" }}

How can I make that fail if the string is longer than 23 characters?
Zachary Loeber
Zachary Loeberover 6 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
That’s interesting 🧐
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
Feels quite similar to what we are doing with Helmfile and monochart, but his more opinionated approach is appealing
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
@Igor Rodionov ☝️
joey
joeyover 6 years ago
maybe i'm doing it wrong, but i did not expect that with 2 releases with the same name, one in a cluster-specific helmfile and one later in a common helmfile, helmfile will take the later one?
btai
btaiover 6 years ago(edited)
anyone else thats deploying prometheus-operator getting this issue? It was supposedly fixed in helm 2.14 but even testing with more recent versions of helm2 (2.16.3) or helm3, I still get the error:
failed processing release prometheus-operator: helm exited with status 1:
  Error: validation failed: unable to recognize "": no matches for kind "ServiceMonitor" in version "<http://monitoring.coreos.com/v1|monitoring.coreos.com/v1>"

https://github.com/coreos/prometheus-operator/issues/1866
btai
btaiover 6 years ago
I know its a race condition that I can easily script around, but it reads to me that it should be fixed?