diff --git a/helm/nodesets/templates/_helpers.tpl b/helm/nodesets/templates/_helpers.tpl index 83e4f51a2..e65e744fe 100644 --- a/helm/nodesets/templates/_helpers.tpl +++ b/helm/nodesets/templates/_helpers.tpl @@ -114,6 +114,13 @@ customInitContainers: {{- end }} {{- end -}} +{{/* Name of the slurm-scripts ConfigMap. Empty if clusterName is not set. */}} +{{- define "nodesets.slurmScriptsCMName" -}} +{{- if $.Values.clusterName -}} +{{- printf "%s-slurm-scripts" $.Values.clusterName -}} +{{- end -}} +{{- end -}} + {{/* Construct container gpu resource from GPU spec ([0]) and GPU resource spec ([1]) */}} {{- define "nodesets.resource.gpuFrom" -}} {{- $gpuSpec := (index . 0) | default dict -}} diff --git a/helm/nodesets/templates/nodeset.yaml b/helm/nodesets/templates/nodeset.yaml index f7325d6ba..ff5ce9dd0 100644 --- a/helm/nodesets/templates/nodeset.yaml +++ b/helm/nodesets/templates/nodeset.yaml @@ -148,14 +148,36 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} - {{- with (.jailSubMounts | default list) }} + {{- $slurmScriptsCMName := include "nodesets.slurmScriptsCMName" $ }} + + {{- if or $slurmScriptsCMName (.jailSubMounts | default list) }} jailSubMounts: + {{- if $slurmScriptsCMName }} + - name: slurm-scripts-jail + mountPath: /opt/slurm_scripts + volumeSource: + configMap: + name: {{ $slurmScriptsCMName | quote }} + defaultMode: 0755 + {{- end }} + {{- with (.jailSubMounts | default list) }} {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} - {{- with (.customVolumeMounts | default list) }} + {{- if or $slurmScriptsCMName (.customVolumeMounts | default list) }} customVolumeMounts: + {{- if $slurmScriptsCMName }} + - name: slurm-scripts + mountPath: /opt/slurm_scripts + volumeSource: + configMap: + name: {{ $slurmScriptsCMName | quote }} + defaultMode: 0755 + {{- end }} + {{- with (.customVolumeMounts | default list) }} {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} {{- with (.sharedMemorySize | default "") }}