-
Notifications
You must be signed in to change notification settings - Fork 5
/
k8s-sample.yaml
92 lines (92 loc) · 2.59 KB
/
k8s-sample.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
apiVersion: v1
kind: ConfigMap
metadata:
name: mysql-idb
labels:
name: mysql-idb
data:
bashrc: |
alias ls='ls --color=auto'
alias grep='grep --color=auto'
PS1='[\u@\h \W]\$ '
alias mysql-idb='python /opt/mysql_idb/main.py --config=/opt/mysql_idb/config.yml'
config.yml: |
input_ibds: "/old-data/mydb" # directory of backup ibd files
mysql_db_dir: "/new-data/mydb" # data directory of new database (pointing to database dir)
output: "/tmp/mysql_idb" # temp directory where to save sql file and sdi files
include_drop: true # include drop commands in sql output
apply_sql: false # apply sql files to dest (to connection_info)
skip_tbls: [] # exclude some tables
only_tbls: [] # only execute for specified tables
continue_on_error: false # if true, continue on sql execute error
skip_nonempty_tbl: false # if true, skip tables in new database if not empty while loading data from ibd
connection_info:
host: new-mysql.default.svc.cluster.local
port: 3306
user: root
passwd: "secretpassword"
db: mydb
charset: utf8
connect_timeout: 300
read_timeout: 300
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql-idb
labels:
name: mysql-idb
spec:
replicas: 1
selector:
matchLabels:
name: mysql-idb
strategy:
type: Recreate
template:
metadata:
labels:
name: mysql-idb
spec:
containers:
# Change image if needed
- image: ghcr.io/anyongjin/mysql_idb:mysql-8.4
imagePullPolicy: IfNotPresent
name: mysql-idb
resources:
# Setting minimum requirements for scheduling.
requests:
cpu: 2
memory: "2Gi"
limits: {}
livenessProbe: {}
readinessProbe: {}
command:
- bash
- -c
args: ["tail -f /dev/null"]
env: []
ports: []
volumeMounts:
- mountPath: /old-data
name: old-data
- mountPath: /new-data
name: new-data
- mountPath: /opt/mysql_idb/config.yml
subPath: config.yml
name: configs
- mountPath: /root/.bashrc
subPath: bashrc
name: configs
volumes:
- name: configs
configMap:
name: mysql-idb
- name: old-data
persistentVolumeClaim:
claimName: bad-mysql-data
- name: new-data
persistentVolumeClaim:
claimName: new-mysql-data
restartPolicy: Always
---