Skip to content

Commit

Permalink
Merge pull request #1526 from GiganticMinecraft/maraidb-sts
Browse files Browse the repository at this point in the history
use sts mariadb instead of custom resource
  • Loading branch information
rito528 authored Dec 17, 2023
2 parents 3bccd53 + 2d8e6d7 commit 4e34c8a
Showing 1 changed file with 99 additions and 51 deletions.
Original file line number Diff line number Diff line change
@@ -1,58 +1,106 @@
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
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: {}

0 comments on commit 4e34c8a

Please sign in to comment.