diff --git a/install/installer/cmd/testdata/render/customization/output.golden b/install/installer/cmd/testdata/render/customization/output.golden index 656cb7a2ce2d48..69bc012a2ea4db 100644 --- a/install/installer/cmd/testdata/render/customization/output.golden +++ b/install/installer/cmd/testdata/render/customization/output.golden @@ -7740,6 +7740,9 @@ spec: metadata: annotations: checksum/configuration: f96f510015050d9b0165d12f144f5eca5641c065ccbe9c75e64f58e81a9b3d8c + backup.velero.io/backup-volumes: backup + pre.hook.backup.velero.io/command: | + ["/bin/bash", "-c", "mysqldump -u root -p$MYSQL_ROOT_PASSWORD --databases $MYSQL_DATABASE gitpod-sessions -h 127.0.0.1 > /backup/mysqldump.sql"] labels: app.kubernetes.io/name: mysql helm.sh/chart: mysql-9.1.2 @@ -7849,6 +7852,8 @@ spec: - name: config mountPath: /opt/bitnami/mysql/conf/my.cnf subPath: my.cnf + - mountPath: /backup + name: backup volumes: - name: config configMap: @@ -7856,6 +7861,8 @@ spec: - name: custom-init-scripts configMap: name: db-init-scripts + - emptyDir: {} + name: backup volumeClaimTemplates: - metadata: name: data diff --git a/install/installer/cmd/testdata/render/external-registry/output.golden b/install/installer/cmd/testdata/render/external-registry/output.golden index 35f9fe685e7d8b..11025a557f398b 100644 --- a/install/installer/cmd/testdata/render/external-registry/output.golden +++ b/install/installer/cmd/testdata/render/external-registry/output.golden @@ -6831,6 +6831,9 @@ spec: metadata: annotations: checksum/configuration: f96f510015050d9b0165d12f144f5eca5641c065ccbe9c75e64f58e81a9b3d8c + backup.velero.io/backup-volumes: backup + pre.hook.backup.velero.io/command: | + ["/bin/bash", "-c", "mysqldump -u root -p$MYSQL_ROOT_PASSWORD --databases $MYSQL_DATABASE gitpod-sessions -h 127.0.0.1 > /backup/mysqldump.sql"] labels: app.kubernetes.io/name: mysql helm.sh/chart: mysql-9.1.2 @@ -6940,6 +6943,8 @@ spec: - name: config mountPath: /opt/bitnami/mysql/conf/my.cnf subPath: my.cnf + - mountPath: /backup + name: backup volumes: - name: config configMap: @@ -6947,6 +6952,8 @@ spec: - name: custom-init-scripts configMap: name: db-init-scripts + - emptyDir: {} + name: backup volumeClaimTemplates: - metadata: name: data diff --git a/install/installer/cmd/testdata/render/minimal/output.golden b/install/installer/cmd/testdata/render/minimal/output.golden index 0e6ccffccda8d1..48f32257da4170 100644 --- a/install/installer/cmd/testdata/render/minimal/output.golden +++ b/install/installer/cmd/testdata/render/minimal/output.golden @@ -7111,6 +7111,9 @@ spec: metadata: annotations: checksum/configuration: f96f510015050d9b0165d12f144f5eca5641c065ccbe9c75e64f58e81a9b3d8c + backup.velero.io/backup-volumes: backup + pre.hook.backup.velero.io/command: | + ["/bin/bash", "-c", "mysqldump -u root -p$MYSQL_ROOT_PASSWORD --databases $MYSQL_DATABASE gitpod-sessions -h 127.0.0.1 > /backup/mysqldump.sql"] labels: app.kubernetes.io/name: mysql helm.sh/chart: mysql-9.1.2 @@ -7220,6 +7223,8 @@ spec: - name: config mountPath: /opt/bitnami/mysql/conf/my.cnf subPath: my.cnf + - mountPath: /backup + name: backup volumes: - name: config configMap: @@ -7227,6 +7232,8 @@ spec: - name: custom-init-scripts configMap: name: db-init-scripts + - emptyDir: {} + name: backup volumeClaimTemplates: - metadata: name: data diff --git a/install/installer/cmd/testdata/render/statefulset-customization/output.golden b/install/installer/cmd/testdata/render/statefulset-customization/output.golden index 750a008e96f96d..57c0ad57448b25 100644 --- a/install/installer/cmd/testdata/render/statefulset-customization/output.golden +++ b/install/installer/cmd/testdata/render/statefulset-customization/output.golden @@ -7123,6 +7123,9 @@ spec: metadata: annotations: checksum/configuration: f96f510015050d9b0165d12f144f5eca5641c065ccbe9c75e64f58e81a9b3d8c + backup.velero.io/backup-volumes: backup + pre.hook.backup.velero.io/command: | + ["/bin/bash", "-c", "mysqldump -u root -p$MYSQL_ROOT_PASSWORD --databases $MYSQL_DATABASE gitpod-sessions -h 127.0.0.1 > /backup/mysqldump.sql"] labels: app.kubernetes.io/name: mysql helm.sh/chart: mysql-9.1.2 @@ -7232,6 +7235,8 @@ spec: - name: config mountPath: /opt/bitnami/mysql/conf/my.cnf subPath: my.cnf + - mountPath: /backup + name: backup volumes: - name: config configMap: @@ -7239,6 +7244,8 @@ spec: - name: custom-init-scripts configMap: name: db-init-scripts + - emptyDir: {} + name: backup volumeClaimTemplates: - metadata: name: data diff --git a/install/installer/third_party/charts/mysql/values.yaml b/install/installer/third_party/charts/mysql/values.yaml index 3eb935a0c87fad..953af47619df58 100644 --- a/install/installer/third_party/charts/mysql/values.yaml +++ b/install/installer/third_party/charts/mysql/values.yaml @@ -8,6 +8,18 @@ mysql: # We switched to the specific version because "5.7" was broken at least once tag: 5.7.34-debian-10-r55 primary: + # Backup settings + podAnnotations: + backup.velero.io/backup-volumes: backup + pre.hook.backup.velero.io/command: | + ["/bin/bash", "-c", "mysqldump -u root -p$MYSQL_ROOT_PASSWORD --databases $MYSQL_DATABASE gitpod-sessions -h 127.0.0.1 > /backup/mysqldump.sql"] + extraVolumes: + - name: backup + emptyDir: {} + extraVolumeMounts: + - name: backup + mountPath: /backup + # End of backup settings extraEnvVars: # We rely on this in our DB implementations: NULL (re-)sets configured columns to be initialized with CURRENT_TIMESTAMP. # 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: serviceAccount: create: false volumePermissions: - enabled: true \ No newline at end of file + enabled: true diff --git a/install/kots/manifests/gitpod-certificate.yaml b/install/kots/manifests/gitpod-certificate.yaml index 83700906e55850..549f8dced89825 100644 --- a/install/kots/manifests/gitpod-certificate.yaml +++ b/install/kots/manifests/gitpod-certificate.yaml @@ -23,3 +23,5 @@ spec: labels: app: gitpod component: gitpod-installer + kots.io/app-slug: '{{repl LicenseFieldValue "appSlug" }}' + kots.io/backup: velero diff --git a/install/kots/manifests/gitpod-installation-status.yaml b/install/kots/manifests/gitpod-installation-status.yaml index eb9d3763e5b400..5920d10eac106c 100644 --- a/install/kots/manifests/gitpod-installation-status.yaml +++ b/install/kots/manifests/gitpod-installation-status.yaml @@ -30,7 +30,7 @@ spec: containers: - name: installation-status # This will normally be the release tag - image: "eu.gcr.io/gitpod-core-dev/build/installer:nvn-fix-11408.15" + image: "eu.gcr.io/gitpod-core-dev/build/installer:sje-kots-backup.33" command: - /bin/sh - -c diff --git a/install/kots/manifests/gitpod-installer-job.yaml b/install/kots/manifests/gitpod-installer-job.yaml index b548a98823182f..4b7fc907859cad 100644 --- a/install/kots/manifests/gitpod-installer-job.yaml +++ b/install/kots/manifests/gitpod-installer-job.yaml @@ -28,7 +28,7 @@ spec: containers: - name: installer # This will normally be the release tag - image: "eu.gcr.io/gitpod-core-dev/build/installer:nvn-fix-11408.15" + image: "eu.gcr.io/gitpod-core-dev/build/installer:sje-kots-backup.33" volumeMounts: - mountPath: /config-patch name: config-patch diff --git a/install/kots/manifests/kots-backup.yaml b/install/kots/manifests/kots-backup.yaml new file mode 100644 index 00000000000000..d699b367336ddb --- /dev/null +++ b/install/kots/manifests/kots-backup.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2022 Gitpod GmbH. All rights reserved. +# Licensed under the MIT License. See License-MIT.txt in the project root for license information. + +apiVersion: velero.io/v1 +kind: Backup +metadata: + name: backup +spec: {}