From 105d648ad45cf44f8512539a32e3597039ef0dd2 Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Sat, 28 Jan 2023 18:42:11 +0200 Subject: [PATCH] move values around --- .../fixedEnv_test.yaml | 24 +- .../tests/deployment/runtimeClass_test.yaml | 9 +- .../deployment/volume_hostPath_test.yaml | 45 ++-- ...itional_containers_in_deployment_test.yaml | 5 +- ...containers_in_deployment_install_test.yaml | 5 +- ...containers_in_deployment_upgrade_test.yaml | 5 +- ...install_containers_in_deployment_test.yaml | 5 +- ...containers_in_deployment_install_copy.yaml | 5 +- ...upgrade_containers_in_deployment_test.yaml | 5 +- .../tests/jobs/cronJobSpecContainer_test.yaml | 5 +- .../tests/jobs/jobSpecContainer_test.yaml | 5 +- library/common-test/tests/pvc/pvc_test.yaml | 32 +-- .../common/1.0.0/templates/class/_cronjob.tpl | 2 +- library/common/1.0.0/templates/class/_pvc.tpl | 6 +- .../common/1.0.0/templates/class/_service.tpl | 4 +- .../templates/lib/container/_env_vars.tpl | 2 +- .../1.0.0/templates/lib/container/_ports.tpl | 2 +- .../1.0.0/templates/lib/container/_probes.tpl | 8 +- .../templates/lib/container/_resources.tpl | 2 +- .../templates/lib/container/_security.tpl | 6 +- .../lib/container/env/_fixedEnvs.tpl | 2 +- .../1.0.0/templates/lib/job/_jobPod.tpl | 22 +- .../1.0.0/templates/lib/job/_jobTemplate.tpl | 2 +- .../1.0.0/templates/lib/job/_validateCron.tpl | 2 +- .../1.0.0/templates/lib/job/_validateJob.tpl | 2 +- .../common/1.0.0/templates/lib/pod/_dns.tpl | 2 +- .../templates/lib/pod/_extraContainers.tpl | 2 +- .../templates/lib/pod/_mainContainer.tpl | 2 +- .../templates/lib/pod/_restartPolicy.tpl | 4 +- .../templates/lib/pod/_runtimeClassName.tpl | 2 +- .../1.0.0/templates/lib/pod/_volumes.tpl | 2 +- .../lib/pod/volumes/_hostPathValidation.tpl | 2 +- .../1.0.0/templates/lib/service/_ports.tpl | 4 +- .../templates/lib/util/_storageClassName.tpl | 14 +- .../1.0.0/templates/pods/_statefulset.tpl | 4 +- .../common/1.0.0/templates/spawner/_pvc.tpl | 2 +- library/common/1.0.0/values.yaml | 247 +++++++++--------- 37 files changed, 238 insertions(+), 261 deletions(-) diff --git a/library/common-test/tests/container_in_deployment/fixedEnv_test.yaml b/library/common-test/tests/container_in_deployment/fixedEnv_test.yaml index c6d592a14d..37f36ede71 100644 --- a/library/common-test/tests/container_in_deployment/fixedEnv_test.yaml +++ b/library/common-test/tests/container_in_deployment/fixedEnv_test.yaml @@ -13,8 +13,7 @@ tests: - it: should fail with empty PUID documentIndex: *deploymentDoc set: - security: - PUID: + PUID: asserts: - failedTemplate: errorMessage: key cannot be empty. Set a value or remove the key for the default (568) to take effect. @@ -22,8 +21,7 @@ tests: - it: should fail with PUID not-int documentIndex: *deploymentDoc set: - security: - PUID: "1000" + PUID: "1000" asserts: - failedTemplate: errorMessage: key has value of ("1000"). But must be an int. @@ -31,8 +29,7 @@ tests: - it: should fail with empty UMASK documentIndex: *deploymentDoc set: - security: - UMASK: + UMASK: asserts: - failedTemplate: errorMessage: key cannot be empty. Set a value or remove the key for the default (002) to take effect. @@ -40,8 +37,7 @@ tests: - it: should fail with UMASK not-string documentIndex: *deploymentDoc set: - security: - UMASK: 2 + UMASK: 2 asserts: - failedTemplate: errorMessage: key must be a string, so the format is kept intact. @@ -58,8 +54,7 @@ tests: documentIndex: *deploymentDoc set: TZ: ETC - security: - UMASK: "003" + UMASK: "003" asserts: - equal: path: spec.template.spec.containers[0].env @@ -226,8 +221,7 @@ tests: securityContext: runAsUser: 0 runAsNonRoot: false - security: - PUID: 0 + PUID: 0 asserts: - equal: path: spec.template.spec.containers[0].env @@ -261,8 +255,7 @@ tests: securityContext: runAsGroup: 0 runAsNonRoot: false - security: - PUID: 0 + PUID: 0 asserts: - equal: path: spec.template.spec.containers[0].env @@ -298,8 +291,7 @@ tests: securityContext: runAsGroup: 0 runAsNonRoot: false - security: - PUID: 0 + PUID: 0 asserts: - equal: path: spec.template.spec.containers[0].env diff --git a/library/common-test/tests/deployment/runtimeClass_test.yaml b/library/common-test/tests/deployment/runtimeClass_test.yaml index b4fa67ba4c..28cf9317fc 100644 --- a/library/common-test/tests/deployment/runtimeClass_test.yaml +++ b/library/common-test/tests/deployment/runtimeClass_test.yaml @@ -48,9 +48,9 @@ tests: runtimeClassName: perpod scaleGPU: something: blabla + globalDefaults: + runtimeClassName: global global: - defaults: - runtimeClassName: global ixChartContext: addNvidiaRuntimeClass: true nvidiaRuntimeClassName: something @@ -72,9 +72,8 @@ tests: - it: should pass with global runtime set documentIndex: *deploymentDoc set: - global: - defaults: - runtimeClassName: something + globalDefaults: + runtimeClassName: something asserts: - equal: path: spec.template.spec.runtimeClassName diff --git a/library/common-test/tests/deployment/volume_hostPath_test.yaml b/library/common-test/tests/deployment/volume_hostPath_test.yaml index 28fa65eee4..4da5a3d2f3 100644 --- a/library/common-test/tests/deployment/volume_hostPath_test.yaml +++ b/library/common-test/tests/deployment/volume_hostPath_test.yaml @@ -37,9 +37,8 @@ tests: - it: should fail with ValidateHostPath globally set on and invalid hostPath (/mnt/pool) set: - global: - defaults: - validateHostPath: true + globalDefaults: + validateHostPath: true persistence: some_volume: type: hostPath @@ -52,9 +51,8 @@ tests: - it: should fail with ValidateHostPath globally set on and invalid hostPath (/cluster/ctdb_shared_vol) set: - global: - defaults: - validateHostPath: true + globalDefaults: + validateHostPath: true persistence: some_volume: type: hostPath @@ -67,9 +65,8 @@ tests: - it: should fail with ValidateHostPath globally set on and invalid hostPath (/not_allowed_path) set: - global: - defaults: - validateHostPath: true + globalDefaults: + validateHostPath: true persistence: some_volume: type: hostPath @@ -121,9 +118,8 @@ tests: - it: should fail with ValidateHostPath globally disabled but enabled on the item and invalid hostPath (/not_allowed_path) set: - global: - defaults: - validateHostPath: false + globalDefaults: + validateHostPath: false persistence: some_volume: type: hostPath @@ -153,9 +149,8 @@ tests: - it: should pass with ValidateHostPath globally enabled but disabled on the item and not allowed path for hostPath (/not_allowed_path) documentIndex: *deploymentDoc set: - global: - defaults: - validateHostPath: true + globalDefaults: + validateHostPath: true persistence: some_volume: type: hostPath @@ -174,9 +169,8 @@ tests: - it: should pass with added hostPath and validation globally enabled (/mnt/pool/dataset) documentIndex: *deploymentDoc set: - global: - defaults: - validateHostPath: true + globalDefaults: + validateHostPath: true persistence: volume1: enabled: true @@ -194,9 +188,8 @@ tests: - it: should pass with added hostPath and validation globally enabled (/cluster/something) documentIndex: *deploymentDoc set: - global: - defaults: - validateHostPath: true + globalDefaults: + validateHostPath: true persistence: volume1: enabled: true @@ -214,9 +207,8 @@ tests: - it: should pass with added hostPath and validation globally enabled (/sys) documentIndex: *deploymentDoc set: - global: - defaults: - validateHostPath: true + globalDefaults: + validateHostPath: true persistence: volume1: enabled: true @@ -234,9 +226,8 @@ tests: - it: should pass with added hostPath and validation globally enabled (/dev) documentIndex: *deploymentDoc set: - global: - defaults: - validateHostPath: true + globalDefaults: + validateHostPath: true persistence: volume1: enabled: true diff --git a/library/common-test/tests/initcontainers_in_deployment/additional_containers_in_deployment_test.yaml b/library/common-test/tests/initcontainers_in_deployment/additional_containers_in_deployment_test.yaml index dd3a477cf9..659c822710 100644 --- a/library/common-test/tests/initcontainers_in_deployment/additional_containers_in_deployment_test.yaml +++ b/library/common-test/tests/initcontainers_in_deployment/additional_containers_in_deployment_test.yaml @@ -385,9 +385,8 @@ tests: securityContext: runAsUser: 0 runAsNonRoot: false - security: - UMASK: "003" - PUID: 1000 + UMASK: "003" + PUID: 1000 asserts: - isSubset: path: spec.template.spec.containers[0] diff --git a/library/common-test/tests/initcontainers_in_deployment/init_containers_in_deployment_install_test.yaml b/library/common-test/tests/initcontainers_in_deployment/init_containers_in_deployment_install_test.yaml index b5c11e0d6b..37dda2c5ae 100644 --- a/library/common-test/tests/initcontainers_in_deployment/init_containers_in_deployment_install_test.yaml +++ b/library/common-test/tests/initcontainers_in_deployment/init_containers_in_deployment_install_test.yaml @@ -385,9 +385,8 @@ tests: securityContext: runAsUser: 0 runAsNonRoot: false - security: - UMASK: "003" - PUID: 1000 + UMASK: "003" + PUID: 1000 asserts: - isSubset: path: spec.template.spec.containers[0] diff --git a/library/common-test/tests/initcontainers_in_deployment/init_containers_in_deployment_upgrade_test.yaml b/library/common-test/tests/initcontainers_in_deployment/init_containers_in_deployment_upgrade_test.yaml index e6c83b7fd4..39dc67f0dd 100644 --- a/library/common-test/tests/initcontainers_in_deployment/init_containers_in_deployment_upgrade_test.yaml +++ b/library/common-test/tests/initcontainers_in_deployment/init_containers_in_deployment_upgrade_test.yaml @@ -387,9 +387,8 @@ tests: securityContext: runAsUser: 0 runAsNonRoot: false - security: - UMASK: "003" - PUID: 1000 + UMASK: "003" + PUID: 1000 asserts: - isSubset: path: spec.template.spec.containers[0] diff --git a/library/common-test/tests/initcontainers_in_deployment/install_containers_in_deployment_test.yaml b/library/common-test/tests/initcontainers_in_deployment/install_containers_in_deployment_test.yaml index 8906767e82..1e2306485e 100644 --- a/library/common-test/tests/initcontainers_in_deployment/install_containers_in_deployment_test.yaml +++ b/library/common-test/tests/initcontainers_in_deployment/install_containers_in_deployment_test.yaml @@ -399,9 +399,8 @@ tests: securityContext: runAsUser: 0 runAsNonRoot: false - security: - UMASK: "003" - PUID: 1000 + UMASK: "003" + PUID: 1000 asserts: - isSubset: path: spec.template.spec.containers[0] diff --git a/library/common-test/tests/initcontainers_in_deployment/system_containers_in_deployment_install_copy.yaml b/library/common-test/tests/initcontainers_in_deployment/system_containers_in_deployment_install_copy.yaml index c4fe50fd74..e574ff36ea 100644 --- a/library/common-test/tests/initcontainers_in_deployment/system_containers_in_deployment_install_copy.yaml +++ b/library/common-test/tests/initcontainers_in_deployment/system_containers_in_deployment_install_copy.yaml @@ -385,9 +385,8 @@ tests: securityContext: runAsUser: 0 runAsNonRoot: false - security: - UMASK: "003" - PUID: 1000 + UMASK: "003" + PUID: 1000 asserts: - isSubset: path: spec.template.spec.containers[0] diff --git a/library/common-test/tests/initcontainers_in_deployment/upgrade_containers_in_deployment_test.yaml b/library/common-test/tests/initcontainers_in_deployment/upgrade_containers_in_deployment_test.yaml index fffdb2296b..00e930bffe 100644 --- a/library/common-test/tests/initcontainers_in_deployment/upgrade_containers_in_deployment_test.yaml +++ b/library/common-test/tests/initcontainers_in_deployment/upgrade_containers_in_deployment_test.yaml @@ -401,9 +401,8 @@ tests: securityContext: runAsUser: 0 runAsNonRoot: false - security: - UMASK: "003" - PUID: 1000 + UMASK: "003" + PUID: 1000 asserts: - isSubset: path: spec.template.spec.containers[0] diff --git a/library/common-test/tests/jobs/cronJobSpecContainer_test.yaml b/library/common-test/tests/jobs/cronJobSpecContainer_test.yaml index 15de64ef79..541c1eaf38 100644 --- a/library/common-test/tests/jobs/cronJobSpecContainer_test.yaml +++ b/library/common-test/tests/jobs/cronJobSpecContainer_test.yaml @@ -361,9 +361,8 @@ tests: securityContext: runAsUser: 0 runAsNonRoot: false - security: - UMASK: "003" - PUID: 1000 + UMASK: "003" + PUID: 1000 asserts: - isSubset: path: spec.jobTemplate.spec.template.spec.containers[0] diff --git a/library/common-test/tests/jobs/jobSpecContainer_test.yaml b/library/common-test/tests/jobs/jobSpecContainer_test.yaml index 1376b9dd0e..d00ea0597a 100644 --- a/library/common-test/tests/jobs/jobSpecContainer_test.yaml +++ b/library/common-test/tests/jobs/jobSpecContainer_test.yaml @@ -328,9 +328,8 @@ tests: securityContext: runAsUser: 0 runAsNonRoot: false - security: - UMASK: "003" - PUID: 1000 + UMASK: "003" + PUID: 1000 asserts: - isSubset: path: spec.template.spec.containers[0] diff --git a/library/common-test/tests/pvc/pvc_test.yaml b/library/common-test/tests/pvc/pvc_test.yaml index 445cc55ba1..c88be64690 100644 --- a/library/common-test/tests/pvc/pvc_test.yaml +++ b/library/common-test/tests/pvc/pvc_test.yaml @@ -14,6 +14,8 @@ tests: - it: should fail with SCALE-ZFS storageClass but not scaleZFSStorageClass in global set: + globalDefaults: + scaleZFSStorageClass: "" persistence: vol1: enabled: true @@ -263,9 +265,8 @@ tests: - it: should pass with storageClass set to SCALE-ZFS documentIndex: *pvcDoc set: - global: - defaults: - scaleZFSStorageClass: something + globalDefaults: + scaleZFSStorageClass: something persistence: vol1: enabled: true @@ -286,9 +287,8 @@ tests: documentIndex: *pvcDoc set: key: something - global: - defaults: - scaleZFSStorageClass: "{{ .Values.key }}" + globalDefaults: + scaleZFSStorageClass: "{{ .Values.key }}" persistence: vol1: enabled: true @@ -368,9 +368,8 @@ tests: - it: should pass with storageClass defined globally documentIndex: *pvcDoc set: - global: - defaults: - storageClass: something + globalDefaults: + storageClass: something persistence: vol1: enabled: true @@ -635,9 +634,8 @@ tests: - it: should pass with annotations and global retain true documentIndex: *pvcDoc set: - global: - defaults: - PVCRetain: true + globalDefaults: + PVCRetain: true persistence: vol1: enabled: true @@ -656,9 +654,8 @@ tests: - it: should pass with annotations and global retain true and pvc object to false documentIndex: *pvcDoc set: - global: - defaults: - PVCRetain: true + globalDefaults: + PVCRetain: true persistence: vol1: enabled: true @@ -677,9 +674,8 @@ tests: - it: should pass with annotations and global retain false and pvc object to true documentIndex: *pvcDoc set: - global: - defaults: - PVCRetain: false + globalDefaults: + PVCRetain: false persistence: vol1: enabled: true diff --git a/library/common/1.0.0/templates/class/_cronjob.tpl b/library/common/1.0.0/templates/class/_cronjob.tpl index 8541870a2e..eebe6ae52a 100644 --- a/library/common/1.0.0/templates/class/_cronjob.tpl +++ b/library/common/1.0.0/templates/class/_cronjob.tpl @@ -2,7 +2,7 @@ {{- $job := .job -}} {{- $root := .root -}} - {{- $default := $root.Values.global.defaults.job.cron -}} + {{- $default := $root.Values.globalDefaults.job.cron -}} {{- $jobName := include "ix.v1.common.names.jobAndCronJob" (dict "root" $root "jobValues" $job) -}} {{- include "ix.v1.common.validate.cronJob" (dict "root" $root "job" $job) -}} diff --git a/library/common/1.0.0/templates/class/_pvc.tpl b/library/common/1.0.0/templates/class/_pvc.tpl index 5fc9f61037..040b41a39c 100644 --- a/library/common/1.0.0/templates/class/_pvc.tpl +++ b/library/common/1.0.0/templates/class/_pvc.tpl @@ -3,9 +3,9 @@ {{- define "ix.v1.common.class.pvc" -}} {{- $pvcValues := .pvc -}} {{- $root := .root -}} - {{- $defaultSize := $root.Values.global.defaults.PVCSize -}} - {{- $defaultAccessMode := $root.Values.global.defaults.accessMode -}} - {{- $defaultRetain := $root.Values.global.defaults.PVCRetain -}} + {{- $defaultSize := $root.Values.globalDefaults.PVCSize -}} + {{- $defaultAccessMode := $root.Values.globalDefaults.accessMode -}} + {{- $defaultRetain := $root.Values.globalDefaults.PVCRetain -}} {{- $pvcName := include "ix.v1.common.names.pvc" (dict "root" $root "pvcValues" $pvcValues) -}} diff --git a/library/common/1.0.0/templates/class/_service.tpl b/library/common/1.0.0/templates/class/_service.tpl index 20593cf620..f0bd77ef1b 100644 --- a/library/common/1.0.0/templates/class/_service.tpl +++ b/library/common/1.0.0/templates/class/_service.tpl @@ -3,8 +3,8 @@ {{- define "ix.v1.common.class.service" -}} {{- $svcValues := .svc -}} {{- $root := .root -}} - {{- $defaultServiceType := $root.Values.global.defaults.serviceType -}} - {{- $defaultPortProtocol := $root.Values.global.defaults.portProtocol -}} + {{- $defaultServiceType := $root.Values.globalDefaults.serviceType -}} + {{- $defaultPortProtocol := $root.Values.globalDefaults.portProtocol -}} {{- $svcName := include "ix.v1.common.names.service" (dict "root" $root "svcValues" $svcValues) -}} {{- $svcType := $svcValues.type | default $defaultServiceType -}} diff --git a/library/common/1.0.0/templates/lib/container/_env_vars.tpl b/library/common/1.0.0/templates/lib/container/_env_vars.tpl index 745162f035..bf2d355935 100644 --- a/library/common/1.0.0/templates/lib/container/_env_vars.tpl +++ b/library/common/1.0.0/templates/lib/container/_env_vars.tpl @@ -19,7 +19,7 @@ That's why the custom dict is expected. {{- $root := .root -}} {{- $fixedEnv := list -}} - {{- $inject := $root.Values.global.defaults.injectFixedEnvs -}} + {{- $inject := $root.Values.globalDefaults.injectFixedEnvs -}} {{- if (mustHas (toString $injectFixedEnvs) (list "true" "false")) -}} {{- $inject = $injectFixedEnvs -}} {{- end -}} diff --git a/library/common/1.0.0/templates/lib/container/_ports.tpl b/library/common/1.0.0/templates/lib/container/_ports.tpl index a717e318ed..226cdf4abe 100644 --- a/library/common/1.0.0/templates/lib/container/_ports.tpl +++ b/library/common/1.0.0/templates/lib/container/_ports.tpl @@ -7,7 +7,7 @@ can be dynamically configured via an env var. {{- define "ix.v1.common.container.ports" -}} {{- $root := .root -}} {{- $services := .services -}} - {{- $defaultPortProtocol := $root.Values.global.defaults.portProtocol -}} + {{- $defaultPortProtocol := $root.Values.globalDefaults.portProtocol -}} {{- $ports := list -}} {{- range $svcName, $svc := $services -}} diff --git a/library/common/1.0.0/templates/lib/container/_probes.tpl b/library/common/1.0.0/templates/lib/container/_probes.tpl index 4e8d069d14..3ee3a8c6a0 100644 --- a/library/common/1.0.0/templates/lib/container/_probes.tpl +++ b/library/common/1.0.0/templates/lib/container/_probes.tpl @@ -1,15 +1,15 @@ {{/* Probes selection logic included by the container. */}} {{- define "ix.v1.common.container.probes" -}} {{- $root := .root -}} - {{- $defaults := $root.Values.global.defaults -}} + {{- $defaults := $root.Values.globalDefaults -}} {{- $probes := .probes -}} {{- $isMainContainer := .isMainContainer -}} {{- $services := .services -}} {{/* Only passed from main container, not init/install/upgrade/additional */}} {{- $containerName := .containerName -}} - {{- $defaultProbeType := $root.Values.global.defaults.probeType -}} - {{- $defaultProbePath := $root.Values.global.defaults.probePath -}} - {{- $defaultPortProtocol := $root.Values.global.defaults.portProtocol -}} + {{- $defaultProbeType := $root.Values.globalDefaults.probeType -}} + {{- $defaultProbePath := $root.Values.globalDefaults.probePath -}} + {{- $defaultPortProtocol := $root.Values.globalDefaults.portProtocol -}} {{- $primaryPort := "" -}} {{- if and $isMainContainer $services -}} {{/* If no services exist don't try to guess a port, but do only in main container */}} diff --git a/library/common/1.0.0/templates/lib/container/_resources.tpl b/library/common/1.0.0/templates/lib/container/_resources.tpl index 39f5eda13f..0be3bb1e7e 100644 --- a/library/common/1.0.0/templates/lib/container/_resources.tpl +++ b/library/common/1.0.0/templates/lib/container/_resources.tpl @@ -10,7 +10,7 @@ {{- end -}} {{/* Get defaults from global */}} - {{- $defautlResources := $root.Values.global.defaults.resources -}} + {{- $defautlResources := $root.Values.globalDefaults.resources -}} {{- $newResources := (mustDeepCopy $defautlResources) -}} {{- if and $resources.inherit (not $isMainContainer) -}} {{/* if inherit is set, overwrite defaults with values from mainContainer */}} diff --git a/library/common/1.0.0/templates/lib/container/_security.tpl b/library/common/1.0.0/templates/lib/container/_security.tpl index 3a60dbc06c..d806e7cb3b 100644 --- a/library/common/1.0.0/templates/lib/container/_security.tpl +++ b/library/common/1.0.0/templates/lib/container/_security.tpl @@ -14,7 +14,7 @@ The reason is not splitted, is that on one of the places needs a combo of all va {{- $isMainContainer := .isMainContainer -}} {{/* Initialiaze Values */}} - {{- $defaultSecCont := $root.Values.global.defaults.securityContext -}} + {{- $defaultSecCont := $root.Values.globalDefaults.securityContext -}} {{- $returnValue := (mustDeepCopy $defaultSecCont) -}} {{- if and (hasKey $secCont "inherit") $isMainContainer -}} @@ -112,7 +112,7 @@ The reason is not splitted, is that on one of the places needs a combo of all va {{- $podSecCont := .podSecCont -}} {{/* Initialiaze Values */}} - {{- $defaultPodSecCont := $root.Values.global.defaults.podSecurityContext -}} + {{- $defaultPodSecCont := $root.Values.globalDefaults.podSecurityContext -}} {{- $returnValue := (mustDeepCopy $defaultPodSecCont) -}} {{/* Overwrite from values that user/dev passed */}} @@ -214,7 +214,7 @@ The reason is not splitted, is that on one of the places needs a combo of all va {{- $secEnvs := .secEnvs -}} {{/* Initialiaze Values */}} - {{- $defaultSecEnvs := $root.Values.global.defaults.security -}} + {{- $defaultSecEnvs := (dict "PUID" $root.Values.PUID "UMASK" $root.Values.UMASK ) -}} {{- $returnValue := (mustDeepCopy $defaultSecEnvs) -}} {{/* Overwrite from values that user/dev passed */}} diff --git a/library/common/1.0.0/templates/lib/container/env/_fixedEnvs.tpl b/library/common/1.0.0/templates/lib/container/env/_fixedEnvs.tpl index 3b203874fa..d4c93e7532 100644 --- a/library/common/1.0.0/templates/lib/container/env/_fixedEnvs.tpl +++ b/library/common/1.0.0/templates/lib/container/env/_fixedEnvs.tpl @@ -17,7 +17,7 @@ {{- $scaleGPU := .scaleGPU -}} {{- $nvidiaCaps := .nvidiaCaps -}} - {{- $nvidiaCaps = $nvidiaCaps | default $root.Values.global.defaults.nvidiaCaps -}} + {{- $nvidiaCaps = $nvidiaCaps | default $root.Values.globalDefaults.nvidiaCaps -}} {{- if not (deepEqual $nvidiaCaps (mustUniq $nvidiaCaps)) -}} {{- fail (printf " (%s) are must have unique values only" $nvidiaCaps) -}} 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 29d0d70989..a3360da87f 100644 --- a/library/common/1.0.0/templates/lib/job/_jobPod.tpl +++ b/library/common/1.0.0/templates/lib/job/_jobPod.tpl @@ -13,7 +13,7 @@ {{- $saName = . -}} {{- end -}} {{- else -}} - {{/* If we ever have value in global.defaults */}} + {{/* If we ever have value in globalDefaults */}} {{- end -}} {{- $schedulerName := "" -}} @@ -24,7 +24,7 @@ {{- $schedulerName = . -}} {{- end -}} {{- else -}} - {{/* If we ever have value in global.defaults */}} + {{/* If we ever have value in globalDefaults */}} {{- end -}} {{- $priorityClassName := "" -}} @@ -35,7 +35,7 @@ {{- $priorityClassName = . -}} {{- end -}} {{- else -}} - {{/* If we ever have value in global.defaults */}} + {{/* If we ever have value in globalDefaults */}} {{- end -}} {{- $hostname := "" -}} @@ -46,7 +46,7 @@ {{- $hostname = . -}} {{- end -}} {{- else -}} - {{/* If we ever have value in global.defaults */}} + {{/* If we ever have value in globalDefaults */}} {{- end -}} {{- $dnsPolicy := "" -}} @@ -61,7 +61,7 @@ {{- end -}} {{- end -}} {{- else -}} - {{/* If we ever have value in global.defaults */}} + {{/* If we ever have value in globalDefaults */}} {{- end -}} {{- $dnsConfig := dict -}} @@ -76,7 +76,7 @@ {{- end -}} {{- end -}} {{- else -}} - {{/* If we ever have value in global.defaults */}} + {{/* If we ever have value in globalDefaults */}} {{- end -}} {{- $hostAliases := dict -}} @@ -91,7 +91,7 @@ {{- end -}} {{- end -}} {{- else -}} - {{/* If we ever have value in global.defaults */}} + {{/* If we ever have value in globalDefaults */}} {{- end -}} {{- $nodeSelector := "" -}} @@ -106,7 +106,7 @@ {{- end -}} {{- end -}} {{- else -}} - {{/* If we ever have value in global.defaults */}} + {{/* If we ever have value in globalDefaults */}} {{- end -}} {{- $tolerations := dict -}} @@ -121,7 +121,7 @@ {{- end -}} {{- end -}} {{- else -}} - {{/* If we ever have value in global.defaults */}} + {{/* If we ever have value in globalDefaults */}} {{- end -}} {{- $imagePullSecrets := dict -}} @@ -136,7 +136,7 @@ {{- end -}} {{- end -}} {{- else -}} - {{/* If we ever have value in global.defaults */}} + {{/* If we ever have value in globalDefaults */}} {{- end -}} {{- $runtimeClassName := "" -}} @@ -166,7 +166,7 @@ {{- end -}} {{- end -}} {{- else -}} - {{/* If we ever have value in global.defaults */}} + {{/* If we ever have value in globalDefaults */}} {{- end -}} {{- $secCont := dict -}} diff --git a/library/common/1.0.0/templates/lib/job/_jobTemplate.tpl b/library/common/1.0.0/templates/lib/job/_jobTemplate.tpl index be22f74b87..ad5c1c2139 100644 --- a/library/common/1.0.0/templates/lib/job/_jobTemplate.tpl +++ b/library/common/1.0.0/templates/lib/job/_jobTemplate.tpl @@ -3,7 +3,7 @@ {{- $root := .root -}} {{- $job := .job -}} - {{- $default := $root.Values.global.defaults.job -}} + {{- $default := $root.Values.globalDefaults.job -}} {{- $controllerType := $root.Values.controller.type -}} {{- include "ix.v1.common.validate.job" (dict "root" $root "job" $job) -}} diff --git a/library/common/1.0.0/templates/lib/job/_validateCron.tpl b/library/common/1.0.0/templates/lib/job/_validateCron.tpl index 6ad1c2d7ad..cc9fe6fcf6 100644 --- a/library/common/1.0.0/templates/lib/job/_validateCron.tpl +++ b/library/common/1.0.0/templates/lib/job/_validateCron.tpl @@ -2,7 +2,7 @@ {{- $root := .root -}} {{- $job := .job -}} - {{- $default := $root.Values.global.defaults.job.cron -}} + {{- $default := $root.Values.globalDefaults.job.cron -}} {{- $cron := $job.cron -}} {{- $name := $job.nameOverride -}} diff --git a/library/common/1.0.0/templates/lib/job/_validateJob.tpl b/library/common/1.0.0/templates/lib/job/_validateJob.tpl index 986d4052df..54b4a50aa5 100644 --- a/library/common/1.0.0/templates/lib/job/_validateJob.tpl +++ b/library/common/1.0.0/templates/lib/job/_validateJob.tpl @@ -2,7 +2,7 @@ {{- $root := .root -}} {{- $job := .job -}} - {{- $default := $root.Values.global.defaults.job -}} + {{- $default := $root.Values.globalDefaults.job -}} {{- $name := $job.nameOverride -}} {{- if hasKey $job "backoffLimit" -}} diff --git a/library/common/1.0.0/templates/lib/pod/_dns.tpl b/library/common/1.0.0/templates/lib/pod/_dns.tpl index 4ba325d22f..4fd3c2c45c 100644 --- a/library/common/1.0.0/templates/lib/pod/_dns.tpl +++ b/library/common/1.0.0/templates/lib/pod/_dns.tpl @@ -4,7 +4,7 @@ {{- $hostNetwork := .hostNetwork -}} {{- $root := .root -}} - {{- $policy := $root.Values.global.defaults.dnsPolicy -}} + {{- $policy := $root.Values.globalDefaults.dnsPolicy -}} {{- if $dnsPolicy -}} {{- if not (mustHas $dnsPolicy (list "Default" "ClusterFirst" "ClusterFirstWithHostNet" "None")) -}} {{- fail (printf "Not valid dnsPolicy (%s). Valid options are ClusterFirst, Default, ClusterFirstWithHostNet, None" $dnsPolicy) -}} diff --git a/library/common/1.0.0/templates/lib/pod/_extraContainers.tpl b/library/common/1.0.0/templates/lib/pod/_extraContainers.tpl index 8599d36a86..9a8df6590b 100644 --- a/library/common/1.0.0/templates/lib/pod/_extraContainers.tpl +++ b/library/common/1.0.0/templates/lib/pod/_extraContainers.tpl @@ -60,7 +60,7 @@ "scaleGPU" $container.scaleGPU "nvidiaCaps" $container.nvidiaCaps "secCont" $container.securityContext - "secEnvs" $container.security + "secEnvs" (dict "PUID" $container.PUID "UMASK" $container.UMASK) "injectFixedEnvs" $container.injectFixedEnvs "root" $root) | trim) }} env: diff --git a/library/common/1.0.0/templates/lib/pod/_mainContainer.tpl b/library/common/1.0.0/templates/lib/pod/_mainContainer.tpl index d058a99556..6b83a09f51 100644 --- a/library/common/1.0.0/templates/lib/pod/_mainContainer.tpl +++ b/library/common/1.0.0/templates/lib/pod/_mainContainer.tpl @@ -47,7 +47,7 @@ So it can work on multiple places, like additional containers and not only the m "scaleGPU" $values.scaleGPU "nvidiaCaps" $values.nvidiaCaps "secCont" $values.securityContext - "secEnvs" $values.security + "secEnvs" (dict "PUID" $values.PUID "UMASK" $values.UMASK) "injectFixedEnvs" $values.injectFixedEnvs "root" $root) | trim) }} env: diff --git a/library/common/1.0.0/templates/lib/pod/_restartPolicy.tpl b/library/common/1.0.0/templates/lib/pod/_restartPolicy.tpl index 401f84564a..5811df8938 100644 --- a/library/common/1.0.0/templates/lib/pod/_restartPolicy.tpl +++ b/library/common/1.0.0/templates/lib/pod/_restartPolicy.tpl @@ -2,10 +2,10 @@ {{- $root := .root -}} {{- $restartPolicy := .restartPolicy -}} {{- $isJob := .isJob | default false -}} - {{- $policy := $root.Values.global.defaults.restartPolicy -}} + {{- $policy := $root.Values.globalDefaults.restartPolicy -}} {{- if $isJob -}} - {{- $policy = $root.Values.global.defaults.jobRestartPolicy -}} + {{- $policy = $root.Values.globalDefaults.jobRestartPolicy -}} {{- end -}} {{- with $restartPolicy -}} diff --git a/library/common/1.0.0/templates/lib/pod/_runtimeClassName.tpl b/library/common/1.0.0/templates/lib/pod/_runtimeClassName.tpl index 57b371f1c3..aeb74be075 100644 --- a/library/common/1.0.0/templates/lib/pod/_runtimeClassName.tpl +++ b/library/common/1.0.0/templates/lib/pod/_runtimeClassName.tpl @@ -4,7 +4,7 @@ {{- $isJob := .isJob -}} {{/* Override previous if a runtime is passed from global defaults */}} {{- $runtimeName := "" -}} - {{- with $root.Values.global.defaults.runtimeClassName -}} + {{- with $root.Values.globalDefaults.runtimeClassName -}} {{- $runtimeName = . -}} {{- end -}} diff --git a/library/common/1.0.0/templates/lib/pod/_volumes.tpl b/library/common/1.0.0/templates/lib/pod/_volumes.tpl index a2f2e69ccc..103dc5c0b8 100644 --- a/library/common/1.0.0/templates/lib/pod/_volumes.tpl +++ b/library/common/1.0.0/templates/lib/pod/_volumes.tpl @@ -2,7 +2,7 @@ {{- define "ix.v1.common.controller.volumes" -}} {{- $root := .root -}} {{- $persistence := .persistence -}} - {{- $persistenceDefault := $root.Values.global.defaults.persistenceType -}} + {{- $persistenceDefault := $root.Values.globalDefaults.persistenceType -}} {{- range $index, $persistence := $persistence -}} {{- if $persistence.enabled -}} diff --git a/library/common/1.0.0/templates/lib/pod/volumes/_hostPathValidation.tpl b/library/common/1.0.0/templates/lib/pod/volumes/_hostPathValidation.tpl index 6958b136b6..053c8a1e50 100644 --- a/library/common/1.0.0/templates/lib/pod/volumes/_hostPathValidation.tpl +++ b/library/common/1.0.0/templates/lib/pod/volumes/_hostPathValidation.tpl @@ -1,7 +1,7 @@ {{- define "ix.v1.common.controller.volumes.hostPath.validation" -}} {{- $vol := .volume -}} {{- $root := .root -}} - {{- $validate := $root.Values.global.defaults.validateHostPath -}} + {{- $validate := $root.Values.globalDefaults.validateHostPath -}} {{- if (hasKey $vol "validateHostPath") -}} {{- $validate = $vol.validateHostPath -}} diff --git a/library/common/1.0.0/templates/lib/service/_ports.tpl b/library/common/1.0.0/templates/lib/service/_ports.tpl index 5a133a68ed..2e6b1daa8d 100644 --- a/library/common/1.0.0/templates/lib/service/_ports.tpl +++ b/library/common/1.0.0/templates/lib/service/_ports.tpl @@ -19,8 +19,8 @@ ports: protocol: {{ $protocol }} targetPort: {{ $port.targetPort | default $name }} {{- if and (eq $svcType "NodePort") $port.nodePort -}} - {{- if lt $port.nodePort $root.Values.global.defaults.minimumNodePort -}} - {{- fail (printf "Port number (%s) for (%s) is too low. The minimum port for Node Port is (%s)" ($port.nodePort | toString) $name ($root.Values.global.defaults.minimumNodePort | toString)) -}} + {{- if lt $port.nodePort $root.Values.globalDefaults.minimumNodePort -}} + {{- fail (printf "Port number (%s) for (%s) is too low. The minimum port for Node Port is (%s)" ($port.nodePort | toString) $name ($root.Values.globalDefaults.minimumNodePort | toString)) -}} {{- end }} nodePort: {{ $port.nodePort }} {{- end -}} diff --git a/library/common/1.0.0/templates/lib/util/_storageClassName.tpl b/library/common/1.0.0/templates/lib/util/_storageClassName.tpl index 25cfd89f52..c5337217c1 100644 --- a/library/common/1.0.0/templates/lib/util/_storageClassName.tpl +++ b/library/common/1.0.0/templates/lib/util/_storageClassName.tpl @@ -6,9 +6,9 @@ {{/* If a storage class is defined on a persistence object: "-" returns "", which means requesting a PV without class - "SCALE-ZFS" returns the value set on Values.global.defaults.scaleZFSStorageClass + "SCALE-ZFS" returns the value set on Values.globalDefaults.scaleZFSStorageClass else return the defined storageClass - Else if there is a storageClass defined in Values.global.defaults.storageClass, return this + Else if there is a storageClass defined in Values.globalDefaults.storageClass, return this In any other case, return nothing */}} @@ -17,16 +17,16 @@ {{- if eq "-" $className -}} {{- print "\"\"" -}} {{- else if eq "SCALE-ZFS" $className -}} {{/* Later, if we have more storage classes we add another else if (eg SCALE-SMB) */}} - {{- if not $root.Values.global.defaults.scaleZFSStorageClass -}} - {{- fail "A storageClass must be defined in global.defaults.scaleZFSStorageClass" -}} + {{- if not $root.Values.globalDefaults.scaleZFSStorageClass -}} + {{- fail "A storageClass must be defined in globalDefaults.scaleZFSStorageClass" -}} {{- end -}} - {{- print (tpl $root.Values.global.defaults.scaleZFSStorageClass $root) -}} + {{- print (tpl $root.Values.globalDefaults.scaleZFSStorageClass $root) -}} {{- else -}} {{- print $className -}} {{- end -}} {{- else if $root.Values.ixChartContext -}} {{- print (tpl $root.Values.global.ixChartContext.storageClassName $root) -}} - {{- else if $root.Values.global.defaults.storageClass -}} - {{- print $root.Values.global.defaults.storageClass -}} + {{- else if $root.Values.globalDefaults.storageClass -}} + {{- print $root.Values.globalDefaults.storageClass -}} {{- end -}} {{- end -}} diff --git a/library/common/1.0.0/templates/pods/_statefulset.tpl b/library/common/1.0.0/templates/pods/_statefulset.tpl index ca4bc6f0a3..a6d3b9e2cb 100644 --- a/library/common/1.0.0/templates/pods/_statefulset.tpl +++ b/library/common/1.0.0/templates/pods/_statefulset.tpl @@ -63,10 +63,10 @@ spec: storageClassName: {{ . }} {{- end }} accessModes: - - {{ tpl ($vct.accessMode | default $.Values.global.defaults.accessMode) $ }} + - {{ tpl ($vct.accessMode | default $.Values.globalDefaults.accessMode) $ }} resources: requests: - storage: {{ tpl ($vct.size | default $.Values.global.defaults.VCTSize) $ | quote }} + storage: {{ tpl ($vct.size | default $.Values.globalDefaults.VCTSize) $ | quote }} {{- end -}} {{- end -}} {{- end }} diff --git a/library/common/1.0.0/templates/spawner/_pvc.tpl b/library/common/1.0.0/templates/spawner/_pvc.tpl index d74e70a902..7c2b591dff 100644 --- a/library/common/1.0.0/templates/spawner/_pvc.tpl +++ b/library/common/1.0.0/templates/spawner/_pvc.tpl @@ -1,6 +1,6 @@ {{/* Renders the PVC objects */}} {{- define "ix.v1.common.spawner.pvc" -}} - {{- $defaultType := .Values.global.defaults.persistenceType -}} + {{- $defaultType := .Values.globalDefaults.persistenceType -}} {{- range $name, $pvc := .Values.persistence -}} {{- if and $pvc.enabled (eq (default $defaultType $pvc.type) "pvc") (not ($pvc.existingClaim)) -}} {{- $pvcValues := $pvc -}} diff --git a/library/common/1.0.0/values.yaml b/library/common/1.0.0/values.yaml index 800e30f6df..dd4767c3cb 100644 --- a/library/common/1.0.0/values.yaml +++ b/library/common/1.0.0/values.yaml @@ -1,122 +1,134 @@ # This file only includes the default values that are applied. # All values can be overridden per chart, in their values.yaml -# For Examples and Explanation view the "Values.yaml Explained" markdown file +# For Examples and Explanation view the "docs". +# Global Values global: - nameOverride: "" - fullnameOverride: "" - annotations: {} + # Labels applied to all objects labels: {} - defaults: - # If not defined on per pod or in ixChartContext, assume this. - # Empty means NO runtimeClassName - runtimeClassName: "" - # If not defined on the pod, assume this - dnsPolicy: ClusterFirst - # If no restart Policy is defined, assume this - restartPolicy: Always - # If no restart Policy for job is defined, assume this - jobRestartPolicy: Never - # If no port Protocol is defined, assume this - portProtocol: TCP - # Define the minimum NodePort - minimumNodePort: 9000 - # If no service Type is defined, assume this - serviceType: ClusterIP - # If no PVC Size is defined, assume this - PVCSize: 1Gi - # If no VCT Size is defined, assume this - VCTSize: 999Gi - # If no PVC type is defined, assume this - persistenceType: pvc - # If no validateHostPath key exists in the persistence item, assume this - validateHostPath: false - # If no PVC accessMode is defined, assume this - accessMode: ReadWriteOnce - # If no PVC retain key is defined, assume this - # Note, that this adds an annotation for helm whether to delete - # the resource on uninstall, manually deleting the namespace it will delete - # the resource no matter what this is set. - PVCRetain: false - # Define a storageClassName that will be used for all PVCs by default - # Leave empty to rely on the node's default storageClass - storageClass: - # When SCALE-ZFS is set for storageClass, return this name - scaleZFSStorageClass: '{{ printf "ix-storage-class-%v" .Release.Name}}' - # Default security context used for all - # init/install/upgrade/additional - # and main containers if not specified - securityContext: - runAsNonRoot: true - runAsUser: 568 - runAsGroup: 568 - readOnlyRootFilesystem: true - allowPrivilegeEscalation: false - privileged: false - capabilities: - add: [] - drop: - - ALL - # Default podSecurityContext, used if - # no other is specified - podSecurityContext: - fsGroup: 568 - supplementalGroups: [] - fsGroupChangePolicy: OnRootMismatch - # Default Security values, if no others - # are specified - security: - PUID: 568 - UMASK: "002" - # Whether to inject fixedEnvs on containers - # Can be overruled per container - injectFixedEnvs: true - # Default nvidia Caps will be assigned via - # environment variable (requires injectFixedEnvs) - nvidiaCaps: - - all - # Default Resources values, if no others - # are specified, use those - resources: - limits: - cpu: 4000m - memory: 8Gi - requests: - cpu: 10m - memory: 50Mi - # If no probe Type is defined, assume this - probeType: auto - # If no probe Path is defined, assume this - probePath: / - # Default probe timeouts, if no others - # are specified, use those - probes: - liveness: - spec: - initialDelaySeconds: 10 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 5 - readiness: - spec: - initialDelaySeconds: 10 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 5 - startup: - spec: - initialDelaySeconds: 10 - periodSeconds: 5 - timeoutSeconds: 2 - failureThreshold: 60 - # Default job/cronjob values - job: - cron: - concurrencyPolicy: Forbid - failedJobsHistoryLimit: 1 - successfulJobsHistoryLimit: 3 - backoffLimit: 6 - completionMode: NonIndexed + # Annotations applied to all objects + annotations: {} + +# Default values to use if not defined on the chart +globalDefaults: + # Whether to add annotations for specific use cases + addAnnotations: + metallb: false + traefik: false + # Default RuntimeClassName to use for pods + # If not defined on per pod or in ixChartContext, assume this. + # Empty means NO runtimeClassName + runtimeClassName: "" + # Default Restart Policy to use for pods + restartPolicy: Always + # Default Job Restart Policy + jobRestartPolicy: Never + # Default portProtocol for service + portProtocol: TCP + # Define the minimum NodePort + minimumNodePort: 9000 + # If not defined on the pod, assume this + dnsPolicy: ClusterFirst + # If no service Type is defined, assume this + serviceType: ClusterIP + # If no PVC Size is defined, assume this + PVCSize: 1Gi + # If no VCT Size is defined, assume this + VCTSize: 999Gi + # If no PVC type is defined, assume this + persistenceType: pvc + # If no validateHostPath key exists in the persistence item, assume this + validateHostPath: false + # If no PVC accessMode is defined, assume this + accessMode: ReadWriteOnce + # Define a storageClassName that will be used for all PVCs by default + # Leave empty to rely on the node's default storageClass + storageClass: + # When SCALE-ZFS is set for storageClass, return this name + scaleZFSStorageClass: '{{ printf "ix-storage-class-%v" .Release.Name}}' + # If no PVC retain key is defined, assume this + # Note, that this adds an annotation for helm whether to delete + # the resource on uninstall, manually deleting the namespace it will delete + # the resource no matter what this is set. + PVCRetain: false + # Default security context used for all + # init/install/upgrade/additional + # and main containers if not specified + securityContext: + runAsNonRoot: true + runAsUser: 568 + runAsGroup: 568 + readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + privileged: false + capabilities: + add: [] + drop: + - ALL + # Default podSecurityContext, used if + # no other is specified + podSecurityContext: + fsGroup: 568 + supplementalGroups: [] + fsGroupChangePolicy: OnRootMismatch + # Whether to inject fixedEnvs on containers + # Can be overruled per container + injectFixedEnvs: true + # Default nvidia Caps will be assigned via + # environment variable (requires injectFixedEnvs) + nvidiaCaps: + - all + # Default Resources values, if no others + # are specified, use those + resources: + limits: + cpu: 4000m + memory: 8Gi + requests: + cpu: 10m + memory: 50Mi + # If no probe Type is defined, assume this + probeType: auto + # If no probe Path is defined, assume this + probePath: / + # Default probe timeouts, if no others + # are specified, use those + probes: + liveness: + spec: + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 5 + readiness: + spec: + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 5 + startup: + spec: + initialDelaySeconds: 10 + periodSeconds: 5 + timeoutSeconds: 2 + failureThreshold: 60 + # Default job/cronjob values + job: + cron: + concurrencyPolicy: Forbid + failedJobsHistoryLimit: 1 + successfulJobsHistoryLimit: 3 + backoffLimit: 6 + completionMode: NonIndexed + + +# Defines the timezone for the container +TZ: UTC +# Default PUID +PUID: 568 +# Default UMASK +UMASK: "002" + # Defines image info image: @@ -145,12 +157,7 @@ env: {} envList: [] # Defines the environment variables from a secret or configmap envFrom: [] -# Defines the timezone for the container -TZ: UTC -# Default Security values for main container -security: - PUID: 568 - UMASK: "002" + # Nvidia Caps will be assigned via environment variable # If empty, global defaults will be used nvidiaCaps: []