#helmfile (2022-10)

https://github.com/helmfile/helmfile

Questions and discussion around helmfile https://github.com/roboll/helmfile and https://github.com/cloudposse/helmfiles

Archive: https://archive.sweetops.com/helmfile/

2022-10-07

Alexander Taran avatar
Alexander Taran

Hi gents How can I pass variable to helmfile from cli? helmfile apply --state-values-set gateway.grpcJsonTranscoder.protoBinContent=$(cat ${PROTOBIN_ARTIFACT} | base64) This command doesn’t pass anything to the targeted helm chart

voron avatar

Do you use helmfile value gateway.grpcJsonTranscoder.protoBinContent inside your templates ? State values are helmfile-only values. You may need to use --set to set helm values directly from CLI.

Alexander Taran avatar
Alexander Taran

I did that locally and it was ok but in CI system it doesn’t work(have no idea why)

voron avatar

you may check helmfile version in CI

Alexander Taran avatar
Alexander Taran

Thanks for help version of the image was canary, but CI system caching images so I used a very old one

Alexander Taran avatar
Alexander Taran

One more question from my side.

I have a file(less than 1Mb) and I need to pass a content of the file to a variable in my helm chart. This is not static file. Usage of configmaps, secrets and etc is not an option. helmfile apply --set gateway.grpcJsonTranscoder.protoBinContent=$(cat ${PROTOBIN_ARTIFACT} | base64) This command seems to work in zsh but in bash I only get first string of the encoded file I tried to use base64 -w 0 but I’m getting another error that string I’m passing is too long

Have some faced with a similar task? Maybe alternative way of passing large vars.

bradym avatar

It’s weird that you’d be getting different results based on the shell in use. Have you verified that the value of PROTOBIN_ARTIFACT is the same? I’m guessing zsh = local and bash = CI?

If you rule out differences in local vs CI (or similar) one option could be creating a values file on the fly and using --values instead of --set. I’d use dasel (https://github.com/TomWright/dasel) for that as makes it easy to read/write yaml (and many other formats) from the command line.

TomWright/dasel

Select, put and delete data from JSON, TOML, YAML, XML and CSV files with a single tool. Supports conversion between formats and can be used as a Go package.

Alexander Taran avatar
Alexander Taran
  1. Sure,I’ve checked that I have the same content in both cases
  2. Going to check,thanks
Alexander Taran avatar
Alexander Taran

@bradym The issue was ARG_MAX on zsh(1048576) and bash(262144) has different values. It depends on OS you are using.

Alexander Taran avatar
Alexander Taran

I have multiple releases in one helmfile. Could you prompt how can I pass this “on the fly values file” to a specific release? This is my command currently

helmfile apply . --values=${PROTOBIN_RESULT}
bradym avatar

You can use the --selector option on helmfile to limit which releases are considered.

Something like helmfile --selector name=myJob apply

https://helmfile.readthedocs.io/en/latest/#labels-overview

bradym avatar

Interesting to know about the ARG_MAX values being different, thanks for the info.

Alexander Taran avatar
Alexander Taran

Found this here. Going to try, thank you)

2022-10-08

2022-10-10

Georg Grauberger avatar
Georg Grauberger

Hi everybody,

quick question. Does the environments config work only in the case of using templates in the release config? Let’s say with something like this.

# helmfile
environments:
  default:
    values:
      - path/to/values.yaml
  local:
    values:
      - path/to/values-local.yaml

releases:
  - chart: some/path/to/local/chart
    name: fooBar
    devel: false

I’d assume that helmfile would use the values from values-local.yaml It does completely ignore them though when I call

helmfile --environment local sync
yxxhero avatar
yxxhero

@Georg Grauberger

# helmfile
environments:
  default:
    values:
      - path/to/values.yaml
  local:
    values:
      - path/to/values-local.yaml

releases:
  - chart: some/path/to/local/chart
    name: fooBar
    devel: false
    values:
      # use go template, values come from env config.
      - base.yaml.gotmpl
Georg Grauberger avatar
Georg Grauberger

So do I understand correctly that in order to use the environments feature I have to use a values.yaml.gotmpl ?

yxxhero avatar
yxxhero

yes. you can test it.

2022-10-11

2022-10-25

