Skip to content

Commit 26c0506

Browse files
committed
K8SPSMDB-1602: address review comments and fix balancer failure during restore
1 parent e940723 commit 26c0506

14 files changed

Lines changed: 2737 additions & 81 deletions

File tree

coverage.html

Lines changed: 1900 additions & 0 deletions
Large diffs are not rendered by default.
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: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
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+
- --enableEncryption
56+
- --encryptionKeyFile=/etc/mongodb-encryption/encryption-key
57+
- --wiredTigerCacheSizeGB=0.25
58+
- --wiredTigerIndexPrefixCompression=true
59+
- --config=/etc/mongodb-config/mongod.conf
60+
- --quiet
61+
command:
62+
- /opt/percona/physical-restore-ps-entry.sh
63+
env:
64+
- name: SERVICE_NAME
65+
value: some-name
66+
- name: MONGODB_PORT
67+
value: "27017"
68+
- name: MONGODB_REPLSET
69+
value: rs0
70+
- name: PBM_AGENT_MONGODB_USERNAME
71+
valueFrom:
72+
secretKeyRef:
73+
key: MONGODB_BACKUP_USER_ESCAPED
74+
name: internal-some-name-users
75+
optional: false
76+
- name: PBM_AGENT_MONGODB_PASSWORD
77+
valueFrom:
78+
secretKeyRef:
79+
key: MONGODB_BACKUP_PASSWORD_ESCAPED
80+
name: internal-some-name-users
81+
optional: false
82+
- name: PBM_AGENT_SIDECAR
83+
value: "true"
84+
- name: PBM_AGENT_SIDECAR_SLEEP
85+
value: "5"
86+
- name: PBM_AGENT_TLS_ENABLED
87+
value: "true"
88+
- name: PBM_MONGODB_PORT
89+
value: "27017"
90+
- name: POD_NAME
91+
valueFrom:
92+
fieldRef:
93+
apiVersion: v1
94+
fieldPath: metadata.name
95+
- name: PBM_MONGODB_URI
96+
value: mongodb://$(PBM_AGENT_MONGODB_USERNAME):$(PBM_AGENT_MONGODB_PASSWORD)@localhost:$(PBM_MONGODB_PORT)/?tls=true&tlsCertificateKeyFile=/tmp/tls.pem&tlsCAFile=/etc/mongodb-ssl/ca.crt&tlsInsecure=true
97+
envFrom:
98+
- secretRef:
99+
name: internal-some-name-users
100+
optional: false
101+
imagePullPolicy: Always
102+
livenessProbe:
103+
exec:
104+
command:
105+
- /opt/percona/mongodb-healthcheck
106+
- k8s
107+
- liveness
108+
- --ssl
109+
- --sslInsecure
110+
- --sslCAFile
111+
- /etc/mongodb-ssl/ca.crt
112+
- --sslPEMKeyFile
113+
- /tmp/tls.pem
114+
- --startupDelaySeconds
115+
- "7200"
116+
failureThreshold: 4
117+
initialDelaySeconds: 60
118+
periodSeconds: 30
119+
successThreshold: 1
120+
timeoutSeconds: 10
121+
name: mongod
122+
ports:
123+
- containerPort: 27017
124+
name: mongodb
125+
protocol: TCP
126+
readinessProbe:
127+
exec:
128+
command:
129+
- /opt/percona/mongodb-healthcheck
130+
- k8s
131+
- readiness
132+
- --component
133+
- mongod
134+
- --ssl
135+
- --sslInsecure
136+
- --sslCAFile
137+
- /etc/mongodb-ssl/ca.crt
138+
- --sslPEMKeyFile
139+
- /tmp/tls.pem
140+
failureThreshold: 8
141+
initialDelaySeconds: 10
142+
periodSeconds: 3
143+
successThreshold: 1
144+
timeoutSeconds: 2
145+
resources:
146+
limits:
147+
cpu: 500m
148+
memory: 1G
149+
requests:
150+
cpu: 100m
151+
memory: 100M
152+
securityContext:
153+
runAsNonRoot: true
154+
terminationMessagePath: /dev/termination-log
155+
terminationMessagePolicy: File
156+
volumeMounts:
157+
- mountPath: /data/db
158+
name: mongod-data
159+
- mountPath: /etc/mongodb-secrets
160+
name: some-name-mongodb-keyfile
161+
readOnly: true
162+
- mountPath: /etc/mongodb-ssl
163+
name: ssl
164+
readOnly: true
165+
- mountPath: /etc/mongodb-ssl-internal
166+
name: ssl-internal
167+
readOnly: true
168+
- mountPath: /etc/mongodb-config
169+
name: config
170+
- mountPath: /opt/percona
171+
name: bin
172+
- mountPath: /.mongodb
173+
name: mongosh
174+
- mountPath: /etc/mongodb-encryption
175+
name: some-name-mongodb-encryption-key
176+
readOnly: true
177+
- mountPath: /etc/users-secret
178+
name: users-secret-file
179+
- mountPath: /etc/pbm/
180+
name: pbm-config
181+
readOnly: true
182+
workingDir: /data/db
183+
dnsPolicy: ClusterFirst
184+
initContainers:
185+
- command:
186+
- /init-entrypoint.sh
187+
imagePullPolicy: Always
188+
name: mongo-init
189+
resources:
190+
limits:
191+
cpu: 500m
192+
memory: 1G
193+
requests:
194+
cpu: 100m
195+
memory: 100M
196+
terminationMessagePath: /dev/termination-log
197+
terminationMessagePolicy: File
198+
volumeMounts:
199+
- mountPath: /data/db
200+
name: mongod-data
201+
- mountPath: /opt/percona
202+
name: bin
203+
- command:
204+
- bash
205+
- -c
206+
- install -D /usr/bin/pbm /opt/percona/pbm && install -D /usr/bin/pbm-agent /opt/percona/pbm-agent && install -D /usr/bin/pbm-agent-entrypoint /opt/percona/pbm-agent-entrypoint
207+
imagePullPolicy: Always
208+
name: pbm-init
209+
resources: {}
210+
terminationMessagePath: /dev/termination-log
211+
terminationMessagePolicy: File
212+
volumeMounts:
213+
- mountPath: /data/db
214+
name: mongod-data
215+
- mountPath: /opt/percona
216+
name: bin
217+
restartPolicy: Always
218+
schedulerName: default-scheduler
219+
securityContext: {}
220+
serviceAccount: default
221+
serviceAccountName: default
222+
terminationGracePeriodSeconds: 60
223+
volumes:
224+
- name: some-name-mongodb-keyfile
225+
secret:
226+
defaultMode: 288
227+
optional: false
228+
secretName: some-name-mongodb-keyfile
229+
- emptyDir: {}
230+
name: bin
231+
- emptyDir: {}
232+
name: mongosh
233+
- configMap:
234+
defaultMode: 420
235+
name: some-name-rs0-mongod
236+
optional: true
237+
name: config
238+
- name: some-name-mongodb-encryption-key
239+
secret:
240+
defaultMode: 288
241+
optional: false
242+
secretName: some-name-mongodb-encryption-key
243+
- name: ssl
244+
secret:
245+
defaultMode: 288
246+
optional: false
247+
secretName: some-name-ssl
248+
- name: ssl-internal
249+
secret:
250+
defaultMode: 288
251+
optional: true
252+
secretName: some-name-ssl-internal
253+
- name: users-secret-file
254+
secret:
255+
defaultMode: 420
256+
secretName: internal-some-name-users
257+
- name: pbm-config
258+
secret:
259+
defaultMode: 420
260+
secretName: some-name-pbm-config
261+
updateStrategy:
262+
type: OnDelete
263+
volumeClaimTemplates:
264+
- metadata:
265+
name: mongod-data
266+
spec:
267+
accessModes:
268+
- ReadWriteOnce
269+
resources:
270+
requests:
271+
storage: 3Gi
272+
status:
273+
phase: Pending

0 commit comments

Comments
 (0)