Skip to content

Single app multi envs

[source]

When we work with helm sometimes we need dynamics chose environment.

export CI_ENVIRONMENT_NAME=stage
helm upgrade --install my-release my-chart-repo/my-chart-app -f values/_.yml -f values/$CI_ENVIRONMENT_NAME.yaml

Project structure

.
├── helmwave.yml.tpl
└── values
    ├── _.yml
    ├── prod.yml
    ├── qa.yml
    └── stage.yml

helmwave.yml.tpl

version: 0.18.0

releases:
  - name: my-release
    chart:
      name: my-chart-repo/my-chart-app
    # yaml says "Who is the last one is right."
    values:
      # Default
      - values/_.yml
      # For specific ENVIRONMENT
      - values/{{ requiredEnv "CI_ENVIRONMENT_NAME" }}.yml
    create_namespace: true

_.yml

image:
  tag: {{ env "pass-git-tag" }}

podAnnotations:
  gitCommit: {{ requiredEnv "pass-git-commit" | quote }}

prod.yml

replicaCount: 6

qa.yml

replicaCount: 2

stage.yml

replicaCount: 4

Run

export CI_ENVIRONMENT_NAME=stage
helmwave yml
helmwave build
helmwave up

or one command

helmwave up --build --yml