Skip to content

Commit 5a4a6d1

Browse files
required changes implemented
1 parent 5e1ac67 commit 5a4a6d1

File tree

5 files changed

+112
-84
lines changed

5 files changed

+112
-84
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,15 @@ module "mysql" {
116116
## IAM Permissions
117117
The required IAM permissions to create resources from this module can be found [here](https://github.com/squareops/terraform-kubernetes-mysql/blob/main/IAM.md)
118118

119+
## Backup
120+
- In order to enable backup, it require database names like "db1, db2" or if it is blank it will backup all database without sys, information schema, performance schema and mysql.
121+
- command using to do backup:
122+
```
123+
mysqldump -h$HOST -u$USER -p$PASSWORD --databases db_name > full-backup.sql
124+
```
125+
## Restore
126+
- In order to enable backup, backup should be in .sql or .zip extention.
127+
119128
## Important Notes
120129
1. In order to enable the exporter, it is required to deploy Prometheus/Grafana first.
121130
2. The exporter is a tool that extracts metrics data from an application or system and makes it available to be scraped by Prometheus.
Lines changed: 79 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,103 @@
11
primary:
2-
affinity:
3-
nodeAffinity:
4-
requiredDuringSchedulingIgnoredDuringExecution:
5-
nodeSelectorTerms:
6-
- matchExpressions:
7-
- key: "Infra-Services"
8-
operator: In
9-
values:
10-
- "true"
11-
resources:
12-
limits:
13-
cpu: 350m
14-
memory: 1Gi
15-
requests:
16-
cpu: 200m
17-
memory: 700Mi
18-
19-
sidecars:
20-
- name: slow-log
21-
image: busybox:1.28
22-
args: [/bin/sh, -c, 'tail -n+1 -F /bitnami/mysql/slow-log.log']
23-
volumeMounts:
24-
- name: data
25-
mountPath: /bitnami/mysql
26-
resources:
2+
affinity:
3+
nodeAffinity:
4+
requiredDuringSchedulingIgnoredDuringExecution:
5+
nodeSelectorTerms:
6+
- matchExpressions:
7+
- key: "Infra-Services"
8+
operator: In
9+
values:
10+
- "true"
11+
resources:
2712
limits:
28-
cpu: 100m
29-
memory: 256Mi
13+
cpu: 350m
14+
memory: 1Gi
3015
requests:
31-
cpu: 50m
32-
memory: 128Mi
16+
cpu: 200m
17+
memory: 700Mi
3318

34-
secondary:
35-
affinity:
36-
nodeAffinity:
37-
requiredDuringSchedulingIgnoredDuringExecution:
38-
nodeSelectorTerms:
39-
- matchExpressions:
40-
- key: "Infra-Services"
41-
operator: In
42-
values:
43-
- "true"
19+
sidecars:
20+
- name: slow-log
21+
image: busybox:1.28
22+
args: [/bin/sh, -c, 'tail -n+1 -F /bitnami/mysql/slow-log.log']
23+
volumeMounts:
24+
- name: data
25+
mountPath: /bitnami/mysql
26+
resources:
27+
limits:
28+
cpu: 100m
29+
memory: 256Mi
30+
requests:
31+
cpu: 50m
32+
memory: 128Mi
4433

45-
resources:
46-
limits:
47-
cpu: 350m
48-
memory: 1Gi
49-
requests:
50-
cpu: 200m
51-
memory: 700Mi
34+
secondary:
35+
affinity:
36+
nodeAffinity:
37+
requiredDuringSchedulingIgnoredDuringExecution:
38+
nodeSelectorTerms:
39+
- matchExpressions:
40+
- key: "Infra-Services"
41+
operator: In
42+
values:
43+
- "true"
5244

53-
sidecars:
54-
- name: slow-log
55-
image: busybox:1.28
56-
args: [/bin/sh, -c, 'tail -n+1 -F /bitnami/mysql/slow-log.log']
57-
volumeMounts:
58-
- name: data
59-
mountPath: /bitnami/mysql
60-
resources:
45+
resources:
6146
limits:
62-
cpu: 100m
63-
memory: 256Mi
47+
cpu: 350m
48+
memory: 1Gi
6449
requests:
65-
cpu: 50m
66-
memory: 128Mi
50+
cpu: 200m
51+
memory: 700Mi
52+
53+
sidecars:
54+
- name: slow-log
55+
image: busybox:1.28
56+
args: [/bin/sh, -c, 'tail -n+1 -F /bitnami/mysql/slow-log.log']
57+
volumeMounts:
58+
- name: data
59+
mountPath: /bitnami/mysql
60+
resources:
61+
limits:
62+
cpu: 100m
63+
memory: 256Mi
64+
requests:
65+
cpu: 50m
66+
memory: 128Mi
6767

6868
metrics:
6969
resources:
7070
limits:
71-
cpu: 200m
72-
memory: 500Mi
71+
cpu: 200m
72+
memory: 500Mi
7373
requests:
74-
cpu: 10m
75-
memory: 50Mi
74+
cpu: 10m
75+
memory: 50Mi
7676

7777

78+
affinity:
79+
nodeAffinity:
80+
requiredDuringSchedulingIgnoredDuringExecution:
81+
nodeSelectorTerms:
82+
- matchExpressions:
83+
- key: "Infra-Services"
84+
operator: In
85+
values:
86+
- "true"
7887
backupjob:
7988
resources:
8089
requests:
81-
memory: 100Mi
82-
cpu: 50m
83-
limits:
84-
memory: 200Mi
90+
memory: 250Mi
8591
cpu: 100m
92+
limits:
93+
memory: 500Mi
94+
cpu: 200m
8695

8796
restorejob:
8897
resources:
8998
requests:
90-
memory: 100Mi
91-
cpu: 50m
99+
memory: 250Mi
100+
cpu: 100m
92101
limits:
93-
memory: 200Mi
94-
cpu: 100m
102+
memory: 500Mi
103+
cpu: 200m

helm/values/mysqldb/values.yaml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -468,12 +468,16 @@ primary:
468468
- name: data
469469
mountPath: /bitnami/mysql
470470
resources:
471-
limits:
472-
cpu: 100m
473-
memory: 256Mi
474-
requests:
475-
cpu: 50m
476-
memory: 128Mi
471+
## Example:
472+
## limits:
473+
## cpu: 100m
474+
## memory: 256Mi
475+
limits: {}
476+
## Examples:
477+
## requests:
478+
## cpu: 100m
479+
## memory: 256Mi
480+
requests: {}
477481

478482

479483
## MySQL Primary Service parameters
@@ -851,12 +855,16 @@ secondary:
851855
- name: data
852856
mountPath: /bitnami/mysql
853857
resources:
854-
limits:
855-
cpu: 100m
856-
memory: 256Mi
857-
requests:
858-
cpu: 50m
859-
memory: 128Mi
858+
## Example:
859+
## limits:
860+
## cpu: 100m
861+
## memory: 256Mi
862+
limits: {}
863+
## Examples:
864+
## requests:
865+
## cpu: 100m
866+
## memory: 256Mi
867+
requests: {}
860868
## MySQL Secondary Service parameters
861869
##
862870
service:

modules/backup/templates/cronjob.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ spec:
1313
spec:
1414
template:
1515
spec:
16-
affinity: {{ .Values.affinity | toYaml | nindent 10 }}
16+
affinity:
17+
{{- toYaml .Values.affinity | nindent 12 }}
1718
restartPolicy: OnFailure
1819
imagePullSecrets:
1920
- name: regcred

modules/restore/templates/job.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ metadata:
55
spec:
66
template:
77
spec:
8-
affinity: {{ .Values.affinity | toYaml | nindent 6 }}
8+
affinity:
9+
{{- toYaml .Values.affinity | nindent 8 }}
910
serviceAccountName: sa-mysql-restore
1011
containers:
1112
- name: restore-mysqldb

0 commit comments

Comments
 (0)