<p>I have a OpenShift/Kubernetes new cluster and I need to create multiple ResourceQuota(s) and apply them to existing projects.</p>
<p>Every ResourceQuota should be applied to a given namespace and should contain a specific number of requests and limits.
I would like to generate all the needed ResourceQuota YAMs and deploy them by using Helm.</p>
<p>I created a new custom Helm Chart with the command</p>
<pre><code>helm template resourcequota
</code></pre>
<p>and I see Helm creating the following files:</p>
<pre><code>    .
..
.helmignore
Chart.yaml
charts
templates
values.yaml
</code></pre>
<p>I then wrote a <code>resourcequota.yaml</code> in the <code>templates</code> folder. I would like helm to fill the ResourceQuota specs for me:</p>
<pre><code>apiVersion: v1
kind: ResourceQuota
metadata:
  name: {{ .Values.namespace }}-quota
  namespace: {{ .Values.namepace }}
spec:
  hard:
    cpu: {{ .Values.namespace.requests.cpu }}
    limits.cpu: {{ .Values.namespace.limits.cpu }}
    memory: {{ .Values.namespace.requests.memory }}
    limits.memory: {{ .Values.namespace.limits.cpu }}
</code></pre>
<p>The <code>values.yaml</code> file contains a first namespace name with sample values:</p>
<pre><code>...
83 ...
84 namespace: &quot;123-testnamespace&quot;
85   requests:
86     cpu: &quot;2&quot;
87     memory: &quot;1Gi&quot;
88   limits:
89     cpu: &quot;2&quot;
90     memory: &quot;1Gi&quot;
</code></pre>
<p>I then asked Helm to locally generate a template with <code>helm template resourcequota</code> but it seems he doesn't know the namespace key (row 84):</p>
<p><code>Error: cannot load values.yaml: error converting YAML to JSON: yaml: line 84: did not find expected key</code></p>
<p>What am I doing wrong ? I tried to write the <code>values.yaml</code> from scratch but it seems like I am missing out some helm fundamentals here.</p>
<p>Thank you in advance</p>

lsambo
<blockquote>
<p>it seems like I am missing out some helm fundamentals here</p>
</blockquote>
<p>True, As mentioned in error there is an issue at line 84</p>
<pre><code>84 namespace: &quot;123-testnamespace&quot;
85   requests:
86     cpu: &quot;2&quot;
87     memory: &quot;1Gi&quot;
88   limits:
89     cpu: &quot;2&quot;
90     memory: &quot;1Gi&quot;
</code></pre>
<p>basic YAML can not create an array of value and use it as key also.</p>
<p>You should have to use the values.yaml like</p>
<pre><code>  namespacename : &quot;123-testnamespace&quot;
  namespace:
    requests:
      cpu: &quot;2&quot;
      memory: &quot;1Gi&quot;
    limits:
      cpu: &quot;2&quot;
      memory: &quot;1Gi&quot;
</code></pre>
<p><strong>YAML template</strong></p>
<p>Using change at <strong>name</strong> &amp; <strong>namespace</strong> values in template</p>
<pre><code>apiVersion: v1
kind: ResourceQuota
metadata:
  name: {{ .Values.namespacename }}-quota
  namespace: {{ .Values.namespacename }}
spec:
  hard:
    cpu: {{ .Values.namespace.requests.cpu }}
    limits.cpu: {{ .Values.namespace.limits.cpu }}
    memory: {{ .Values.namespace.requests.memory }}
    limits.memory: {{ .Values.namespace.limits.cpu }}
</code></pre>
<p>Example of nested <strong>YAML</strong></p>
<pre><code>cartParams:
  - title: Test 1
    options:
      - Oh lala
      - oh lalalalala
  - title: Title test 2
    options:
      - oh lala
      - oh lala
      - oh lalala
      - oh lalalalalalalala
      - oh lalalalalalalalalala
</code></pre>