z0rc3r avatar

@yxxhero @mumoshu Question about https://github.com/helmfile/helmfile/blob/main/docs/proposals/towards-1.0.md, specifically about Point 2.

How is this transition planned? I hope that this won’t be a hard cutoff when helmfile.yaml works with one version and next version strictly requires to helmfile.yaml.gotmpl.

I have multiple teams that manage their own helm charts and deployments using helmfile. I need them to enable smooth transition from old to new file during the course of several months. Like accept helmfile.yaml and emit a warning that user has to switch to new file extension, or provide a CLI arg and/or env var to control this behaviour. Otherwise it’s an organization level challenge to make everyone switch to new file format simultaneously. Worst case scenario, we’ll just stick to old helmfile version indefinitely.

# Towards Helmfile 1.0

I'd like to make 3 breaking changes to Helmfile and mark it as 1.0, so that we can better communicate with the current and future Helmfile users about our stance on maintaining Helmfile.

Note that every breaking change should have an easy alternative way to achieve the same goal achieved using the removed functionality.

## The changes in 1.0

1. Forbid the use of `environments` and `releases` within a single helmfile.yaml part
  - Helmfile currently relies on a hack called "double rendering" which no one understands correctly (I suppose) to solve the chicken-and-egg problem of rendering the helmfile template(which requires helmfile to parse `environments` as yaml first) and parsing the rendered helmfile as yaml(which requires helmfile to render the template first).
  - By forcing (or print a big warning) the user to do separate helmfile parts for `environments` and `releases`, it's very unlikely Helmfile needs double-rendering at all.
  - After this change, every helmfile.yaml written this way:

    
environments:
  default:
    values:
    - foo: bar
releases:
- name: myapp
  chart: charts/myapp
  values:
  - {{ .Values | toYaml | nindent 4 }}
    must be rewritten like:
    
environments:
  default:
    values:
    - foo: bar
---
releases:
- name: myapp
  chart: charts/myapp
  values:
  - {{ .Values | toYaml | nindent 4 }}
    It might not be a deal breaker as you already had to separate helmfile parts when you need to generate `environments` dynamically:
    
environments:
  default:
    values:
    - foo: bar
---
environments:
  default:
    values:
    - {{ .Values | toYaml | nindent 6}}}
    - bar: baz
---
releases:
- name: myapp
  chart: charts/myapp
  values:
  - {{ .Values | toYaml | nindent 4 }}
    
    If you're already using any helmfile.yaml files that are written in the first style, do start using `---` today! It will probably reveal and fix unintended template evaluations. If you start using `---` today, you won't need to do anything after Helmfile 1.0.
