From fa4349f3bde3ad821ec5896c9393ba2cd5c6172a Mon Sep 17 00:00:00 2001 From: Zach Hannum Date: Mon, 16 Dec 2024 11:24:55 -0500 Subject: [PATCH] Bump launcher templates for Workbench chart to 2.5.0 Adds init containers support from the Job spec. --- charts/rstudio-workbench/files/job.tpl | 44 +++++++++++++++++++++- charts/rstudio-workbench/files/service.tpl | 2 +- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/charts/rstudio-workbench/files/job.tpl b/charts/rstudio-workbench/files/job.tpl index a0101a8d..b89a7a1e 100644 --- a/charts/rstudio-workbench/files/job.tpl +++ b/charts/rstudio-workbench/files/job.tpl @@ -1,4 +1,4 @@ -# Version: 2.4.0 +# Version: 2.5.0 # DO NOT MODIFY the "Version: " key # Helm Version: v1 {{- $templateData := include "rstudio-library.templates.data" nil | mustFromJson }} @@ -144,6 +144,48 @@ spec: imagePullSecrets: {{ toYaml . | nindent 12 }} {{- end }} initContainers: + {{- with .Job.initContainers }} + {{- range . }} + - name: {{ toYaml .name }} + image: {{ toYaml .image }} + {{- $isShell := false }} + {{- if .command }} + command: ['/bin/sh'] + {{- $isShell = true }} + {{- else if .exe }} + command: [{{ toYaml .exe }}] + {{- $isShell = false }} + {{- end }} + {{- if or .args $isShell }} + args: + {{- if $isShell }} + - '-c' + {{- if .args }} + - {{ .args | join " " | cat .command | toYaml | indent 12 | trimPrefix (repeat 12 " ") }} + {{- else }} + - {{ .command | toYaml | indent 12 | trimPrefix (repeat 12 " ") }} + {{- end }} + {{- else }} + {{- range .args }} + - {{ toYaml . | indent 12 | trimPrefix (repeat 12 " ") }} + {{- end }} + {{- end }} + {{- end }} + {{- if .environment }} + env: + {{- range .environment }} + - name: {{ toYaml .name | indent 14 | trimPrefix (repeat 14 " ") }} + value: {{ toYaml .value | indent 14 | trimPrefix (repeat 14 " ") }} + {{- end }} + {{- end }} + {{- if .mounts }} + volumeMounts: + {{- range .mounts }} + - {{ nindent 14 (toYaml .) | trim -}} + {{- end }} + {{- end }} + {{- end }} + {{- end }} {{- with .Job.metadata.pod.initContainers }} {{- range . }} - {{ toYaml . | indent 10 | trimPrefix (repeat 10 " ") }} diff --git a/charts/rstudio-workbench/files/service.tpl b/charts/rstudio-workbench/files/service.tpl index 30bfca27..ad5a9265 100644 --- a/charts/rstudio-workbench/files/service.tpl +++ b/charts/rstudio-workbench/files/service.tpl @@ -1,4 +1,4 @@ -# Version: 2.4.0 +# Version: 2.5.0 # DO NOT MODIFY the "Version: " key # Helm Version: v1 {{- $templateData := include "rstudio-library.templates.data" nil | mustFromJson }}