I have a OpenShift/Kubernetes new cluster and I need to create multiple ResourceQuota(s) and apply them to existing projects.
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.
I created a new custom Helm Chart with the command
helm template resourcequota
and I see Helm creating the following files:
.
..
.helmignore
Chart.yaml
charts
templates
values.yaml
I then wrote a resourcequota.yaml in the templates folder. I would like helm to fill the ResourceQuota specs for me:
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 }}
The values.yaml file contains a first namespace name with sample values:
...
83 ...
84 namespace: "123-testnamespace"
85 requests:
86 cpu: "2"
87 memory: "1Gi"
88 limits:
89 cpu: "2"
90 memory: "1Gi"
I then asked Helm to locally generate a template with helm template resourcequota but it seems he doesn't know the namespace key (row 84):
Error: cannot load values.yaml: error converting YAML to JSON: yaml: line 84: did not find expected key
What am I doing wrong ? I tried to write the values.yaml from scratch but it seems like I am missing out some helm fundamentals here.
Thank you in advance