Skip to content

Commit a7e9e7b

Browse files
committed
(openvpn) deploy mariadb operator
1 parent b36583e commit a7e9e7b

File tree

13 files changed

+282
-0
lines changed

13 files changed

+282
-0
lines changed

fleet/lib/mariadb-operator/fleet.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
defaultNamespace: &name mariadb-system
3+
namespaceLabels:
4+
lsst.io/discover: "true"
5+
labels:
6+
bundle: *name
7+
helm:
8+
chart: mariadb-operator
9+
releaseName: mariadb-operator
10+
repo: https://helm.mariadb.com/mariadb-operator
11+
version: 0.38.1
12+
waitForJobs: true
13+
timeoutSeconds: 900
14+
values:
15+
crds:
16+
enabled: true
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: metallb.io/v1beta1
2+
kind: IPAddressPool
3+
metadata:
4+
name: openvpndb
5+
namespace: metallb-system
6+
spec:
7+
addresses:
8+
- 139.229.134.140/32
9+
- 139.229.134.145/32
10+
- 139.229.134.146/32
11+
autoAssign: false
12+
---
13+
apiVersion: metallb.io/v1beta1
14+
kind: L2Advertisement
15+
metadata:
16+
name: openvpndb
17+
namespace: metallb-system
18+
spec:
19+
ipAddressPools:
20+
- openvpndb
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apiVersion: external-secrets.io/v1beta1
2+
kind: ExternalSecret
3+
metadata:
4+
name: dockerhub-secret
5+
namespace: openvpn-db
6+
spec:
7+
secretStoreRef:
8+
kind: ClusterSecretStore
9+
name: onepassword
10+
target:
11+
name: dockerhub-secret
12+
creationPolicy: Owner
13+
template:
14+
type: kubernetes.io/dockerconfigjson
15+
data:
16+
.dockerconfigjson: |
17+
{
18+
"auths": {
19+
"docker.io": {
20+
"username": "{{ .dockerhub_username }}",
21+
"password": "{{ .dockerhub_token }}",
22+
"auth": "{{ printf "%s:%s" .dockerhub_username .dockerhub_token | b64enc }}"
23+
}
24+
}
25+
}
26+
data:
27+
- secretKey: dockerhub_username
28+
remoteRef:
29+
key: lsstitadmin-docker-hub
30+
property: username
31+
- secretKey: dockerhub_token
32+
remoteRef:
33+
key: lsstitadmin-docker-hub
34+
property: docker hub api token
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: external-secrets.io/v1beta1
2+
kind: ExternalSecret
3+
metadata:
4+
name: mariadb
5+
namespace: openvpn-db
6+
spec:
7+
secretStoreRef:
8+
kind: ClusterSecretStore
9+
name: onepassword
10+
target:
11+
name: mariadb
12+
creationPolicy: Owner
13+
data:
14+
- secretKey: mariadb-root-password
15+
remoteRef:
16+
key: openvpn-mariadb-credentials
17+
property: mariadb-root-password
18+
- secretKey: mariadb-replication-password
19+
remoteRef:
20+
key: openvpn-mariadb-credentials
21+
property: mariadb-replication-password
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
resources:
2+
- external-secret-dockerhub.yaml
3+
- external-secret-openvpndb.yaml
4+
- mariadb-headless-service.yaml
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: mariadb-galera
5+
namespace: openvpn-db
6+
spec:
7+
clusterIP: None
8+
selector:
9+
app.kubernetes.io/name: mariadb
10+
ports:
11+
- protocol: TCP
12+
port: 3306
13+
targetPort: 3306

