Skip to content

Commit 9b27884

Browse files
committed
feat(mariadb): Add recovery configuration and backup definitions for Ceph and MinIO
1 parent b3c4d2e commit 9b27884

File tree

4 files changed

+100
-45
lines changed

4 files changed

+100
-45
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
apiVersion: k8s.mariadb.com/v1alpha1
3+
kind: PhysicalBackup
4+
metadata:
5+
name: mariadb-galera-backup-ceph
6+
namespace: mariadb-galera
7+
spec:
8+
mariaDbRef:
9+
name: mariadb-galera
10+
schedule:
11+
cron: "0 */6 * * *"
12+
suspend: false
13+
immediate: true
14+
maxRetention: 720h # 30 days
15+
compression: bzip2
16+
storage:
17+
s3:
18+
bucket: mariadb-galera-backup
19+
prefix: backups
20+
endpoint: s3.onelite.feather:7480
21+
accessKeyIdSecretKeyRef:
22+
name: mariadb
23+
key: ceph-access-key-id
24+
secretAccessKeySecretKeyRef:
25+
name: mariadb
26+
key: ceph-secret-access-key
27+
# Define a PVC to use as staging area for keeping the backups while they are being processed.
28+
stagingStorage:
29+
persistentVolumeClaim:
30+
resources:
31+
requests:
32+
storage: 50Gi
33+
accessModes:
34+
- ReadWriteOnce
35+
timeout: 1h
36+
# podAffinity: true
37+
# serviceAccountName: backup
38+
resources:
39+
requests:
40+
cpu: 100m
41+
memory: 128Mi
42+
limits:
43+
cpu: 300m
44+
memory: 512Mi
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
apiVersion: k8s.mariadb.com/v1alpha1
3+
kind: PhysicalBackup
4+
metadata:
5+
name: mariadb-galera-backup
6+
namespace: mariadb-galera
7+
spec:
8+
mariaDbRef:
9+
name: mariadb-galera
10+
schedule:
11+
cron: "0 */6 * * *"
12+
suspend: false
13+
immediate: true
14+
maxRetention: 720h # 30 days
15+
compression: bzip2
16+
storage:
17+
s3:
18+
bucket: mariadb-galera-backup
19+
prefix: backups
20+
endpoint: minio.minio.svc.cluster.local:9000
21+
accessKeyIdSecretKeyRef:
22+
name: mariadb
23+
key: access-key-id
24+
secretAccessKeySecretKeyRef:
25+
name: mariadb
26+
key: secret-access-key
27+
# Define a PVC to use as staging area for keeping the backups while they are being processed.
28+
stagingStorage:
29+
persistentVolumeClaim:
30+
resources:
31+
requests:
32+
storage: 50Gi
33+
accessModes:
34+
- ReadWriteOnce
35+
timeout: 1h
36+
# podAffinity: true
37+
# serviceAccountName: backup
38+
resources:
39+
requests:
40+
cpu: 100m
41+
memory: 128Mi
42+
limits:
43+
cpu: 300m
44+
memory: 512Mi

apps/clusters/prod/apps/mariadb-galera/kustomization.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ resources:
1010
- databases
1111
- grants
1212
- passwords
13+
- backup-to-ceph.yaml
14+
- backup-to-s3.yaml
1315

1416
secretGenerator:
1517
- name: mariadb

apps/clusters/prod/apps/mariadb-galera/mariadb.yaml

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ spec:
88
replicas: 5
99
galera:
1010
enabled: true
11+
recovery:
12+
enabled: true
13+
minClusterSize: 1
14+
clusterMonitorInterval: 10s
15+
clusterHealthyTimeout: 30s
16+
clusterBootstrapTimeout: 10m
17+
podRecoveryTimeout: 10m
18+
podSyncTimeout: 10m
19+
forceClusterBootstrapInPod: mariadb-galera-0
1120
myCnf: |
1221
[mariadb]
1322
bind-address=*
@@ -57,50 +66,6 @@ spec:
5766
enabled: false
5867
---
5968
apiVersion: k8s.mariadb.com/v1alpha1
60-
kind: PhysicalBackup
61-
metadata:
62-
name: mariadb-galera-backup
63-
namespace: mariadb-galera
64-
spec:
65-
mariaDbRef:
66-
name: mariadb-galera
67-
schedule:
68-
cron: "0 */6 * * *"
69-
suspend: false
70-
immediate: true
71-
maxRetention: 720h # 30 days
72-
compression: bzip2
73-
storage:
74-
s3:
75-
bucket: mariadb-galera-backup
76-
prefix: backups
77-
endpoint: minio.minio.svc.cluster.local:9000
78-
accessKeyIdSecretKeyRef:
79-
name: mariadb
80-
key: access-key-id
81-
secretAccessKeySecretKeyRef:
82-
name: mariadb
83-
key: secret-access-key
84-
# Define a PVC to use as staging area for keeping the backups while they are being processed.
85-
stagingStorage:
86-
persistentVolumeClaim:
87-
resources:
88-
requests:
89-
storage: 50Gi
90-
accessModes:
91-
- ReadWriteOnce
92-
timeout: 1h
93-
# podAffinity: true
94-
# serviceAccountName: backup
95-
resources:
96-
requests:
97-
cpu: 100m
98-
memory: 128Mi
99-
limits:
100-
cpu: 300m
101-
memory: 512Mi
102-
---
103-
apiVersion: k8s.mariadb.com/v1alpha1
10469
kind: MaxScale
10570
metadata:
10671
name: maxscale-galera
@@ -124,4 +89,4 @@ spec:
12489
io.cilium/lb-ipam-ips: 10.200.32.7
12590

12691
metrics:
127-
enabled: true
92+
enabled: false

0 commit comments

Comments
 (0)