-
Notifications
You must be signed in to change notification settings - Fork 27
/
job-pre-populate-only.yaml
34 lines (34 loc) · 1 KB
/
job-pre-populate-only.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
apiVersion: batch/v1
kind: Job
metadata:
name: pgdump
spec:
backoffLimit: 0
template:
metadata:
name: pgdump
labels:
app: pgdump
annotations:
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/agent-inject-secret-helloworld: "secret/helloworld"
vault.hashicorp.com/agent-inject-template-helloworld: |
{{- with secret "secret/helloworld" -}}
postgresql://{{ .Data.data.username }}:{{ .Data.data.password }}@postgres:5432/wizard
{{- end }}
vault.hashicorp.com/role: "myapp"
vault.hashicorp.com/agent-pre-populate-only: "true"
spec:
serviceAccountName: app
containers:
- name: pgdump
#image: postgres:11.5
image: alpine:latest
command:
- "/bin/sh"
- "-ec"
args:
#- "/usr/bin/pg_dump $(cat /vault/secrets/helloworld) --no-owner > /dev/stdout"
- "cat /vault/secrets/helloworld > /dev/stdout"
restartPolicy: Never