From 8fd634cb385e11d3498a99bfdfe566ff0919b581 Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Sun, 29 Jan 2023 11:39:00 +0200 Subject: [PATCH] somefixs --- .../tests/cronjob_standalone/default_test.yaml | 3 +-- library/common-test/values.yaml | 13 +++++++++++++ library/common/1.0.0/templates/lib/job/_jobPod.tpl | 2 +- .../1.0.0/templates/spawner/_jobAndCronJob.tpl | 5 ++--- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/library/common-test/tests/cronjob_standalone/default_test.yaml b/library/common-test/tests/cronjob_standalone/default_test.yaml index 11a16770bf..6846744362 100644 --- a/library/common-test/tests/cronjob_standalone/default_test.yaml +++ b/library/common-test/tests/cronjob_standalone/default_test.yaml @@ -79,9 +79,8 @@ tests: path: spec.jobTemplate.spec.template.spec.imagePullSecrets - isNull: path: spec.jobTemplate.spec.template.spec.runtimeClassName - - equal: + - isNull: path: spec.jobTemplate.spec.template.spec.terminationGracePeriodSeconds - value: 10 - equal: path: spec.jobTemplate.spec.template.spec.containers[0].name value: RELEASE-NAME-common-test-job-main diff --git a/library/common-test/values.yaml b/library/common-test/values.yaml index 67cebbb6ff..f1ec7e5ff5 100644 --- a/library/common-test/values.yaml +++ b/library/common-test/values.yaml @@ -3,3 +3,16 @@ service: ports: main: port: 65535 +controllers: + main: + type: CronJob + schedule: "* * * * *" + pod: + containers: + main: + securityContext: + runAsUser: 1000 + runAsGroup: 1000 + capabilities: + add: + - something diff --git a/library/common/1.0.0/templates/lib/job/_jobPod.tpl b/library/common/1.0.0/templates/lib/job/_jobPod.tpl index 7cb4685d5c..e4933e14d0 100644 --- a/library/common/1.0.0/templates/lib/job/_jobPod.tpl +++ b/library/common/1.0.0/templates/lib/job/_jobPod.tpl @@ -189,7 +189,7 @@ {{- end -}} {{- end -}} {{- else -}} {{/* Otherwise use the job's podSecCont values (if empty, will use the global defaults) */}} - {{- with (include "ix.v1.common.container.podSecurityContext" (dict "podSecCont" $values.podSecurityContext "root" $root "isJob" true) | trim) -}} + {{- with (include "ix.v1.common.container.podSecurityContext" (dict "podSecCont" $root.Values.podSecurityContext "root" $root "isJob" true) | trim) -}} {{- $secCont = . -}} {{- end -}} {{- end -}} diff --git a/library/common/1.0.0/templates/spawner/_jobAndCronJob.tpl b/library/common/1.0.0/templates/spawner/_jobAndCronJob.tpl index ca99b7c583..7f6494b10e 100644 --- a/library/common/1.0.0/templates/spawner/_jobAndCronJob.tpl +++ b/library/common/1.0.0/templates/spawner/_jobAndCronJob.tpl @@ -18,9 +18,9 @@ {{/* Add the .Values as the main container and as pod */}} {{/* This needs some redesign tbh */}} - {{- $_ := set $jobValues "podSpec" (mustDeepCopy $.Values) -}} + {{- $_ := set $jobValues "podSpec" (mustDeepCopy $.Values.controllers.main) -}} {{- $_ := set $jobValues.podSpec "containers" dict -}} - {{- $_ := set $jobValues.podSpec.containers "main" .Values -}} + {{- $_ := set $jobValues.podSpec.containers "main" .Values.controllers.main.pod.containers.main -}} {{- $_ := set $jobValues.podSpec.containers.main "enabled" "true" -}} {{/* Add labels/annotations if any. */}} @@ -46,7 +46,6 @@ {{- end -}} {{/* Add $jobValues to a "main" $job, now the spawner has the "usual" format */}} {{- $_ := set $jobs "main" $jobValues -}} - {{- else -}} {{/* If it's not "standalone" Use the jobs dict */}}