Skip to content

Commit 796b6e3

Browse files
authored
K8SPSMDB-1237: add incremental backups (#1836)
1 parent b8f5829 commit 796b6e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2436
-54
lines changed

config/crd/bases/psmdb.percona.com_perconaservermongodbbackups.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ spec:
7171
enum:
7272
- logical
7373
- physical
74+
- incremental
75+
- incremental-base
7476
type: string
7577
type: object
7678
status:

config/crd/bases/psmdb.percona.com_perconaservermongodbs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,8 @@ spec:
397397
enum:
398398
- logical
399399
- physical
400+
- incremental
401+
- incremental-base
400402
type: string
401403
required:
402404
- enabled

deploy/bundle.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ spec:
7070
enum:
7171
- logical
7272
- physical
73+
- incremental
74+
- incremental-base
7375
type: string
7476
type: object
7577
status:
@@ -1093,6 +1095,8 @@ spec:
10931095
enum:
10941096
- logical
10951097
- physical
1098+
- incremental
1099+
- incremental-base
10961100
type: string
10971101
required:
10981102
- enabled

deploy/cr.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,3 +723,19 @@ spec:
723723
# storageName: s3-us-west
724724
# compressionType: gzip
725725
# compressionLevel: 6
726+
# - name: weekly-s3-us-west-incremental
727+
# enabled: false
728+
# schedule: "0 1 * * *"
729+
# keep: 5
730+
# type: incremental
731+
# storageName: s3-us-west
732+
# compressionType: gzip
733+
# compressionLevel: 6
734+
# - name: weekly-s3-us-west-incremental-base
735+
# enabled: false
736+
# schedule: "0 5 * * 0"
737+
# keep: 5
738+
# type: incremental-base
739+
# storageName: s3-us-west
740+
# compressionType: gzip
741+
# compressionLevel: 6

deploy/crd.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ spec:
7070
enum:
7171
- logical
7272
- physical
73+
- incremental
74+
- incremental-base
7375
type: string
7476
type: object
7577
status:
@@ -1093,6 +1095,8 @@ spec:
10931095
enum:
10941096
- logical
10951097
- physical
1098+
- incremental
1099+
- incremental-base
10961100
type: string
10971101
required:
10981102
- enabled

deploy/cw-bundle.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ spec:
7070
enum:
7171
- logical
7272
- physical
73+
- incremental
74+
- incremental-base
7375
type: string
7476
type: object
7577
status:
@@ -1093,6 +1095,8 @@ spec:
10931095
enum:
10941096
- logical
10951097
- physical
1098+
- incremental
1099+
- incremental-base
10961100
type: string
10971101
required:
10981102
- enabled
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
switched to db myApp
2+
{ "_id" : , "x" : 100501 }
3+
{ "_id" : , "x" : 100502 }
4+
bye
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
switched to db myApp
2+
{ "_id" : , "x" : 100501 }
3+
bye
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
switched to db myApp
2+
{ "_id" : , "x" : 100500 }
3+
bye
Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
apiVersion: apps/v1
2+
kind: StatefulSet
3+
metadata:
4+
annotations:
5+
percona.com/restore-in-progress: "true"
6+
generation: 2
7+
labels:
8+
app.kubernetes.io/component: mongod
9+
app.kubernetes.io/instance: some-name
10+
app.kubernetes.io/managed-by: percona-server-mongodb-operator
11+
app.kubernetes.io/name: percona-server-mongodb
12+
app.kubernetes.io/part-of: percona-server-mongodb
13+
app.kubernetes.io/replset: rs0
14+
name: some-name-rs0
15+
ownerReferences:
16+
- controller: true
17+
kind: PerconaServerMongoDB
18+
name: some-name
19+
spec:
20+
podManagementPolicy: OrderedReady
21+
replicas: 3
22+
revisionHistoryLimit: 10
23+
selector:
24+
matchLabels:
25+
app.kubernetes.io/component: mongod
26+
app.kubernetes.io/instance: some-name
27+
app.kubernetes.io/managed-by: percona-server-mongodb-operator
28+
app.kubernetes.io/name: percona-server-mongodb
29+
app.kubernetes.io/part-of: percona-server-mongodb
30+
app.kubernetes.io/replset: rs0
31+
serviceName: some-name-rs0
32+
template:
33+
metadata:
34+
annotations: {}
35+
labels:
36+
app.kubernetes.io/component: mongod
37+
app.kubernetes.io/instance: some-name
38+
app.kubernetes.io/managed-by: percona-server-mongodb-operator
39+
app.kubernetes.io/name: percona-server-mongodb
40+
app.kubernetes.io/part-of: percona-server-mongodb
41+
app.kubernetes.io/replset: rs0
42+
spec:
43+
containers:
44+
- args:
45+
- --bind_ip_all
46+
- --auth
47+
- --dbpath=/data/db
48+
- --port=27017
49+
- --replSet=rs0
50+
- --storageEngine=wiredTiger
51+
- --relaxPermChecks
52+
- --sslAllowInvalidCertificates
53+
- --clusterAuthMode=x509
54+
- --tlsMode=preferTLS
55+
- --shardsvr
56+
- --enableEncryption
57+
- --encryptionKeyFile=/etc/mongodb-encryption/encryption-key
58+
- --wiredTigerCacheSizeGB=0.25
59+
- --wiredTigerIndexPrefixCompression=true
60+
- --config=/etc/mongodb-config/mongod.conf
61+
- --quiet
62+
command:
63+
- /opt/percona/physical-restore-ps-entry.sh
64+
env:
65+
- name: SERVICE_NAME
66+
value: some-name
67+
- name: MONGODB_PORT
68+
value: "27017"
69+
- name: MONGODB_REPLSET
70+
value: rs0
71+
- name: PBM_AGENT_MONGODB_USERNAME
72+
valueFrom:
73+
secretKeyRef:
74+
key: MONGODB_BACKUP_USER_ESCAPED
75+
name: internal-some-name-users
76+
optional: false
77+
- name: PBM_AGENT_MONGODB_PASSWORD
78+
valueFrom:
79+
secretKeyRef:
80+
key: MONGODB_BACKUP_PASSWORD_ESCAPED
81+
name: internal-some-name-users
82+
optional: false
83+
- name: POD_NAME
84+
valueFrom:
85+
fieldRef:
86+
apiVersion: v1
87+
fieldPath: metadata.name
88+
- name: PBM_MONGODB_URI
89+
value: mongodb://$(PBM_AGENT_MONGODB_USERNAME):$(PBM_AGENT_MONGODB_PASSWORD)@$(POD_NAME)
90+
envFrom:
91+
- secretRef:
92+
name: internal-some-name-users
93+
optional: false
94+
imagePullPolicy: Always
95+
livenessProbe:
96+
exec:
97+
command:
98+
- /opt/percona/mongodb-healthcheck
99+
- k8s
100+
- liveness
101+
- --ssl
102+
- --sslInsecure
103+
- --sslCAFile
104+
- /etc/mongodb-ssl/ca.crt
105+
- --sslPEMKeyFile
106+
- /tmp/tls.pem
107+
- --startupDelaySeconds
108+
- "7200"
109+
failureThreshold: 4
110+
initialDelaySeconds: 60
111+
periodSeconds: 30
112+
successThreshold: 1
113+
timeoutSeconds: 10
114+
name: mongod
115+
ports:
116+
- containerPort: 27017
117+
name: mongodb
118+
protocol: TCP
119+
readinessProbe:
120+
exec:
121+
command:
122+
- /opt/percona/mongodb-healthcheck
123+
- k8s
124+
- readiness
125+
- --component
126+
- mongod
127+
failureThreshold: 8
128+
initialDelaySeconds: 10
129+
periodSeconds: 3
130+
successThreshold: 1
131+
timeoutSeconds: 2
132+
resources:
133+
limits:
134+
cpu: 500m
135+
memory: 1G
136+
requests:
137+
cpu: 100m
138+
memory: 100M
139+
securityContext:
140+
runAsNonRoot: true
141+
terminationMessagePath: /dev/termination-log
142+
terminationMessagePolicy: File
143+
volumeMounts:
144+
- mountPath: /data/db
145+
name: mongod-data
146+
- mountPath: /etc/mongodb-secrets
147+
name: some-name-mongodb-keyfile
148+
readOnly: true
149+
- mountPath: /etc/mongodb-ssl
150+
name: ssl
151+
readOnly: true
152+
- mountPath: /etc/mongodb-ssl-internal
153+
name: ssl-internal
154+
readOnly: true
155+
- mountPath: /etc/mongodb-config
156+
name: config
157+
- mountPath: /opt/percona
158+
name: bin
159+
- mountPath: /etc/mongodb-encryption
160+
name: some-name-mongodb-encryption-key
161+
readOnly: true
162+
- mountPath: /etc/users-secret
163+
name: users-secret-file
164+
- mountPath: /etc/pbm/
165+
name: pbm-config
166+
readOnly: true
167+
workingDir: /data/db
168+
dnsPolicy: ClusterFirst
169+
initContainers:
170+
- command:
171+
- /init-entrypoint.sh
172+
imagePullPolicy: Always
173+
name: mongo-init
174+
resources:
175+
limits:
176+
cpu: 500m
177+
memory: 1G
178+
requests:
179+
cpu: 100m
180+
memory: 100M
181+
terminationMessagePath: /dev/termination-log
182+
terminationMessagePolicy: File
183+
volumeMounts:
184+
- mountPath: /data/db
185+
name: mongod-data
186+
- mountPath: /opt/percona
187+
name: bin
188+
- command:
189+
- bash
190+
- -c
191+
- install -D /usr/bin/pbm /opt/percona/pbm && install -D /usr/bin/pbm-agent /opt/percona/pbm-agent
192+
imagePullPolicy: Always
193+
name: pbm-init
194+
resources: {}
195+
terminationMessagePath: /dev/termination-log
196+
terminationMessagePolicy: File
197+
volumeMounts:
198+
- mountPath: /data/db
199+
name: mongod-data
200+
- mountPath: /opt/percona
201+
name: bin
202+
restartPolicy: Always
203+
schedulerName: default-scheduler
204+
securityContext: {}
205+
serviceAccount: default
206+
serviceAccountName: default
207+
terminationGracePeriodSeconds: 60
208+
volumes:
209+
- name: some-name-mongodb-keyfile
210+
secret:
211+
defaultMode: 288
212+
optional: false
213+
secretName: some-name-mongodb-keyfile
214+
- emptyDir: {}
215+
name: bin
216+
- configMap:
217+
defaultMode: 420
218+
name: some-name-rs0-mongod
219+
optional: true
220+
name: config
221+
- name: some-name-mongodb-encryption-key
222+
secret:
223+
defaultMode: 288
224+
optional: false
225+
secretName: some-name-mongodb-encryption-key
226+
- name: ssl
227+
secret:
228+
defaultMode: 288
229+
optional: false
230+
secretName: some-name-ssl
231+
- name: ssl-internal
232+
secret:
233+
defaultMode: 288
234+
optional: true
235+
secretName: some-name-ssl-internal
236+
- name: users-secret-file
237+
secret:
238+
defaultMode: 420
239+
secretName: internal-some-name-users
240+
- name: pbm-config
241+
secret:
242+
defaultMode: 420
243+
secretName: some-name-pbm-config
244+
updateStrategy:
245+
rollingUpdate:
246+
partition: 0
247+
type: RollingUpdate
248+
volumeClaimTemplates:
249+
- metadata:
250+
name: mongod-data
251+
spec:
252+
accessModes:
253+
- ReadWriteOnce
254+
resources:
255+
requests:
256+
storage: 3Gi
257+
status:
258+
phase: Pending

0 commit comments

Comments
 (0)