2. Force `.gotmpl` (or `.tpl`) file extension for `helmfile.yaml` in case you want helmfile to render it as a go template before yaml parsing.
  - As the primary maintainer of the project, I'm tired of explaining why Helmfile renders go template expressions embedded in a yaml comment. [The latest example of it](<https://github.com/helmfile/helmfile/issues/127>).
  - When we first introduced helmfile the ability to render helmfile.yaml as a go template, I did propose it to require `.gotmpl` file extension to enable the feature. But none of active helmfile users and contributors at that time agreed with it (although I didn't have a very strong opinion on the matter either), so we enabled it without the extension. I consider it as a tech debt now.

3. Remove the `--args` flag from the `helmfile` command
  - It has been provided as-is, and never intended to work reliably because it's fundamentally flawed because we have no way to specify which args to be passed to which `helm` commands being called by which `helmfile` command.
  - However, I periodically see a new user finds it's not working and reporting it as a bug([the most recent example](<https://github.com/roboll/helmfile/issues/2034#issuecomment-1147059088>)). It's not a fault of the user, but out fault that left this broken feature.
  - Every use-case previsouly covered (by any chance) with `--args` should be covered in new `helmfile.yaml` fields or flags.

## After 1.0

We won't add any backward-incompatible changes while in 1.x, as long as it's inevitable to fix unseen important bug(s).

We also quit saying [Helmfile is in its early days](<https://github.com/helmfile/helmfile#status>) in your README as... it's just untrue today.

yxxhero avatar
yxxhero

Thanks for your advice. We will think about it carefully and migrate as smoothly as possible.

# Towards Helmfile 1.0

I'd like to make 3 breaking changes to Helmfile and mark it as 1.0, so that we can better communicate with the current and future Helmfile users about our stance on maintaining Helmfile.

Note that every breaking change should have an easy alternative way to achieve the same goal achieved using the removed functionality.

## The changes in 1.0

1. Forbid the use of `environments` and `releases` within a single helmfile.yaml part
  - Helmfile currently relies on a hack called "double rendering" which no one understands correctly (I suppose) to solve the chicken-and-egg problem of rendering the helmfile template(which requires helmfile to parse `environments` as yaml first) and parsing the rendered helmfile as yaml(which requires helmfile to render the template first).
  - By forcing (or print a big warning) the user to do separate helmfile parts for `environments` and `releases`, it's very unlikely Helmfile needs double-rendering at all.
  - After this change, every helmfile.yaml written this way:

    
environments:
  default:
    values:
    - foo: bar
releases:
- name: myapp
  chart: charts/myapp
  values:
  - {{ .Values | toYaml | nindent 4 }}
    must be rewritten like:
    
environments:
  default:
    values:
    - foo: bar
---
releases:
- name: myapp
  chart: charts/myapp
  values:
  - {{ .Values | toYaml | nindent 4 }}
    It might not be a deal breaker as you already had to separate helmfile parts when you need to generate `environments` dynamically:
    
environments:
  default:
    values:
    - foo: bar
---
environments:
  default:
    values:
    - {{ .Values | toYaml | nindent 6}}}
    - bar: baz
---
releases:
- name: myapp
  chart: charts/myapp
  values:
  - {{ .Values | toYaml | nindent 4 }}
    
    If you're already using any helmfile.yaml files that are written in the first style, do start using `---` today! It will probably reveal and fix unintended template evaluations. If you start using `---` today, you won't need to do anything after Helmfile 1.0.
2. Force `.gotmpl` (or `.tpl`) file extension for `helmfile.yaml` in case you want helmfile to render it as a go template before yaml parsing.
  - As the primary maintainer of the project, I'm tired of explaining why Helmfile renders go template expressions embedded in a yaml comment. [The latest example of it](<https://github.com/helmfile/helmfile/issues/127>).
  - When we first introduced helmfile the ability to render helmfile.yaml as a go template, I did propose it to require `.gotmpl` file extension to enable the feature. But none of active helmfile users and contributors at that time agreed with it (although I didn't have a very strong opinion on the matter either), so we enabled it without the extension. I consider it as a tech debt now.

3. Remove the `--args` flag from the `helmfile` command
  - It has been provided as-is, and never intended to work reliably because it's fundamentally flawed because we have no way to specify which args to be passed to which `helm` commands being called by which `helmfile` command.
  - However, I periodically see a new user finds it's not working and reporting it as a bug([the most recent example](<https://github.com/roboll/helmfile/issues/2034#issuecomment-1147059088>)). It's not a fault of the user, but out fault that left this broken feature.
  - Every use-case previsouly covered (by any chance) with `--args` should be covered in new `helmfile.yaml` fields or flags.

## After 1.0

We won't add any backward-incompatible changes while in 1.x, as long as it's inevitable to fix unseen important bug(s).

We also quit saying [Helmfile is in its early days](<https://github.com/helmfile/helmfile#status>) in your README as... it's just untrue today.

1
mumoshu avatar
mumoshu

We might add an optional v1 mode to helmfile v0.x, while adding a big nosiy warning for a legacy helmfile.yaml. The idea is that you can use both formats for a while, so that you can migrate helmfiles one-by-one. Does that work for you?

1
z0rc3r avatar


Does that work for you?
Yes, this will be really good. Thanks

2022-10-26

ltomas avatar

Hi everyone,

Quick question: I have helmfile 0.147.0 installed (and helm 3.10.1), and whenever I run ‘helmfile deps’ it can’t generate the helmfile.lock file. The chart is local and really simple (empty for now, only a helmfile.yaml, values.yaml, Chart.yaml). Kindly find below a snip of the helmfile.yaml as well as the error message. I don’t get why it says that the ‘repositories’ block is not defined while it is, am I missing something obvious ? I checked all the open issues and can’t find anything. The setup is similar to the example given by @itscaro here https://github.com/roboll/helmfile/issues/2074. @mumoshu says that is fixed while it is not ? Not sure that is the same issue though as the example repo in the link I shared is not available.

repositories:
  - name: jetstack
    url: <https://charts.jetstack.io>

releases:
  - name: mychart
    chart: .
    namespace: mychart
    values:
      - ./values.yaml
    installed: true
    dependencies:
      - version: v1.10.0
        chart: jetstack/cert-manager
Adding repo jetstack <https://charts.jetstack.io>
"jetstack" has been added to your repositories

Updating dependency /var/folders/3r/_xtmgjd569d_lzyb3cvtmt_r0000gn/T/chartify1157961185/mychart/mychart
There are no repositories defined in your helmfile.yaml.
This means helmfile cannot update your dependencies or create a lock file.
See <https://github.com/roboll/helmfile/issues/878> for more information.

A side note: if I move the dependency block in Chart.yaml, ‘helm dep up’ works fine and generates the Chart.lock file.

ltomas avatar

For more details: my pc is Darwin arm64, the values.yaml is empty, find below the content of the Chart.yaml, and the detailed error with –enable-live-output and –debug as well.

#Chart.yaml

apiVersion: v2
name: mychart
version: 1.0.0
Live output is enabled
processing file "helmfile.yaml" in directory "."
changing working directory to "/path/to/home/test"
first-pass rendering starting for "helmfile.yaml.part.0": inherited=&{default map[] map[]}, overrode=<nil>
first-pass uses: &{default map[] map[]}
first-pass rendering output of "helmfile.yaml.part.0":
 0: repositories:
 1:   - name: jetstack
 2:     url: <https://charts.jetstack.io>
 3:
 4: releases:
 5:   - name: mychart
 6:     chart: .
 7:     namespace: mychart
 8:     values:
 9:       - ./values.yaml
10:     installed: true
11:     dependencies:
12:       - version: v1.10.0
13:         chart: jetstack/cert-manager
14:

first-pass produced: &{default map[] map[]}
first-pass rendering result of "helmfile.yaml.part.0": {default map[] map[]}
vals:
map[]
defaultVals:[]
second-pass rendering result of "helmfile.yaml.part.0":
 0: repositories:
 1:   - name: jetstack
 2:     url: <https://charts.jetstack.io>
 3:
 4: releases:
 5:   - name: mychart
 6:     chart: .
 7:     namespace: mychart
 8:     values:
 9:       - ./values.yaml
10:     installed: true
11:     dependencies:
12:       - version: v1.10.0
13:         chart: jetstack/cert-manager
14:

merged environment: &{default map[] map[]}
helm:xuSyz> v3.10.1+g9f88ccb
Adding repo jetstack <https://charts.jetstack.io>
exec: helm repo add jetstack <https://charts.jetstack.io> --force-update
"jetstack" has been added to your repositories
Chartify process for .
Successfully generated the value file at values.yaml. produced:

running helm repo list
Removing the dependencies field from the original Chart.yaml.
running helm dependency up /var/folders/3r/_xtmgjd569d_lzyb3cvtmt_r0000gn/T/chartify4103983402/mychart/mychart
Removing the dependencies field from the original Chart.yaml.
options: {false [/var/folders/3r/_xtmgjd569d_lzyb3cvtmt_r0000gn/T/helmfile462959889/mychart-mychart-values-5bdbc4876c] [] [] mychart  true false  [] true}
running helm template --debug=false --output-dir=/var/folders/3r/_xtmgjd569d_lzyb3cvtmt_r0000gn/T/chartify4103983402/mychart/mychart/helmx.1.rendered --include-crds mychart /var/folders/3r/_xtmgjd569d_lzyb3cvtmt_r0000gn/T/chartify4103983402/mychart/mychart -f /var/folders/3r/_xtmgjd569d_lzyb3cvtmt_r0000gn/T/chartify4103983402/mychart/mychart/values.yaml -f /var/folders/3r/_xtmgjd569d_lzyb3cvtmt_r0000gn/T/helmfile462959889/mychart-mychart-values-5bdbc4876c --namespace mychart
Removing the dependencies field from the original Chart.yaml.
Removed /var/folders/3r/_xtmgjd569d_lzyb3cvtmt_r0000gn/T/helmfile462959889/mychart-mychart-values-5bdbc4876c
Updating dependency /var/folders/3r/_xtmgjd569d_lzyb3cvtmt_r0000gn/T/chartify4103983402/mychart/mychart
exec: helm dependency update /var/folders/3r/_xtmgjd569d_lzyb3cvtmt_r0000gn/T/chartify4103983402/mychart/mychart
There are no repositories defined in your helmfile.yaml.
This means helmfile cannot update your dependencies or create a lock file.
See <https://github.com/roboll/helmfile/issues/878> for more information.
mumoshu avatar
mumoshu

I thought adhoc dependencies had never been included in the helmfile.lock

mumoshu avatar
mumoshu

Are you basically saying that it’s your first time to mess with helmfile.lock, to be clear?

mumoshu avatar
mumoshu

If it worked for previous versions of helmfile, it might be a bug. But if it’s your first trial, it might be that it had never been supported by helmfile

ltomas avatar

Hi @mumoshu, thanks for your reply. Well, I assume the purpose of a helmfile.lock is the usual one for lock files: locking the dependency modules to achieve reproducible builds. I therefore expected ‘helmfile deps’ to produce a lock file, as ‘helm dep up’ does. I may be wrong, could you elaborate your answer ? And I do not understand why ‘helmfile deps’ is not working anyway (error message + not generating Chart.lock and charts/), stating that no repositories are defined while it is in the helmfile.yaml. Several discussion claims that must be sufficient, as this one stated in the error message itself: https://github.com/roboll/helmfile/issues/878. I created this issue with repos to reproduce the issue: https://github.com/helmfile/helmfile/issues/474

ltomas avatar

I am running a Darwin arm64, so the earliest version available is 0.143.0 and it does work either. It may be working with earliest version though. When you say that it might be that it had never been supported by helmfile, how a sub-command to helmfile itself i.e. ‘helmfile deps’ could not be supported ? But the helmfile.lock may not be indeed.

ltomas avatar

It works too with ‘helmfile deps’ when moving the ‘dependencies’ block to Chart.yaml, it builds a Chart.lock and a charts/ folder. And yet, I still get the error message stating that no repositories defined in the helmfile.yaml

mumoshu avatar
mumoshu

Thanks. I thought Helmfile’s own dependency management system only looked to repositories and relelases[].chart, but releases[].dependencies. It’s because releases[].dependencies are handled by an external library called “chartify” and apparently it isn’t integrated to the helmfile’s dependency management system. I do see one thing to be fixed from your report. helmfile.lock should be changed to include dependencies from releases[].dependencies.

mumoshu avatar
mumoshu

However, for Chart.lock, this might be the correct way forward.
moving the ‘dependencies’ block to Chart.yaml, it builds a Chart.lock and a charts/ folder

mumoshu avatar
mumoshu
releases[].dependencies are handled outside of helm, the helm chart and hence Chart.yaml and Chart.lock. So it’s natural that releases[].dependencies aren’t shown in Chart.lock. releases[].dependencies are not a way to in-place update the local chart. It’s a general mechanism to inject adhoc dependencies to the local/remote chart immediately before running helm [templateinstallupgrade].
ltomas avatar

Hi Mumoshu, sorry for the delay I have been very busy. Thanks for you reply, it helped to understand some things as I expected helmfile to work the same as helm regarding releases[].dependencies. Yes that is normal that the helm dependencies are not included into the helmfile.lock managing the helmfile charts. But I was expected the releases[].dependencies to be included into the helmfile.lock, simillarly to the helm behaviour into the Chart.lock. There is a ‘work-around’ though, which is to include all the dependencies as single helmfile charts and use ‘needs’ to install the charts before your own local chart. In this way you have a fixed version for all dependencies, and you don’t need to create an umbrella chart to put your dependencies into the Chart.yaml or to put the dependencies in the Chart.yaml of your local Chart.yaml. As you suggested, I don’t think that releases[].dependencies have ever been included into the helmfile.lock, which is very confusing and in my view should be, or this feature should be removed (in which case unlocked dependencies would be used ? ) to only allow the ‘work-around’

2022-10-30

    keyboard_arrow_up