diff --git a/src/main/helm/templates/_helpers.tpl b/src/main/helm/templates/_helpers.tpl index b3a576dd8c199c1070ddf3cfdac16b2c716328f3..10b786e54ef44f05cbf6471db5c915ac1213b893 100644 --- a/src/main/helm/templates/_helpers.tpl +++ b/src/main/helm/templates/_helpers.tpl @@ -69,24 +69,6 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} {{- end -}} {{- end -}} -{{- define "app.resources" }} -{{- if eq (include "app.kopEnvironment" . ) "prod" }} - limits: - cpu: "500m" - memory: "1000Mi" - requests: - cpu: "50m" - memory: "250Mi" -{{- else }} - limits: - cpu: "500m" - memory: "1000Mi" - requests: - cpu: "50m" - memory: "250Mi" -{{- end }} -{{- end -}} - {{- define "app.ingress.host" }} {{- if eq (.Values.image).name "formsolutions-adapter" }} {{- printf "%s-fs.%s" (include "app.kopBezeichner" .) .Values.baseUrl }} diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml index 48bca75d60711118fc724a4885e628c0143e8801..9b5b7c082e139e660858b4605c016abdb31e44bd 100644 --- a/src/main/helm/templates/deployment.yaml +++ b/src/main/helm/templates/deployment.yaml @@ -111,7 +111,9 @@ spec: successThreshold: 1 timeoutSeconds: 5 resources: - {{- include "app.resources" . | indent 8 }} + {{- with .Values.resources }} +{{ toYaml . | indent 10 }} + {{- end }} securityContext: allowPrivilegeEscalation: false privileged: false diff --git a/src/test/helm/deployment_resources_test.yaml b/src/test/helm/deployment_resources_test.yaml index 588505e7ed340abef50404ea1ec69a6848fbc8d4..699cc71922b26daf35c56a4488861a2bcedba920 100644 --- a/src/test/helm/deployment_resources_test.yaml +++ b/src/test/helm/deployment_resources_test.yaml @@ -24,42 +24,32 @@ suite: test deployment release: - name: afm_adapter + name: afm-adapter templates: - templates/deployment.yaml tests: - it: test resources for prod environment - release: - namespace: sh-helm-prod set: kop.environment: prod + resources: + limits: + cpu: "11m" + memory: "22Mi" + requests: + cpu: "33m" + memory: "44Mi" asserts: - equal: path: spec.template.spec.containers[0].resources.limits.cpu - value: 500m + value: 11m - equal: path: spec.template.spec.containers[0].resources.limits.memory - value: 1000Mi + value: 22Mi - equal: path: spec.template.spec.containers[0].resources.requests.cpu - value: 50m + value: 33m - equal: path: spec.template.spec.containers[0].resources.requests.memory - value: 250Mi - - it: test default resources - release: - namespace: sh-helm-test - asserts: - - equal: - path: spec.template.spec.containers[0].resources.limits.cpu - value: 500m - - equal: - path: spec.template.spec.containers[0].resources.limits.memory - value: 1000Mi - - equal: - path: spec.template.spec.containers[0].resources.requests.cpu - value: 50m - - equal: - path: spec.template.spec.containers[0].resources.requests.memory - value: 250Mi + value: 44Mi +