Skip to content

It should be possible to override all values using a values file

In #29 we found that --set takes priority over --values, even when --values comes after --set.

This means that some values cannot be customized using .gitlab/auto-deploy-values.yaml

Steps to reproduce

Clone auto-deploy-app locally, add a file custom-value.yaml with the contents

# custom-value.yaml
image:
  pullPolicy: HELLO WORLD

First, confirm that it works without --set:

helm dependency build .
helm template . --values custom-value.yaml | grep imagePullPolicy

which outputs

        imagePullPolicy: ""
        imagePullPolicy: HELLO WORLD

Then add a --set:

helm template . --set image.pullPolicy=ECHO --values custom-value.yaml | grep imagePullPolicy

and we get

        imagePullPolicy: ""
        imagePullPolicy: ECHO

i.e. --set took priority over --values.

Proposed solution

Since --values files are merged from left-to-right, we could set all arguments using a dynamically built values file and never use --set

Do this using a small program written in ruby or go that scrapes the environment, turning the helm upgrade command into something like

scrape-environment > "$environment_values_file"

helm upgrade --install \
    "${atomic_flag[@]}" \
    --wait \
    --values "$environment_values_file" \
    "${modsecurity_set_args[@]}" \
    "${helm_values_args[@]}" \
    $HELM_UPGRADE_EXTRA_ARGS \
    --namespace="$KUBE_NAMESPACE" \
    "$name" \
    chart/
Edited by Hordur Freyr Yngvason