Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use sts mariadb instead of custom resource #1526

Merged
merged 4 commits into from
Dec 17, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,58 +1,108 @@
apiVersion: mariadb.mmontes.io/v1alpha1
kind: MariaDB
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mariadb
spec:
initContainers:
- image: mariadb:10.11.6
env:
- name: DB_PASSWORD
replicas: 1
updateStrategy:
type: RollingUpdate
revisionHistoryLimit: 10
selector:
matchLabels:
app.kubernetes.io/instance: mariadb
app.kubernetes.io/name: mariadb
serviceName: mariadb
template:
metadata:
labels:
app.kubernetes.io/instance: mariadb
app.kubernetes.io/name: mariadb
name: mariadb
spec:
containers:
- name: mariadb
image: mariadb:10.11.6
imagePullPolicy: IfNotPresent
resources:
requests:
cpu: 4000m
memory: 4096Mi
limits:
cpu: 4000m
env:
- name: MYSQL_TCP_PORT
value: "3306"
- name: MARIADB_ROOT_HOST
value: '%'
- name: MARIADB_USER
value: mcserver
- name: MARIADB_PASSWORD
valueFrom:
secretKeyRef:
key: mcserver-password
name: mariadb-pr-review-password
- name: MARIADB_ALLOW_EMPTY_ROOT_PASSWORD
value: "true"
livenessProbe:
exec:
command:
- bash
- -c
- mariadb -u root -p"${MARIADB_ROOT_PASSWORD}" -e "SELECT 1;"
failureThreshold: 3
initialDelaySeconds: 20
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
readinessProbe:
exec:
command:
- bash
- -c
- mariadb -u root -p"${MARIADB_ROOT_PASSWORD}" -e "SELECT 1;"
failureThreshold: 3
initialDelaySeconds: 20
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
ports:
- containerPort: 3306
name: mariadb
protocol: TCP
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/lib/mysql
name: storage
- mountPath: /docker-entrypoint-initdb.d
name: sqldump-volume
initContainers:
- name: init-0
image: mariadb:10.11.6
imagePullPolicy: IfNotPresent
resources:
requests:
cpu: 4000m
memory: 4096Mi
env:
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
key: prod-mariadb-password
volumeMounts:
- name: sqldump-volume
mountPath: /docker-entrypoint-initdb.d
args:
- "sh"
- "-c"
- 'mysqldump -umcserver -p${DB_PASSWORD} -h192.168.2.186 --databases seichiassist flyway_managed_schema > /docker-entrypoint-initdb.d/seichiassist.sql'

rootPasswordSecretKeyRef:
name: mariadb-pr-review-password
key: root-password

database: seichiassist
username: mcserver
passwordSecretKeyRef:
name: mariadb-pr-review-password
key: mcserver-password

image: mariadb:10.11.6
imagePullPolicy: IfNotPresent

env:
- name: MARIADB_ALLOW_EMPTY_ROOT_PASSWORD
value: "true"

port: 3306

volumeClaimTemplate:
resources:
requests:
storage: 5Gi
storageClassName: synology-iscsi-storage-temp
accessModes:
- ReadWriteOnce

volumeMounts:
- name: sqldump-volume
mountPath: /docker-entrypoint-initdb.d

service:
type: ClusterIP

volumes:
- name: sqldump-volume
emptyDir: {}
name: mariadb-pr-review-password
args:
- sh
- -c
- mysqldump -umcserver -p${DB_PASSWORD} -h192.168.2.186 --databases seichiassist
flyway_managed_schema > /docker-entrypoint-initdb.d/seichiassist.sql
volumeMounts:
- mountPath: /docker-entrypoint-initdb.d
name: sqldump-volume
restartPolicy: Always
volumes:
- name: storage
emptyDir:
medium: Memory
sizeLimit: 4Gi
- name: sqldump-volume
emptyDir: {}