From d575ca542b80df1455c66124f9413c17bfd4fa7b Mon Sep 17 00:00:00 2001 From: Matthias Berndt Date: Wed, 5 Jun 2024 10:59:40 +0200 Subject: [PATCH] add option to add files in container --- charts/scala-steward/templates/configmap.yaml | 12 ++++++++++++ charts/scala-steward/templates/cron-job.yaml | 15 +++++++++++++++ charts/scala-steward/values.yaml | 8 ++++++++ 3 files changed, 35 insertions(+) diff --git a/charts/scala-steward/templates/configmap.yaml b/charts/scala-steward/templates/configmap.yaml index e9183d1..cca8195 100644 --- a/charts/scala-steward/templates/configmap.yaml +++ b/charts/scala-steward/templates/configmap.yaml @@ -11,3 +11,15 @@ data: {{- tpl (.Files.Get "files/password.sh") . | nindent 4 }} scalafix.conf: | {{- .Values.scalafixConfig | nindent 4 }} +{{- if .Values.additionalFiles }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "scala-steward.fullname" . }}-files +data: + {{- range $k, $v := .Values.additionalFiles }} + {{ $k }}: + {{ $v.content | quote }} + {{- end }} +{{- end }} diff --git a/charts/scala-steward/templates/cron-job.yaml b/charts/scala-steward/templates/cron-job.yaml index 6ebed8a..3dd0a91 100644 --- a/charts/scala-steward/templates/cron-job.yaml +++ b/charts/scala-steward/templates/cron-job.yaml @@ -43,6 +43,11 @@ spec: name: opt - mountPath: /var/scala-steward/workspace name: workspace + {{- range $k, $v := .Values.additionalFiles }} + - mountPath: {{ $v.path }} + name: files + subPath: {{ $k }} + {{- end }} volumes: - name: opt configMap: @@ -63,3 +68,13 @@ spec: - name: workspace emptyDir: {} {{- end }} + {{- if .Values.additionalFiles }} + - name: files + configMap: + name: {{ include "scala-steward.fullname" . }}-files + items: + {{- range $k, $v := .Values.additionalFiles }} + - key: {{ $k }} + path: {{ $k }} + {{- end }} + {{- end }} diff --git a/charts/scala-steward/values.yaml b/charts/scala-steward/values.yaml index f4eb9f8..e79e07b 100644 --- a/charts/scala-steward/values.yaml +++ b/charts/scala-steward/values.yaml @@ -53,3 +53,11 @@ persistence: accessModes: - ReadWriteOnce size: 5Gi + +additionalFiles: {} +# this can be used to make files available in the container, e. g. for authentication for an artifact repository +# additionalFiles: +# nexusCredentials: +# path: /root/.sbt/1.0/credentials.sbt +# content: | +# credentials += Credentials(sys.env("NEXUS_REALM"), sys.env("NEXUS_HOST"), sys.env("NEXUS_USERNAME"), sys.env("NEXUS_PASSWORD"))