From 574188bac1e07f01f4900d79f8342b1ac37335d7 Mon Sep 17 00:00:00 2001 From: Sebastian Widmer Date: Thu, 7 Apr 2022 13:45:01 +0200 Subject: [PATCH] Start vault agent and let it finish before attempting a backup --- component/backup.jsonnet | 16 ++++++++++++++++ .../vault/vault/30_backup/32_backup.yaml | 13 ++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/component/backup.jsonnet b/component/backup.jsonnet index 48fe41f..e4a23c7 100644 --- a/component/backup.jsonnet +++ b/component/backup.jsonnet @@ -87,6 +87,11 @@ local backupPod = backup.PreBackupPod( containers_: { backup: kube.Container('backup') { image: '%s/%s:%s' % [ params.images.vault.registry, params.images.vault.repository, params.images.vault.version ], + args: [ + 'agent', + '-config', + '/etc/vault/vault-agent-config.hcl', + ], env_: { HOME: '/home/vault', VAULT_ADDR: 'http://%s-active:8200' % params.name, @@ -100,6 +105,17 @@ local backupPod = backup.PreBackupPod( mountPath: '/home/vault', }, }, + readinessProbe: { + exec: { + command: [ + 'test', + '-e', + '/home/vault/.vault-token', + ], + }, + initialDelaySeconds: 3, + periodSeconds: 3, + }, }, }, volumes_: { diff --git a/tests/golden/defaults/vault/vault/30_backup/32_backup.yaml b/tests/golden/defaults/vault/vault/30_backup/32_backup.yaml index 2f96fa7..378f3de 100644 --- a/tests/golden/defaults/vault/vault/30_backup/32_backup.yaml +++ b/tests/golden/defaults/vault/vault/30_backup/32_backup.yaml @@ -23,7 +23,10 @@ spec: pod: spec: containers: - - args: [] + - args: + - agent + - -config + - /etc/vault/vault-agent-config.hcl env: - name: HOME value: /home/vault @@ -35,6 +38,14 @@ spec: imagePullPolicy: IfNotPresent name: backup ports: [] + readinessProbe: + exec: + command: + - test + - -e + - /home/vault/.vault-token + initialDelaySeconds: 3 + periodSeconds: 3 stdin: false tty: false volumeMounts: