#helmfile - December 2020

December 2020
Anthony Voutas
Anthony Voutasalmost 6 years ago
Question, I know there’s a way to mount a configMap as a volume in a helm chart and overwrite a specific file on the docker image. Is there a way to append to a file instead?
Ievgenii Shepeliuk
Ievgenii Shepeliukalmost 6 years ago
Hi all,
why does helmfile apply not removing releases that are removed from helmfile.yaml ?
Is there a way to implement such behaviour ?

PS: i know about installed: false , but I'd like to make releases be removed just by removing them from helmfile.yaml
Ievgenii Shepeliuk
Ievgenii Shepeliukalmost 6 years ago
Hi, all
Does helmfile support OCI ? If yes - where one could read about it
https://helm.sh/docs/topics/registries/
Gus Narea
Gus Nareaalmost 6 years ago
Hey folks. How can I get Helmfile to recreate pods in a chart if and only if there's a new release of that chart? Note I want pods to be recreated if the chart values changed but the chart is the same, and I don't want to recreate pods on every single helmfile apply.

That means I can't rely on the hash of the configmaps/secrets (those won't change if I'm just changing values without changing templates), and I don't want to include an annotation that generates a random value (because that'd cause a diff according to helm diff and helmfile will do a release).
Gus Narea
Gus Nareaalmost 6 years ago
This would be dead simple if I could just use .Release.Version in a pod annotation but that doesn't seem to exist
Kevin
Kevinalmost 6 years ago(edited)
Hello, was hoping to get some suggestions how to implement this use case with helmfile:

I need to deploy a bunch of different in-house applications that are all configured very similarly. Generally speaking the only changes between the app deployments are the docker image/tag, environment variables, and maybe some additional k8s resources. I've created a generic base helm chart which uses a values.yaml file to specify image/tag, and environment vars. For each app I can then create an app-specific chart (using the base chart as a subchart) with any additional k8s templates and a values file to configure the chart/base-chart's templates. Using helmfile I can then add on additional values files for each release.

The challenge I'm facing is that the environment variables are set in the base chart via a values file and I would like to render them based on app-specific and release-specific values files. So roughly I am trying to evaluate chart-default-values.yaml, release-specific-values.yaml and then use the data from those inside a final values file which sets variables for the base chart's templates.

This is roughly asking how to use .Values in a values file, which as best I can tell from my reading on Github is not supported. I've taken a look through these issues to try to get ideas however I'm a bit stuck.

• https://github.com/roboll/helmfile/issues/756
• https://github.com/roboll/helmfile/issues/387
I did get something working for a single release by taking the approach below, however this doesn't scale once I want to add additional releases to different namespaces in k8s or different environments:

# chart-default-values.yaml
logLevel: error
baseChart:
  environment: ""

# release-specific-values.yaml
logLevel: debug

# helmfile.yaml
environments:
  defaults:
    values:
    # Read the values into the environment so they are accessible in the inline-values below.
    - ./chart-default-values.yaml
    - ./release-specific-values.yaml

releases:
  - name: "some-app"
    namespace: "my-namespace"
    chart: .
    values:
      - ./chart-default-values.yaml
      - ./release-specific-values.yaml
      # Set the environment vars inline referencing values from the environment
      - baseChart:
          environment: |-
            export MYAPP_LOG_LEVEL={{ .Values.logLevel | quote }}

Last thing: I also considered setting the environment variables directly in the release-specific values file however that is not DRY and also causes issues if I want to set chart-wide defaults.

Any advice?
Christian
Christianalmost 6 years ago
Hey everyone, been setting up terraform and helmfile to manage our K8s cluster. How do you guys manage terraform created resources and pass it to helmfile? I ideally would not want to hardcode any endpoints that I need in my yaml files. I explored using the helm provider of Terraform but it made sense to me to manage my cluster using helmfile.

Currently, I have this setup where terraform publishes everything that I need for helmfile to consume to SSM (IAM roles for service accounts, RDS endpoints), and then I use the remote-secrets feature of helmfile to get the values. This is also how I manage secrets by just using SecureString.

Just curious if this is the right way to go? Any cons of this setup? Currently it looks like I'm setting myself up to shoving everything to SSM lol
Balazs Varga
Balazs Vargaalmost 6 years ago(edited)
hello all, if I have dfata in helmfile.d like
app:
  name:
  image:
  path:

can I somehow include all options under app: to the values under config and not one by one ?
Jim
Jimalmost 6 years ago
I'm switching from Helm-2 to Helm-3 and a Helmfile hook that works with Helm-2 is failing with Helm3 and I'm not sure why.
Paul Catinean
Paul Catineanalmost 6 years ago
Anyone know why the incubator chart is deprecated? 🤔
Paul Catinean
Paul Catineanalmost 6 years ago
Or just the previous locations only?
Paul Catinean
Paul Catineanalmost 6 years ago
incubator/raw                                 	0.2.5        	0.2.3                       	DEPRECATED A place for all the Kubernetes resou..
bazbremner
bazbremneralmost 6 years ago
@Paul Catinean yes, see https://github.com/helm/charts
muhaha
muhahaalmost 6 years ago(edited)
Any idea how to escape {{ $labels.target }} string?
Its prometheus specific:
values:
    - prometheusRule:
        enabled: true
        rules:
          - alert: UrlDown
            annotations:
              message: The status code of {{ $labels.target }} is 4xx or 5xx, or some other failure occurred such as a timeout (60 seconds) for the last 5 minutes.
            expr: probe_http_status_code >= 400 or probe_http_status_code == @Vinit Sarvade 08 

I tried
 {{`{{ $labels.target }}`}}

, but still getting undefined variable "$labels"
Any idea @mumoshu?
Thanks
muhaha
muhahaalmost 6 years ago(edited)
Any idea how to render multiline string in values ?
environments:
  default:
    values:
      - foo: |
          hello world
          bye

to
foo: |
  hello world
  bye 

Thanks
Joaquin Menchaca
Joaquin Menchacaalmost 6 years ago
I haven't touched helmfile in a while, and I was wondering if any good examples out there for using:
• environments in helm/helmfile
• kustomize in helmfile
Ievgenii Shepeliuk
Ievgenii Shepeliukalmost 6 years ago(edited)
Hi, all when using vals for value resolution, it it possible to disable the actual resolution when calling
$ helmfile template
via helmfile.yaml or CLI argument ?

for instance, I don't have an access to production Hashcorp Vault, but I want to render templates locally for testing
Ion
Ionalmost 6 years ago(edited)
Hi, all!

Is it possible to do something like that in helmfile:

templates:
  default: &default
    namespace: test
    chart: repo/{{ .Release.Name }}

    {{- range $service, $version := .Values.release }}
    {{- if eq $service .Release.Name }}
    version: "{{ $version }}"
    {{- end }}
    {{- end }}

where the .Values would be
release:
  my-service:
    version: 1.0.0

?

I’m getting a failed to read helmfile.yaml: reading document at index 1: yaml: line 11: could not find expected ‘:’
Joaquin Menchaca
Joaquin Menchacaalmost 6 years ago
How can I set values in values.yaml file?

e.g.
releases:
  - name: prometheus
    namespace: default
    chart: prometheus-community/kube-prometheus-stack
    values:
      - ./alertmanager.yaml
    disableValidation: true

So the alertmanger.yaml would have a value in there, like {{ requiredEnv "PAGERDUTY_INTEGRATION_KEY" }}
Joaquin Menchaca
Joaquin Menchacaalmost 6 years ago
Despite specifying:
disableValidation: true
I am getting:
  Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: [ValidationError(Prometheus.spec): unknown field "probeNamespaceSelector" in com.coreos.monitoring.v1.Prometheus.spec, ValidationError(Prometheus.spec): unknown field "probeSelector" in com.coreos.monitoring.v1.Prometheus.spec]

What can I do?
Ion
Ionalmost 6 years ago
So, one more interesting question from me.

Suppose I have a release that installs CRDS. And I have a release that depends on those CRDS. How can I make the dependency between them to work without running helmfile 2 times?
jason witkowski
jason witkowskialmost 6 years ago
Hey All, wondering if anyone has seen any issues around helmfile and its storage of helm meta-data? We have been testing our helmfile from our local workstations but our ci/cd pipeline executes helmfile from within a k8s cluster and I seem to be finding that when doing the latter the helm release meta-data is not going to the release namespace but instead going to the default namespace instead because that is where the job is executing
Christian
Christianalmost 6 years ago
Hey everyone, also have a query about having dependencies between charts.
I know you can have a needs keyword as part of the helmfile release to maintain dependencies. However, I can't seem to figure out the syntax as to how to reference a release when they are in different folders.

- cert-manager
   / helmfile.yaml
- cert-issuer
   / helmfile.yaml

In cert-issuer, having a needs: ['cert-manager/cert-manager'] errors out. Also tried various combinations, but none seem to work.
DnR-iData
DnR-iDataalmost 6 years ago(edited)
Hi everyone,

Before creating my own argocd+helmfile docker image, I would like to know if someone already did it and published it public ?
I found chatwork image but not really up to date with helmfile version.

And if worked like a charm (helmfile with argocd) ?

Thx a lot
Balazs Varga
Balazs Vargaalmost 6 years ago
hello all,
Balazs Varga
Balazs Vargaalmost 6 years ago
I am writing a hpa file for my cluster and would like to template it.
if I have the following metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 70
  - type: Resource
    resource:
      name: memory
      target:
        type: Utilization
        averageUtilization: 70

can I template it into the hpa.yaml using range or something else?
I would like to get all metrics from values. so if I would like to use the pod or object metrics I only need to update values
Joaquin Menchaca
Joaquin Menchacaalmost 6 years ago
I cannot get environments to work as documented. From the docs (README.md), I tried:

environments:
  ## `default' environment uses Alpha with TLS
  ## set tls_client_auth with env var TLS_CLIENT_AUTH
  default:
    values:
      - ./examples/alpha_tls.yaml.gotmpl
      - ./examples/{{ env "TLS_DIR" | default "dgraph_tls" }}//secrets.yaml
  ## 'zero_tls' environment uses Zero with TLS
  zero_tls:
    values:
      - ./examples/zero_tls.yaml.gotmpl
      - ./examples/{{ env "TLS_DIR" | default "dgraph_tls" }}//secrets.yaml

releases:
  - name: {{ env "RELEASE" | default "my-release" }}
    namespace: {{ env "NAMESPACE" | default "default" }}
    chart: {{ env "PWD" }}/../../charts/dgraph

But the helmfile apply doesn't pick up default environment.
Joaquin Menchaca
Joaquin Menchacaalmost 6 years ago
I guess these are values you can inject and picked up by .Values.key, but not actual helm values, rather helmfile values
Emmanuel
Emmanuelalmost 6 years ago(edited)
Hi everyone,
i'm trying to see if we can use url to get values for a release: (like with helmfiles: keyword)
releases:
  - name: app
    chart: ../chart/test
    values:
      - git::<https://github.com/><something>.yaml   # << like this ?
helmfiles:
  - path: git::<https://github.com/><something>/helmfile.yaml # similar to this