<p>I'm trying to generate kubernetes manifests from local ArgoCD manifests that use helm. I'm using a script to parse values and then <code>helm template</code> to generate the resulting template. But I'm having trouble converting the different values into a single template based on precedence</p>
<p>ArgoCD's documentation describes <a href="https://argo-cd.readthedocs.io/en/stable/user-guide/helm/" rel="nofollow noreferrer">3 different ways</a> to inject values into a helm chart. Namely <code>valueFiles</code>, in-line <code>values</code> and helm <code>parameters</code>.</p>
<p>For example if i have this argo application manifest containing all three:</p>
<pre><code>apiVersion: argoproj.io/v1alpha1
kind: Application
...
source:
  helm:
    parameters:
    - name: &quot;param1&quot;
      value: value1
    values: |
      param1: value2
    valuesFile:
    - values-file-1.yaml
    - values-file-2.yaml
</code></pre>
<p>and let's say this is the contents of:
values-file-1.yaml</p>
<pre><code>param1: value4
</code></pre>
<p>values-file-2.yaml</p>
<pre><code>param1: value5
</code></pre>
<p>what will <code>param1</code> ultimately be when this manifest is deployed on argocd?
and what will the precedence be amongst all the values?</p>
<p>I tried looking at documentation but wasn't able to find it</p>

Erich Shan
<p>I spent a few hours deploying Argocd with helm and producing manifests.</p>
<p>Values injections have the following order of precedence</p>
<ol>
<li>valueFiles</li>
<li>values</li>
<li>parameters</li>
</ol>
<p>so values trumps valueFiles, and parameters trump both.</p>
<p>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.</p>
<p>e.g. if we only have <code>values-file-1.yaml</code> and it contains</p>
<pre><code>param1: value1
param1: value3000
</code></pre>
<p>we get param1=value3000</p>
<p>if we have</p>
<pre><code>valuesFile:
  - values-file-2.yaml
  - values-file-1.yaml
</code></pre>
<p>the last values-file i.e. <code>values-file-1.yaml</code> will trump the first</p>
<p>if we have</p>
<pre><code>parameters:
  - name: &quot;param1&quot;
    value: value2
  - name: &quot;param1&quot;
    value: value1
</code></pre>
<p>the result will be param1=value1</p>
<p>and finally if we have</p>
<pre><code>values: |
  param1: value2
  param1: value5
</code></pre>
<p>the result will be param1=value5</p>
<p>This may be obvious for some people but it wasn't for me</p>
