mysql-clusters not used

This commit is contained in:
2025-08-07 16:34:56 +03:00
parent 5f90a41009
commit 796e9394ca
8 changed files with 0 additions and 20 deletions

View File

@@ -0,0 +1,10 @@
# MariaDB clusters
This is namespace for MariaDB clusters managed by Codemowers' sample
[mysql-database-operator](https://github.com/codemowers/operatorlib/tree/main/samples/mysql-database-operator)
which is deployed via [ArgoCD](https://argocd.k-space.ee/applications/argocd/mysql-database-operator)
```
kubectl create namespace mysql-clusters
kubectl apply -n mysql-clusters -f application.yaml
```

View File

@@ -0,0 +1,24 @@
---
apiVersion: codemowers.cloud/v1beta1
kind: MysqlDatabaseClass
metadata:
name: dedicated
annotations:
kubernetes.io/description: "Dedicated MySQL cluster"
spec:
reclaimPolicy: Retain
replicas: 3
routers: 2
storageClass: mysql
podSpec:
containers:
- name: mariadb
image: mirror.gcr.io/library/mariadb:10.9.7@sha256:198c7a5fea3d7285762042a628fe8f83f0a7ccef559605b4cc9502e65210880b
imagePullPolicy: IfNotPresent
nodeSelector:
dedicated: storage
tolerations:
- effect: NoSchedule
key: dedicated
operator: Equal
value: storage

View File

@@ -0,0 +1,40 @@
---
apiVersion: codemowers.cloud/v1beta1
kind: MysqlDatabaseClass
metadata:
name: external
annotations:
kubernetes.io/description: "External MySQL cluster"
spec:
reclaimPolicy: Retain
shared: true
---
apiVersion: v1
kind: Service
metadata:
name: primary-external
spec:
clusterIP: None
---
apiVersion: v1
kind: Service
metadata:
name: external
spec:
clusterIP: None
---
kind: Endpoints
apiVersion: v1
metadata:
name: primary-external
subsets:
- addresses:
- ip: 172.20.36.1
---
kind: Endpoints
apiVersion: v1
metadata:
name: external
subsets:
- addresses:
- ip: 172.20.36.1

View File

@@ -0,0 +1,109 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: phpmyadmin
namespace: mysql-clusters
data:
config.user.inc.php: |
<?php
for ($i = 1; isset($hosts[$i - 1]); $i++) {
$cfg['Servers'][$i]['ssl'] = true;
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: phpmyadmin
namespace: mysql-clusters
spec:
# phpMyAdmin session handling is not really compatible with more replicas
replicas: 1
selector:
matchLabels:
app: phpmyadmin
template:
metadata:
labels:
app: phpmyadmin
spec:
containers:
- name: phpmyadmin
image: mirror.gcr.io/phpmyadmin/phpmyadmin
ports:
- name: web
containerPort: 80
protocol: TCP
env:
- name: PMA_HOSTS
valueFrom:
configMapKeyRef:
name: phpmyadmin-connections
key: PMA_HOSTS
- name: PMA_PORTS
valueFrom:
configMapKeyRef:
name: phpmyadmin-connections
key: PMA_HOSTS
- name: PMA_ABSOLUTE_URI
value: https://phpmyadmin.k-space.ee/
- name: UPLOAD_LIMIT
value: 10G
volumes:
- name: config
configMap:
name: phpmyadmin
---
apiVersion: codemowers.cloud/v1beta1
kind: OIDCMiddlewareClient
metadata:
name: phpmyadmin
spec:
displayName: phpMyAdmin
uri: 'https://phpmyadmin.k-space.ee'
headerMapping:
email: Remote-Email
groups: Remote-Groups
name: Remote-Name
user: Remote-Username
allowedGroups:
- k-space:floor
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: phpmyadmin
namespace: mysql-clusters
annotations:
kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/router.entrypoints: websecure
external-dns.alpha.kubernetes.io/target: traefik.k-space.ee
traefik.ingress.kubernetes.io/router.middlewares: mysql-clusters-phpmyadmin@kubernetescrd
spec:
rules:
- host: phpmyadmin.k-space.ee
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: phpmyadmin
port:
number: 80
tls:
- hosts:
- "*.k-space.ee"
---
apiVersion: v1
kind: Service
metadata:
name: phpmyadmin
namespace: mysql-clusters
spec:
selector:
app: phpmyadmin
ports:
- protocol: TCP
port: 80
targetPort: 80

View File

@@ -0,0 +1,25 @@
---
apiVersion: codemowers.cloud/v1beta1
kind: MysqlDatabaseClass
metadata:
name: shared
annotations:
kubernetes.io/description: "Shared MySQL cluster"
spec:
reclaimPolicy: Retain
shared: true
replicas: 3
routers: 2
storageClass: mysql
podSpec:
containers:
- name: mariadb
image: mirror.gcr.io/library/mariadb:10.9.7@sha256:198c7a5fea3d7285762042a628fe8f83f0a7ccef559605b4cc9502e65210880b
imagePullPolicy: IfNotPresent
nodeSelector:
dedicated: storage
tolerations:
- effect: NoSchedule
key: dedicated
operator: Equal
value: storage

View File

@@ -0,0 +1,20 @@
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: mysql
annotations:
kubernetes.io/description: |
Storage class for MySQL, MariaDB and similar applications that
implement high availability in application layer.
This storage class uses XFS, has no block level redundancy and
has block device level caching disabled.
provisioner: csi.proxmox.sinextra.dev
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
parameters:
csi.storage.k8s.io/fstype: xfs
storage: ks-pvs
cache: none
ssd: "true"