#helmfile - July 2021

Vladimir Avdoshka
Vladimir Avdoshkaover 5 years ago
Hello!
I’m wondering how do you develop/test things locally with Helmfile?
I’m looking for some kind of seamless (automated) process of having the feedback loop on dev environment, wether it be triggered by some change of the code or helm chart or Helmfile. Similar to what one can do with the skaffold.

I’ve opened an issue in Helmfile - https://github.com/roboll/helmfile/issues/1903 to discuss this. Thank you for sharing!
Amos
Amosover 5 years ago
Hi folks!
I'm trying to loop over same release but every iteration needs a different set of values per release iteration.

The helmfile looks like this:
releases:
{{ range $i, $releases := until .Values.RELEASE_COUNTER }}
{{ $chartNumber := add1 $releases | toString }}
- name: release-number-{{ $chartNumber }}
  <<: *default
  labels:
    app: '{{`{{ .Release.Name }}`}}'
    chart: some-chart
    tier: core
{{- end }}

What is the best way to achieve that with helmfile ?
https://github.com/roboll/helmfile/issues/1906
Ievgenii Shepeliuk
Ievgenii Shepeliukover 5 years ago
Hi all
the project readme shows passCredentials parameter for OCI repos
But when using it I received an error

in ./helmfile.yaml: failed to read helmfile.yaml: reading document at index 1: yaml: unmarshal errors:
  line 7: field passCredentials not found in type state.RepositorySpec

helmfile version
$ helmfile version
helmfile version v0.139.9
Joaquin Menchaca
Joaquin Menchacaover 5 years ago
Is there any way to patch output of a helm chart in a helmfile?

Without helmfile, I would do something like this:
helm template ... | linkerd inject | kubectl apply -f -

So I am wondering how I could do the equivalent in helmfile? Make post hook with some patch.json or linkerd inject?
Joaquin Menchaca
Joaquin Menchacaover 5 years ago(edited)
Is it possible to inline replacement, trying to do equivalent of --set-file without the set-file.

releases:
  - name: linkerd
    namespace: linkerd
    chart: linkerd/linkerd2
    version: 2.10.2
    values:
      - identityTrustAnchorsPEM: {{ readFile "certs/ca.crt" }}

I thought I would get this in-place, but then I think it is causing maybe an indentation problem. I am not sure.

