-
Notifications
You must be signed in to change notification settings - Fork 2
/
init.yaml
68 lines (65 loc) · 1.75 KB
/
init.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
apiVersion: v1
kind: Pod
metadata:
name: mypod
labels:
name: postgres-operator
namespace: demo
spec:
containers:
- name: psql-container
image: postgres
command: ['sh', '-c', 'sleep 3600']
env:
- name: PGUSER
valueFrom:
secretKeyRef:
name: mycluster-postgres-secret
key: username
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: mycluster-postgres-secret
key: password
initContainers:
- name: init-pgo
image: quay.io/guineveresaenger/guinstest:latest
imagePullPolicy: Always
env:
- name: CO_APISERVER_URL
value: https://postgres-operator.demo.svc.cluster.local:8443
- name: PGOUSER
value: username
- name: PGO_CA_CERT
value: /conf/apiserver/server.crt
- name: PGO_CLIENT_CERT
value: /conf/apiserver/server.crt
- name: PGO_CLIENT_KEY
value: /conf/apiserver/server.key
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: backup
spec:
schedule: "*/5 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: pgo-backup
image: quay.io/guineveresaenger/guinstest:latest
command: ['sh', '-c', 'echo username:password > ~/.pgouser && echo backing up: && pgo backup mycluster']
env:
- name: CO_APISERVER_URL
value: https://postgres-operator.demo.svc.cluster.local:8443
- name: PGOUSER
value: username
- name: PGO_CA_CERT
value: /conf/apiserver/server.crt
- name: PGO_CLIENT_CERT
value: /conf/apiserver/server.crt
- name: PGO_CLIENT_KEY
value: /conf/apiserver/server.key
restartPolicy: OnFailure