What is the precedence setting of various helm values in an ArgoCD Application manifest?
Asked Answered
S

2

5

I'm trying to generate kubernetes manifests from local ArgoCD manifests that use helm. I'm using a script to parse values and then helm template to generate the resulting template. But I'm having trouble converting the different values into a single template based on precedence

ArgoCD's documentation describes 3 different ways to inject values into a helm chart. Namely valueFiles, in-line values and helm parameters.

For example if i have this argo application manifest containing all three:

apiVersion: argoproj.io/v1alpha1
kind: Application
...
source:
  helm:
    parameters:
    - name: "param1"
      value: value1
    values: |
      param1: value2
    valuesFile:
    - values-file-1.yaml
    - values-file-2.yaml

and let's say this is the contents of: values-file-1.yaml

param1: value4

values-file-2.yaml

param1: value5

what will param1 ultimately be when this manifest is deployed on argocd? and what will the precedence be amongst all the values?

I tried looking at documentation but wasn't able to find it

Storer answered 21/7, 2023 at 16:57 Comment(0)
S
6

I spent a few hours deploying Argocd with helm and producing manifests.

Values injections have the following order of precedence

  1. valueFiles
  2. values
  3. parameters

so values trumps valueFiles, and parameters trump both.

And then out of curiosity I played within each of those injection types and essentially they resolve conflicts by choose the last value from top to bottom.

e.g. if we only have values-file-1.yaml and it contains

param1: value1
param1: value3000

we get param1=value3000

if we have

valuesFile:
  - values-file-2.yaml
  - values-file-1.yaml

the last values-file i.e. values-file-1.yaml will trump the first

if we have

parameters:
  - name: "param1"
    value: value2
  - name: "param1"
    value: value1

the result will be param1=value1

and finally if we have

values: |
  param1: value2
  param1: value5

the result will be param1=value5

This may be obvious for some people but it wasn't for me

Storer answered 22/7, 2023 at 6:10 Comment(2)
If you want to put up a docs PR, I'd happily review. I know a lot of folks have wondered this.Alfano
What if one introduces "valuesObject"? Say there is helm.valueFiles, helm.parameters and helm.valuesObject, all three? What takes precedence?Jakob
G
1

Values injections have the following order of precedence

    lowest  -> ./values.yaml
            -> valueFiles
            -> values
            -> valuesObject
    highest -> parameters

argocd helm user-guide doc

Gynecologist answered 19/9, 2024 at 17:30 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.