fleet/lib/openvpn-db-pre/fleet.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
defaultNamespace: openvpn-db
2+
labels:
3+
bundle: openvpn-db-pre
4+
name: openvpn-db-pre
5+
kustomize:
6+
dir: base
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
resources:
2+
- mariadb-cr.yaml
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
apiVersion: k8s.mariadb.com/v1alpha1
2+
kind: MariaDB
3+
metadata:
4+
name: mariadb
5+
namespace: openvpn-db
6+
spec:
7+
replicas: 3
8+
galera:
9+
enabled: true
10+
primary:
11+
podIndex: 0
12+
automaticFailover: true
13+
sst: mariabackup
14+
rootPasswordSecretKeyRef:
15+
name: mariadb
16+
key: mariadb-root-password
17+
username: mariadb
18+
passwordSecretKeyRef:
19+
name: mariadb
20+
key: mariadb-root-password
21+
database: mariadb
22+
image: docker.io/library/mariadb:11.4.5
23+
imagePullPolicy: IfNotPresent
24+
imagePullSecrets:
25+
- name: dockerhub-secret
26+
port: 3306
27+
storage:
28+
size: 5Gi
29+
storageClassName: rook-ceph-block
30+
volumeClaimTemplate:
31+
accessModes: [ReadWriteOnce]
32+
resources:
33+
requests:
34+
storage: 5Gi
35+
storageClassName: rook-ceph-block
36+
connection:
37+
secretName: connection-mariadb
38+
secretTemplate:
39+
key: dsn
40+
healthCheck:
41+
interval: 10s
42+
retryInterval: 3s
43+
params:
44+
parseTime: "true"
45+
myCnf: |
46+
[mariadb]
47+
bind-address=*
48+
default_storage_engine=InnoDB
49+
binlog_format=row
50+
innodb_autoinc_lock_mode=2
51+
innodb_buffer_pool_size=1024M
52+
max_allowed_packet=256M
53+
54+
[galera]
55+
wsrep_on=ON
56+
wsrep_provider=/usr/lib/galera/libgalera_smm.so
57+
wsrep_cluster_name=mariadb-galera
58+
wsrep_sst_method=mariabackup
59+
wsrep_cluster_address=gcomm://mariadb-galera.openvpn-db.svc.cluster.local
60+
timeZone: UTC
61+
resources:
62+
requests:
63+
cpu: 100m
64+
memory: 128Mi
65+
limits:
66+
cpu: 500m
67+
memory: 1Gi
68+
env:
69+
- name: TZ
70+
value: SYSTEM
71+
- name: MARIADB_ROOT_PASSWORD
72+
valueFrom:
73+
secretKeyRef:
74+
name: mariadb
75+
key: mariadb-root-password
76+
podSecurityContext:
77+
runAsUser: 0
78+
securityContext:
79+
allowPrivilegeEscalation: false
80+
livenessProbe:
81+
exec:
82+
command:
83+
- bash
84+
- -c
85+
- mariadb -u root -p"$MARIADB_ROOT_PASSWORD" -e "SELECT 1;"
86+
periodSeconds: 10
87+
timeoutSeconds: 5
88+
readinessProbe:
89+
exec:
90+
command:
91+
- bash
92+
- -c
93+
- mariadb -u root -p"$MARIADB_ROOT_PASSWORD" -e "SELECT 1;"
94+
periodSeconds: 10
95+
timeoutSeconds: 5
96+
startupProbe:
97+
exec:
98+
command:
99+
- bash
100+
- -c
101+
- mariadb -u root -p"$MARIADB_ROOT_PASSWORD" -e "SELECT 1;"
102+
failureThreshold: 30
103+
periodSeconds: 10
104+
timeoutSeconds: 5
105+
podDisruptionBudget:
106+
maxUnavailable: 50%
107+
updateStrategy:
108+
type: ReplicasFirstPrimaryLast
109+
service:
110+
type: LoadBalancer
111+
metadata:
112+
annotations:
113+
metallb.universe.tf/address-pool: openvpndb
114+
loadBalancerIP: 139.229.134.140
115+
externalTrafficPolicy: Cluster
116+
sessionAffinity: None
117+
primaryService:
118+
type: LoadBalancer
119+
metadata:
120+
annotations:
121+
metallb.universe.tf/address-pool: openvpndb
122+
loadBalancerIP: 139.229.134.145
123+
externalTrafficPolicy: Cluster
124+
secondaryService:
125+
type: LoadBalancer
126+
metadata:
127+
annotations:
128+
metallb.universe.tf/address-pool: openvpndb
129+
loadBalancerIP: 139.229.134.146
130+
externalTrafficPolicy: Cluster
131+
tolerations:
132+
- key: k8s.mariadb.com/ha
133+
operator: Exists
134+
effect: NoSchedule
135+
nodeSelector:
136+
k8s.mariadb.com/node: ha
137+
affinity:
138+
podAntiAffinity:
139+
preferredDuringSchedulingIgnoredDuringExecution:
140+
- weight: 100
141+
podAffinityTerm:
142+
labelSelector:
143+
matchLabels:
144+
app.kubernetes.io/name: mariadb
145+
topologyKey: kubernetes.io/hostname
146+
metrics:
147+
enabled: true
148+
suspend: false

fleet/lib/openvpn-db/fleet.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
defaultNamespace: &name openvpn-db
2+
labels:
3+
bundle: *name
4+
dependsOn:
5+
- name: mariadb-operator
6+
namespace: mariadb-system
7+
- name: openvpn-db-pre
8+
namespace: openvpn-db
9+
kustomize:
10+
dir: base
11+
targetCustomizations:
12+
- name: ruka
13+
clusterName: ruka
14+
kustomize:
15+
dir: overlays/ruka

0 commit comments

Comments
 (0)