From 95c2f120faeb87fa27d30b25d0949d969fe0a4ee Mon Sep 17 00:00:00 2001 From: Karsten Kraus Date: Thu, 28 Mar 2024 19:07:19 +0100 Subject: [PATCH] add initContainer --- charts/vault-raft-snapshot-agent/Chart.yaml | 2 +- .../templates/deployment.yaml | 21 +++++++++++++++++++ charts/vault-raft-snapshot-agent/values.yaml | 4 ++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/charts/vault-raft-snapshot-agent/Chart.yaml b/charts/vault-raft-snapshot-agent/Chart.yaml index 0def97d..e4b23cc 100644 --- a/charts/vault-raft-snapshot-agent/Chart.yaml +++ b/charts/vault-raft-snapshot-agent/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: vault-raft-snapshot-agent type: application -version: 0.4.12 +version: 0.4.13 appVersion: "v0.10.10" description: Vault Raft Snapshot Agent takes periodic snapshots of Vault's Raft database and stores them on a local volume or an remote S3 bucket keywords: diff --git a/charts/vault-raft-snapshot-agent/templates/deployment.yaml b/charts/vault-raft-snapshot-agent/templates/deployment.yaml index 99fdcad..e71a4d8 100644 --- a/charts/vault-raft-snapshot-agent/templates/deployment.yaml +++ b/charts/vault-raft-snapshot-agent/templates/deployment.yaml @@ -63,6 +63,27 @@ spec: readOnly: {{ $volume.readOnly }} {{- end }} {{- end }} + {{ with .Values.deployment.initContainer }} + initContainers: + - name: {{ .name | default "Initialize Agent" }} + image: {{ .image | default "alpine:3.19.1" }} + {{- with .command }} + command: {{ tpl (toYaml .) $ | nindent 8 }} + {{- end }} + {{- with .env }} + env: {{ tpl (toYaml .) $ | nindent 8 }} + {{- end }} + {{- with $.Values.deployment.extraVolumes }} + volumeMounts: + {{- range $volume := $.Values.deployment.extraVolumes }} + - mountPath: {{ required "volume mountPath is required" $volume.mountPath }} + name: {{ required "volume name is required" $volume.name }} + {{- with $volume.readOnly }} + readOnly: {{ $volume.readOnly }} + {{- end }} + {{- end}} + {{- end }} + {{- end }} volumes: - name: config configMap: diff --git a/charts/vault-raft-snapshot-agent/values.yaml b/charts/vault-raft-snapshot-agent/values.yaml index e53036b..8bca8c9 100644 --- a/charts/vault-raft-snapshot-agent/values.yaml +++ b/charts/vault-raft-snapshot-agent/values.yaml @@ -37,6 +37,10 @@ deployment: # `.Chart.AppVersion` of this chart thus must only be changed # if you use another repository than the default pullPolicy: IfNotPresent + # -- specify optional init-container. Only properties `name`, `image`, `command` and `env` are used. + # `name` and `image` are optional, by default alpine:3.19.1, which is the agents-base-image, is used as image + # The init-container has access to all extraVolumes. + initContainer: {} # -- (int) see [kubernetes docs](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#clean-up-policy) # You might want to change this to a small value to avoid cluttering up the # UI of a Continuous Delivery Tool like Argo-CD