Skip to content

Commit d576047

Browse files
author
Simon Emms
committed
[installer]: add mysql backup annotations
1 parent 1613e01 commit d576047

File tree

5 files changed

+41
-1
lines changed

5 files changed

+41
-1
lines changed

install/installer/cmd/testdata/render/customization/output.golden

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7740,6 +7740,9 @@ spec:
77407740
metadata:
77417741
annotations:
77427742
checksum/configuration: f96f510015050d9b0165d12f144f5eca5641c065ccbe9c75e64f58e81a9b3d8c
7743+
backup.velero.io/backup-volumes: backup
7744+
pre.hook.backup.velero.io/command: |
7745+
["/bin/bash", "-c", "mysqldump -u root -p$MYSQL_ROOT_PASSWORD --databases $MYSQL_DATABASE gitpod-sessions -h 127.0.0.1 > /backup/mysqldump.sql"]
77437746
labels:
77447747
app.kubernetes.io/name: mysql
77457748
helm.sh/chart: mysql-9.1.2
@@ -7849,13 +7852,17 @@ spec:
78497852
- name: config
78507853
mountPath: /opt/bitnami/mysql/conf/my.cnf
78517854
subPath: my.cnf
7855+
- mountPath: /backup
7856+
name: backup
78527857
volumes:
78537858
- name: config
78547859
configMap:
78557860
name: mysql
78567861
- name: custom-init-scripts
78577862
configMap:
78587863
name: db-init-scripts
7864+
- emptyDir: {}
7865+
name: backup
78597866
volumeClaimTemplates:
78607867
- metadata:
78617868
name: data

install/installer/cmd/testdata/render/external-registry/output.golden

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6831,6 +6831,9 @@ spec:
68316831
metadata:
68326832
annotations:
68336833
checksum/configuration: f96f510015050d9b0165d12f144f5eca5641c065ccbe9c75e64f58e81a9b3d8c
6834+
backup.velero.io/backup-volumes: backup
6835+
pre.hook.backup.velero.io/command: |
6836+
["/bin/bash", "-c", "mysqldump -u root -p$MYSQL_ROOT_PASSWORD --databases $MYSQL_DATABASE gitpod-sessions -h 127.0.0.1 > /backup/mysqldump.sql"]
68346837
labels:
68356838
app.kubernetes.io/name: mysql
68366839
helm.sh/chart: mysql-9.1.2
@@ -6940,13 +6943,17 @@ spec:
69406943
- name: config
69416944
mountPath: /opt/bitnami/mysql/conf/my.cnf
69426945
subPath: my.cnf
6946+
- mountPath: /backup
6947+
name: backup
69436948
volumes:
69446949
- name: config
69456950
configMap:
69466951
name: mysql
69476952
- name: custom-init-scripts
69486953
configMap:
69496954
name: db-init-scripts
6955+
- emptyDir: {}
6956+
name: backup
69506957
volumeClaimTemplates:
69516958
- metadata:
69526959
name: data

install/installer/cmd/testdata/render/minimal/output.golden

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7111,6 +7111,9 @@ spec:
71117111
metadata:
71127112
annotations:
71137113
checksum/configuration: f96f510015050d9b0165d12f144f5eca5641c065ccbe9c75e64f58e81a9b3d8c
7114+
backup.velero.io/backup-volumes: backup
7115+
pre.hook.backup.velero.io/command: |
7116+
["/bin/bash", "-c", "mysqldump -u root -p$MYSQL_ROOT_PASSWORD --databases $MYSQL_DATABASE gitpod-sessions -h 127.0.0.1 > /backup/mysqldump.sql"]
71147117
labels:
71157118
app.kubernetes.io/name: mysql
71167119
helm.sh/chart: mysql-9.1.2
@@ -7220,13 +7223,17 @@ spec:
72207223
- name: config
72217224
mountPath: /opt/bitnami/mysql/conf/my.cnf
72227225
subPath: my.cnf
7226+
- mountPath: /backup
7227+
name: backup
72237228
volumes:
72247229
- name: config
72257230
configMap:
72267231
name: mysql
72277232
- name: custom-init-scripts
72287233
configMap:
72297234
name: db-init-scripts
7235+
- emptyDir: {}
7236+
name: backup
72307237
volumeClaimTemplates:
72317238
- metadata:
72327239
name: data

install/installer/cmd/testdata/render/statefulset-customization/output.golden

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7123,6 +7123,9 @@ spec:
71237123
metadata:
71247124
annotations:
71257125
checksum/configuration: f96f510015050d9b0165d12f144f5eca5641c065ccbe9c75e64f58e81a9b3d8c
7126+
backup.velero.io/backup-volumes: backup
7127+
pre.hook.backup.velero.io/command: |
7128+
["/bin/bash", "-c", "mysqldump -u root -p$MYSQL_ROOT_PASSWORD --databases $MYSQL_DATABASE gitpod-sessions -h 127.0.0.1 > /backup/mysqldump.sql"]
71267129
labels:
71277130
app.kubernetes.io/name: mysql
71287131
helm.sh/chart: mysql-9.1.2
@@ -7232,13 +7235,17 @@ spec:
72327235
- name: config
72337236
mountPath: /opt/bitnami/mysql/conf/my.cnf
72347237
subPath: my.cnf
7238+
- mountPath: /backup
7239+
name: backup
72357240
volumes:
72367241
- name: config
72377242
configMap:
72387243
name: mysql
72397244
- name: custom-init-scripts
72407245
configMap:
72417246
name: db-init-scripts
7247+
- emptyDir: {}
7248+
name: backup
72427249
volumeClaimTemplates:
72437250
- metadata:
72447251
name: data

install/installer/third_party/charts/mysql/values.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@ mysql:
88
# We switched to the specific version because "5.7" was broken at least once
99
tag: 5.7.34-debian-10-r55
1010
primary:
11+
# Backup settings
12+
podAnnotations:
13+
backup.velero.io/backup-volumes: backup
14+
pre.hook.backup.velero.io/command: |
15+
["/bin/bash", "-c", "mysqldump -u root -p$MYSQL_ROOT_PASSWORD --databases $MYSQL_DATABASE gitpod-sessions -h 127.0.0.1 > /backup/mysqldump.sql"]
16+
extraVolumes:
17+
- name: backup
18+
emptyDir: {}
19+
extraVolumeMounts:
20+
- name: backup
21+
mountPath: /backup
22+
# End of backup settings
1123
extraEnvVars:
1224
# We rely on this in our DB implementations: NULL (re-)sets configured columns to be initialized with CURRENT_TIMESTAMP.
1325
# OFF is the default as documented [here](https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_explicit_defaults_for_timestamp) (we also see this in GCP), but not for this chart.
@@ -19,4 +31,4 @@ mysql:
1931
serviceAccount:
2032
create: false
2133
volumePermissions:
22-
enabled: true
34+
enabled: true

0 commit comments

Comments
 (0)