#helmfile (2024-03)

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/

2024-03-20

Balazs Varga avatar
Balazs Varga

I have a boolean env that I would like to check with installedTemplates: when true I can check with :

installedTemplate: '{{ and (eq .Environment.Name "dev" "qa") `{{ .Values.app.use_host }}` }}'

how can I negate the {{ .Values.app.use_host }} check ?

bradym avatar

What are you trying to do? I don’t think this is what you’re looking for, but you can use not:

installedTemplate: '{{ not (and (eq .Environment.Name "dev" "qa")) `{{ .Values.app.use_host }}` }}'
Balazs Varga avatar
Balazs Varga

I am trying to deploy an app only if I set an env to true or got a result from configmap what is true and the helmfile env is dev or qa

Balazs Varga avatar
Balazs Varga

and I have a different app that I need to deploy when I did not deploy this app

bradym avatar

That’s way more logic than I’d try to put in a helmfile. I recommend putting that in a script of some sort and setting a couple state variables when it calls helmfile. Some pseudocode:

I’ll call your apps A and B:

if ENV_DEPLOY_APP_A == true || ( env in (dev, qa) && CONFIGMAP_DEPLOY_APP_A == true) {
  DEPLOY_APP_A=true
  DEPLOY_APP_B=false
else
  DEPLOY_APP_A=false
  DEPLOY_APP_B=true

helmfile apply --state-values-set deployAppA=${DEPLOY_APP_A} --state-values-set deployAppB=${DEPLOY_APP_B}

In your helmfile for app a
  
installedTemplate: {{ eq .StateValues.deployAppA, "true" }}

In your helmfile for app b:

installedTemplate: {{ eq .StateValues.deployAppB, "true" }}
Balazs Varga avatar
Balazs Varga

thanks

    keyboard_arrow_up