helmsman icon indicating copy to clipboard operation
helmsman copied to clipboard

Conditionally enable apps

Open EmandM opened this issue 3 years ago • 4 comments

Currently the enable flag just takes a straight boolean as to whether the chart is enabled or not. It would be nice to have a conditional option, based on a runtime argument the app will be conditionally enabled or disabled.

EmandM avatar Jul 29 '22 19:07 EmandM

There is something that will do such job just fine: env vars in DSF

An example:

---
apps:
  my-app:
    enabled: $MY_APP_ENABLED
    secretsFiles:
      - "../values/[...].yaml"
MY_APP_ENABLED=(true|false) helmsman -spec [...]

It's up to you wether it's true or false in the end, so that is the place where you can use your conditions. Sounds enough?

mkubaczyk avatar Aug 01 '22 05:08 mkubaczyk

It would be preferable to have something similar to Helm's feature to conditionally enable sub-charts. Linking to a variable in the values.yaml or something similar. Specifically I'm looking for something that would allow us to enable different charts based on environment.

Helm's solution looks like this

apiVersion: v2
name: myapplication
description: A Helm chart for Kubernetes
type: application

dependencies:
  - name: apidocs
    condition: apidocs.enabled

So I'd be looking for something like this

apps:
  my-app:
    enabled: myapp.enabled
    valuesFiles:
      - "../values/[...].yaml"

EmandM avatar Aug 09 '22 14:08 EmandM

Though I am aware that the structure of helmsman might make this unfeasible

EmandM avatar Aug 09 '22 14:08 EmandM

As Mateusz mentioned, you can use env variables for this. Another alternative, you can use YAML anchors, something like this:

apps:
  my-app:
    enabled: &myappEnabled true
    secretsFiles:
      - "../values/[...].yaml"
  otherapp:
    enabled: *myappEnabled
    secretsFiles:
      - "../values/[...].yaml"

with way whenever you disable my-app the otherapp will also be disabled.

luisdavim avatar Sep 01 '22 21:09 luisdavim

This issue has been marked stale due to an inactivity.

github-actions[bot] avatar Nov 01 '22 05:11 github-actions[bot]