-
Notifications
You must be signed in to change notification settings - Fork 3
/
ocp2ocp-postgresql-policy.sh
executable file
·66 lines (62 loc) · 1.33 KB
/
ocp2ocp-postgresql-policy.sh
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
export MY_OBJECT_STORAGE_PROFILE=myibmcos1-migration
echo '------Create backup policies'
cat <<EOF | kubectl apply -f -
apiVersion: config.kio.kasten.io/v1alpha1
kind: Policy
metadata:
name: ocp2ocp-postgresql-backup
namespace: kasten-io
spec:
comment: ""
frequency: "@hourly"
actions:
- action: backup
backupParameters:
profile:
namespace: kasten-io
name: $MY_OBJECT_STORAGE_PROFILE
- action: export
exportParameters:
frequency: "@hourly"
migrationToken:
name: ""
namespace: ""
profile:
name: $MY_OBJECT_STORAGE_PROFILE
namespace: kasten-io
receiveString: ""
exportData:
enabled: true
retention:
hourly: 0
daily: 0
weekly: 0
monthly: 0
yearly: 0
retention:
hourly: 4
daily: 1
weekly: 1
monthly: 0
yearly: 0
selector:
matchExpressions:
- key: k10.kasten.io/appNamespace
operator: In
values:
- k10-postgresql
EOF
sleep 5
echo '-------Kickoff the on-demand backup job'
sleep 5
cat <<EOF | kubectl create -f -
apiVersion: actions.kio.kasten.io/v1alpha1
kind: RunAction
metadata:
generateName: run-backup-
spec:
subject:
kind: Policy
name: ocp2ocp-postgresql-backup
namespace: kasten-io
EOF