Skip to content

Commit 8c28b1c

Browse files
author
Simon Emms
committed
mysql backup in kots
1 parent 1613e01 commit 8c28b1c

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
# Licensed under the MIT License. See License-MIT.txt in the project root for license information.
3+
4+
apiVersion: apps/v1
5+
kind: Deployment
6+
metadata:
7+
name: mysql-backup
8+
labels:
9+
app: gitpod
10+
component: mysql-backup
11+
annotations:
12+
kots.io/when: '{{repl (ConfigOptionEquals "db_incluster" "1") }}'
13+
spec:
14+
replicas: 1
15+
selector:
16+
matchLabels:
17+
app: gitpod
18+
component: mysql-backup
19+
strategy:
20+
rollingUpdate:
21+
maxSurge: 1
22+
maxUnavailable: 0
23+
type: RollingUpdate
24+
template:
25+
metadata:
26+
labels:
27+
app: gitpod
28+
component: mysql-backup
29+
annotations:
30+
backup.velero.io/backup-volumes: backup
31+
pre.hook.backup.velero.io/command: |
32+
["/bin/bash", "-c", "mysqldump --user root --password=$MYSQL_ROOT_PASSWORD --databases gitpod gitpod-sessions --host mysql > /backup/mysqldump.sql"]
33+
spec:
34+
restartPolicy: Always
35+
# serviceAccountName: installer # todo(sje): change
36+
containers:
37+
- name: mysql
38+
image: docker.io/bitnami/mysql:5.7.34-debian-10-r55 # Same as used by the Installer
39+
command:
40+
- sleep
41+
- infinity
42+
env:
43+
- name: MYSQL_ROOT_PASSWORD
44+
valueFrom:
45+
secretKeyRef:
46+
name: db-password
47+
key: mysql-root-password
48+
volumeMounts:
49+
- mountPath: /backup
50+
name: mysql
51+
resources:
52+
limits:
53+
memory: "128Mi"
54+
cpu: "500m"
55+
volumes:
56+
- name: backup
57+
emptyDir: {}

0 commit comments

Comments
 (0)