Add flag to ignore default resources for containers (#52)

This commit is contained in:
Marcel Lambacher
2022-09-12 08:55:05 +02:00
committed by GitHub
parent 51ba51320a
commit 966f0672c7
3 changed files with 30 additions and 0 deletions
@@ -96,8 +96,10 @@ spec:
{{- end }}
{{- end }}
{{- include "common.volumeMountsRef.tpl" . | nindent 10 }}
{{- if not .Values.resources.ignore }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- end }}
{{- if .Values.sidecar }}
- name: {{ template "robustName" .Release.Name }}-sidecar
securityContext: *securityContext
@@ -0,0 +1,18 @@
suite: test deployment
templates:
- deployment.yaml
- configmap.yaml
tests:
- it: Should render resoucres if not ignored by default
set:
{}
asserts:
- isNotNull:
path: spec.template.spec.containers[0].resources
- it: Should ignore resources if ignore flag is set
set:
resources:
ignore: true
asserts:
- isNull:
path: spec.template.spec.containers[0].resources
+10
View File
@@ -226,6 +226,16 @@
],
"required": [],
"properties": {
"ignore": {
"$id": "#/properties/resources/properties/ignore",
"type": "boolean",
"title": "Ignore",
"description": "If set to true, resource configuration will be ignored",
"default": false,
"examples": [
true
]
},
"requests": {
"$id": "#/properties/resources/properties/requests",
"type": "object",