I get this error
in ./helmfile.yaml: failed to read helmfile.yaml: reading document at index 1: yaml: line 13: could not find expected ':'
Joaquin Menchaca
Joaquin Menchacaover 5 years ago
Is it possible to reference the {{ .Release.Namespace }} in the helmfile.yaml?
Joaquin Menchaca
Joaquin Menchacaover 5 years ago
I was following docs from https://github.com/roboll/helmfile#labels-overview, where there's an example of {{ .Release.Name }} , but I get this:
err: error during helmfile.yaml.part.0 parsing: template: stringTemplate:7:30: executing "stringTemplate" at <.Release.Name>: can't evaluate field Release in type state.EnvironmentTemplateData
in ./helmfile.yaml: error during helmfile.yaml.part.0 parsing: template: stringTemplate:7:30: executing "stringTemplate" at <.Release.Name>: can't evaluate field Release in type state.EnvironmentTemplateData
Joaquin Menchaca
Joaquin Menchacaover 5 years ago
I wrote this up, I cannot figure it out from the docs. 😢
https://github.com/roboll/helmfile/issues/1914
Joaquin Menchaca
Joaquin Menchacaover 5 years ago
After finding a more COMPLETE example online (ref. https://www.arthurkoziel.com/managing-helm-charts-with-helmfile/), I found few things that I was doing wrong, in case anyone interested in this:

• can reference {{{{ .Release.Name }}}} in templates.default values, but not values passed to the helm chart.
• cannot seem to use {{ .Release.Name }} in helmfile under releases:
Joaquin Menchaca
Joaquin Menchacaover 5 years ago
I eventually settled on:
repositories:
  - name: linkerd
    url: <https://helm.linkerd.io/stable>

templates:
  default: &default
    chart: linkerd/{{`{{ .Release.Name }}`}}
    missingFileHandler: Warn
    values:
      - ./values/{{`{{ .Release.Name }}`}}.yaml.gotmpl
      - installNamespace: false

releases:
  - name: linkerd2
    namespace: linkerd
    <<: *default
  - name: linkerd-viz
    namespace: linkerd-viz
    <<: *default
  - name: linkerd-jaeger
    namespace: linkerd-jaeger
    <<: *default

I wish that I could use if blocks around the .Release.Name, but as these are rendered later, that is not possible. I wish I could also reference the .Release.Name in the helm chart values themselves, as that would be useful.
U
Unknown Userover 5 years ago(edited)
How many of you received any help from this chat
Joaquin Menchaca
Joaquin Menchacaover 5 years ago
On my helmfile templates exploration, I wish I could use the .Release.Name, to branch, like if you are this chart, do this thingy. The best that can be done is to put the chart specific changes values file that is fetched using .Release.Name as part of the file name. There will undoubtedly be redundancy. In looking at github issues, it would look like that to change this current behavior would require some major refactoring, especially as .Release.Name is determine later in the process.

In the case of my linkerd use case, then extensions are all consistent, and because linkerd is more unique and requires deploying CRD plus other components that take a few minutes to come up, I may have these as separate stages, maybe through environments, and let the operator determine when to install the extensions. The other problem is that there might be some rate limit to access docker images from Azure (some anti-competitiveness), but cannot prove 100%, just noticing behavior from Azure to where Linkerd stores their images (AWS) with CrashBackOffs.
Lucho
Luchoover 5 years ago
Hi folks, how are you? I'm new with helm and I want to know if helmfile can help me to deploy Application and Database at the same time. I want to deploy Database only If some flag is true inside my values(eg: mongo.enabled.true )... Someone here have experience doing it ? Or do you recommend another idea?
Thanks a lot!
vicken
vickenover 5 years ago(edited)
Hi all
I’m trying to reconcile what the difference between these two (inline vs file) could be (v0.139.9):

I am able to do this, the value with the “env” gets picked up with FOO=bar helmfile -e myenv diff

environments.yaml
environments:
  myenv:
    values:
      - foo: {{ env "FOO" }}

However, it seems referencing the same “env” in a values file does not work. Getting an error
in helmfile.d/environments.yaml: failed to read environments.yaml: failed to load environment values file "values/myenv.yaml": yaml: invalid map key: map[interface {}]interface {}{"env \"FOO\"":interface {}(nil)}

environments.yaml
environments:
  myenv:
    values:
      - values/myenv.yaml

values/myenv.yaml
foo: {{ env "FOO" }}

Not sure if this is also supposed to work or not
Ihor Urazov
Ihor Urazovover 5 years ago
Is there a sensible way install CRDs from urls prior to installing chart that depends on CRDs availability via just helmfile? For example this chart requires CRDs to be installed via kubectl https://github.com/piraeusdatastore/helm-charts/tree/main/charts/snapshot-validation-webhook
batistein
batisteinover 5 years ago
Hello all,
helmfile is really a great tool. However, there is a use-case that I have all the time and wondered if my cumbersome way is the right one.

I have to add for example istio virtualService and Gateway templates to several charts. Optimal would be a way where I can add templates.
Currently I solve the problem by creating a new chart that contains these templates but this is not very good because I can't reuse values from the original chart and also not the helper.tpl....

Is there any smarter way?
batistein
batisteinover 5 years ago
Hello together,

I have several helmfiles which I want to bundle. So far I do this via helmfiles: in another helmfile.
However I then lose the parallel processing of releases. Is there a way to wrap helmfiles and still specify that some of the subhelmfiles can run in parallel?
Sean S
Sean Sover 5 years ago(edited)
Hello everyone, Is it possible to construct helmfile dynamically from a yaml config file or some other format? I wanted have a service specific config file where I can define all my dependencies and then on run time it constructs a helmfile
muhaha
muhahaover 5 years ago
Guys? I am trying to recreate map from values to CR, but getting null instead, any idea? Thanks
environments:
  default:
    values:
      - applications:
        - name: test-app
          spec:
            project: test-project
            source:
              repoURL: <https://git.example.com/foo/bar>
              targetRevision: HEAD
              path: john/doe
            destination:
              server: <https://example.com>
              namespace: argocd

repositories:
- name: incubator
  url: <https://charts.helm.sh/incubator>

releases:
- name: argocd-applications
  namespace: argocd
  createNamespace: true
  chart: incubator/raw
  version: 0.2.3
  values:
    - resources:
        {{- range $pIndex, $application := .Values.applications }}
        - apiVersion: <http://argoproj.io/v1alpha1|argoproj.io/v1alpha1>
          kind: Application
          metadata:
            name: {{ $application.name }}
            namespace: argocd
            finalizers:
              - <http://resources-finalizer.argocd.argoproj.io|resources-finalizer.argocd.argoproj.io>
          spec: 
           {{- toYaml $application.spec | nindent 6 }}
        {{- end }}
Sean S
Sean Sover 5 years ago
hello everyone, can we've helmfile defined in some-other repo ? which point to chart that reside in some other github repo
Tom
Tomover 5 years ago
Hello, is there any way to include encoded secret.yaml inside helfile via gitlab url raw file? I’ve tried using url: as well ref+sops wo any result
Sean S
Sean Sover 5 years ago
hello All, can we create a template / yaml file with app configurations and create helmfile dynamically using this template config file?