Skip to content

Single app multi envs

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
project: "Example: single app multi envs"
version: "0.39.1"

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

Common values for all envs

image:
  tag: v1.0.0

replicaCount: 1

replicaCount: 6
replicaCount: 2
replicaCount: 4

step 0: templating

export CI_ENVIRONMENT_NAME=stage
helmwave yml

You will get next helmwave.yml:

helmwave.yml
project: "Example: single app multi envs"
version: "0.39.1"

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/stage.yml
    create_namespace: true