From 67b1e56916f683c942d1f2d04d5bfc2886cf28af Mon Sep 17 00:00:00 2001 From: Andrei Kvapil Date: Tue, 6 Feb 2024 09:34:01 +0100 Subject: [PATCH] mysql --- .../mysql/templates/haproxy/configmap.yaml | 29 -------- .../mysql/templates/haproxy/deployment.yaml | 67 ------------------- .../apps/mysql/templates/haproxy/service.yaml | 23 ------- packages/apps/mysql/templates/mariadb.yaml | 23 +++---- packages/apps/mysql/values.yaml | 27 +++----- 5 files changed, 19 insertions(+), 150 deletions(-) delete mode 100644 packages/apps/mysql/templates/haproxy/configmap.yaml delete mode 100644 packages/apps/mysql/templates/haproxy/deployment.yaml delete mode 100644 packages/apps/mysql/templates/haproxy/service.yaml diff --git a/packages/apps/mysql/templates/haproxy/configmap.yaml b/packages/apps/mysql/templates/haproxy/configmap.yaml deleted file mode 100644 index 70a194ac..00000000 --- a/packages/apps/mysql/templates/haproxy/configmap.yaml +++ /dev/null @@ -1,29 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ .Release.Name }}-secondary-haproxy - labels: - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -data: - haproxy.cfg: | - global - maxconn 2048 - defaults - mode tcp - option dontlognull - timeout queue 20s - timeout connect 1s - timeout client 3s - timeout server 10s - timeout check 2s - - frontend mysql - bind :::3306 v4v6 - default_backend mysql_backend - - backend mysql_backend - balance roundrobin - default-server observe layer4 error-limit 3 on-error mark-down - server secondary {{ .Release.Name }}-secondary:3306 check - server backup {{ .Release.Name }}:3306 backup diff --git a/packages/apps/mysql/templates/haproxy/deployment.yaml b/packages/apps/mysql/templates/haproxy/deployment.yaml deleted file mode 100644 index 6ff5ed14..00000000 --- a/packages/apps/mysql/templates/haproxy/deployment.yaml +++ /dev/null @@ -1,67 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ .Release.Name }}-secondary-haproxy - labels: - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -spec: - # TODO - # There is an issue with 'externalTraficPolicy: Local' and VMs accessing externalIP services from - # internal network, trafic is not routed due to fact their hipervisor have no local workload running - # Current workaround that all the nodes of parnet cluster must have at least one replica per node - # which are running the virtual machnes of child cluster. - # Consider moving to KubeVirt so all local VMs will get local identities, so internalTrafficPolicy will - # considered for them instead of externalTraficPolicy - replicas: 2 - selector: - matchLabels: - app: {{ .Release.Name }}-secondary-haproxy - template: - metadata: - labels: - app: {{ .Release.Name }}-secondary-haproxy - annotations: - checksum/config: {{ include (print $.Template.BasePath "/haproxy/configmap.yaml") . | sha256sum }} - spec: - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 1 - podAffinityTerm: - labelSelector: - matchExpressions: - - key: app.kubernetes.io/instance - operator: In - values: - - {{ .Release.Name }} - - key: app.kubernetes.io/name - operator: In - values: - - mariadb - topologyKey: kubernetes.io/hostname - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 1 - podAffinityTerm: - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - {{ .Release.Name }}-secondary-haproxy - topologyKey: kubernetes.io/hostname - containers: - - image: haproxy:latest - name: haproxy - ports: - - containerPort: 3306 - name: mysql - volumeMounts: - - mountPath: /usr/local/etc/haproxy - name: config - volumes: - - configMap: - name: {{ .Release.Name }}-secondary-haproxy - name: config diff --git a/packages/apps/mysql/templates/haproxy/service.yaml b/packages/apps/mysql/templates/haproxy/service.yaml deleted file mode 100644 index 1ad5ebc5..00000000 --- a/packages/apps/mysql/templates/haproxy/service.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ .Release.Name }}-secondary-haproxy - labels: - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - annotations: - metallb.universe.tf/address-pool: {{ .Values.secondaryService2.ipPool }} - metallb.universe.tf/ip-allocated-from-pool: {{ .Values.secondaryService2.ipPool }} - metallb.universe.tf/loadBalancerIPs: {{ .Values.secondaryService2.ipAddress }} -spec: - type: LoadBalancer - externalTrafficPolicy: Local - allocateLoadBalancerNodePorts: false - selector: - app: {{ .Release.Name }}-secondary-haproxy - ports: - - name: mysql - protocol: TCP - port: 3306 - targetPort: mysql diff --git a/packages/apps/mysql/templates/mariadb.yaml b/packages/apps/mysql/templates/mariadb.yaml index 48320d01..56d90ea5 100644 --- a/packages/apps/mysql/templates/mariadb.yaml +++ b/packages/apps/mysql/templates/mariadb.yaml @@ -54,21 +54,18 @@ spec: key: config volumeClaimTemplate: - {{- toYaml .Values.volumeClaimTemplate | nindent 4 }} + resources: + requests: + storage: {{ .Values.size }} + accessModes: + - ReadWriteOnce - # All possible annotations must be included in the service - # https://github.com/mariadb-operator/mariadb-operator/issues/256 + + {{- if .Values.external }} primaryService: type: LoadBalancer - annotations: - metallb.universe.tf/address-pool: {{ .Values.primaryService.ipPool }} - metallb.universe.tf/ip-allocated-from-pool: {{ .Values.primaryService.ipPool }} - metallb.universe.tf/loadBalancerIPs: {{ .Values.primaryService.ipAddress }} + {{- end }} - secondaryService: - type: LoadBalancer - annotations: - metallb.universe.tf/address-pool: {{ .Values.secondaryService.ipPool }} - metallb.universe.tf/ip-allocated-from-pool: {{ .Values.secondaryService.ipPool }} - metallb.universe.tf/loadBalancerIPs: {{ .Values.secondaryService.ipAddress }} + #secondaryService: + # type: LoadBalancer diff --git a/packages/apps/mysql/values.yaml b/packages/apps/mysql/values.yaml index da76c400..889db841 100644 --- a/packages/apps/mysql/values.yaml +++ b/packages/apps/mysql/values.yaml @@ -1,32 +1,23 @@ -volumeClaimTemplate: - resources: - requests: - storage: 100Gi - accessModes: - - ReadWriteOnce - -primaryService: - ipPool: private-ips - ipAddress: 10.100.255.15 - -secondaryService: - ipPool: private-ips - ipAddress: 10.100.255.16 - -secondaryService2: - ipPool: private-ips - ipAddress: 10.100.255.116 +external: false +size: 10Gi users: + root: + password: strongpassword user1: privileges: ['ALL'] maxUserConnections: 1000 + password: hackme user2: privileges: ['SELECT'] maxUserConnections: 1000 + password: hackme databases: - wordpress1 - wordpress2 - wordpress3 - wordpress4 + +backup: + enabled: false