aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/common/mariadb-galera
diff options
context:
space:
mode:
Diffstat (limited to 'kubernetes/common/mariadb-galera')
-rw-r--r--kubernetes/common/mariadb-galera/Chart.yaml5
-rw-r--r--kubernetes/common/mariadb-galera/templates/backup/cronjob.yaml4
-rw-r--r--kubernetes/common/mariadb-galera/templates/backup/pv.yaml3
-rw-r--r--kubernetes/common/mariadb-galera/templates/backup/pvc.yaml3
-rw-r--r--kubernetes/common/mariadb-galera/templates/configmap.yaml16
-rw-r--r--kubernetes/common/mariadb-galera/templates/mariadb.yaml19
-rw-r--r--kubernetes/common/mariadb-galera/templates/metrics-svc.yaml7
-rw-r--r--kubernetes/common/mariadb-galera/templates/pdb.yaml14
-rw-r--r--kubernetes/common/mariadb-galera/templates/pv.yaml2
-rw-r--r--kubernetes/common/mariadb-galera/templates/service.yaml10
-rw-r--r--kubernetes/common/mariadb-galera/templates/servicemonitor.yaml6
-rw-r--r--kubernetes/common/mariadb-galera/templates/statefulset.yaml2
-rw-r--r--kubernetes/common/mariadb-galera/values.yaml167
13 files changed, 194 insertions, 64 deletions
diff --git a/kubernetes/common/mariadb-galera/Chart.yaml b/kubernetes/common/mariadb-galera/Chart.yaml
index 92eac6f837..71ff421d7b 100644
--- a/kubernetes/common/mariadb-galera/Chart.yaml
+++ b/kubernetes/common/mariadb-galera/Chart.yaml
@@ -18,7 +18,7 @@
apiVersion: v2
description: Chart for MariaDB Galera cluster
name: mariadb-galera
-version: 13.0.0
+version: 13.0.1
keywords:
- mariadb
- mysql
@@ -39,4 +39,5 @@ dependencies:
repository: 'file://../repositoryGenerator'
- name: serviceAccount
version: ~13.x-0
- repository: 'file://../serviceAccount' \ No newline at end of file
+ repository: 'file://../serviceAccount'
+ condition: global.mariadbGalera.enableServiceAccount \ No newline at end of file
diff --git a/kubernetes/common/mariadb-galera/templates/backup/cronjob.yaml b/kubernetes/common/mariadb-galera/templates/backup/cronjob.yaml
index e2a9ca64cf..4548626dd3 100644
--- a/kubernetes/common/mariadb-galera/templates/backup/cronjob.yaml
+++ b/kubernetes/common/mariadb-galera/templates/backup/cronjob.yaml
@@ -15,6 +15,9 @@
# limitations under the License.
*/}}
+{{- if and .Values.backup.enabled .Values.global.mariadbGalera.useOperator }}
+{{ include "common.mariadbOpBackup" . }}
+{{ else }}
{{- if and .Values.backup.enabled .Values.persistence.enabled }}
apiVersion: batch/v1beta1
kind: CronJob
@@ -180,3 +183,4 @@ spec:
- name: tmp
emptyDir: {}
{{- end }}
+{{- end }}
diff --git a/kubernetes/common/mariadb-galera/templates/backup/pv.yaml b/kubernetes/common/mariadb-galera/templates/backup/pv.yaml
index 30eb74b059..d5e26109e7 100644
--- a/kubernetes/common/mariadb-galera/templates/backup/pv.yaml
+++ b/kubernetes/common/mariadb-galera/templates/backup/pv.yaml
@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
*/}}
+
+{{- if not .Values.global.mariadbGalera.useOperator }}
{{- if .Values.backup.enabled }}
{{- if and .Values.backup.persistence.enabled (not .Values.backup.persistence.existingClaim) -}}
{{- if eq "True" (include "common.needPV" .) -}}
@@ -41,3 +43,4 @@ spec:
{{- end -}}
{{- end -}}
{{- end -}}
+{{- end -}}
diff --git a/kubernetes/common/mariadb-galera/templates/backup/pvc.yaml b/kubernetes/common/mariadb-galera/templates/backup/pvc.yaml
index 5dd8a3f52f..4c2bfcd389 100644
--- a/kubernetes/common/mariadb-galera/templates/backup/pvc.yaml
+++ b/kubernetes/common/mariadb-galera/templates/backup/pvc.yaml
@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
*/}}
+
+{{- if not .Values.global.mariadbGalera.useOperator }}
{{- if .Values.backup.enabled }}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
---
@@ -45,3 +47,4 @@ spec:
{{- end -}}
{{- end -}}
{{- end -}}
+{{- end -}} \ No newline at end of file
diff --git a/kubernetes/common/mariadb-galera/templates/configmap.yaml b/kubernetes/common/mariadb-galera/templates/configmap.yaml
index c95a234fb7..0aa0a63f0a 100644
--- a/kubernetes/common/mariadb-galera/templates/configmap.yaml
+++ b/kubernetes/common/mariadb-galera/templates/configmap.yaml
@@ -15,7 +15,20 @@
# limitations under the License.
*/}}
-{{ if .Values.mariadbConfiguration }}
+{{- if .Values.global.mariadbGalera.useOperator }}
+{{ if .Values.mariadbOpConfiguration }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ printf "%s-configuration" (include "common.fullname" .) }}
+ namespace: {{ include "common.namespace" . }}
+ labels: {{- include "common.labels" . | nindent 4 }}
+data:
+ my.cnf: |
+{{ .Values.mariadbOpConfiguration | indent 4 }}
+{{- end }}
+{{- else }}
+{{ if .Values.mariadbConfiguration }}
apiVersion: v1
kind: ConfigMap
metadata:
@@ -25,4 +38,5 @@ metadata:
data:
my.cnf: |
{{ .Values.mariadbConfiguration | indent 4 }}
+{{- end }}
{{- end }} \ No newline at end of file
diff --git a/kubernetes/common/mariadb-galera/templates/mariadb.yaml b/kubernetes/common/mariadb-galera/templates/mariadb.yaml
new file mode 100644
index 0000000000..ce09c9ff06
--- /dev/null
+++ b/kubernetes/common/mariadb-galera/templates/mariadb.yaml
@@ -0,0 +1,19 @@
+{{/*
+# Copyright © 2023 Deutsche Telekom AG
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+*/}}
+
+{{- if .Values.global.mariadbGalera.useOperator }}
+{{ include "common.mariadbOpInstance" . }}
+{{- end }} \ No newline at end of file
diff --git a/kubernetes/common/mariadb-galera/templates/metrics-svc.yaml b/kubernetes/common/mariadb-galera/templates/metrics-svc.yaml
index 841aab3e17..d37aeb1751 100644
--- a/kubernetes/common/mariadb-galera/templates/metrics-svc.yaml
+++ b/kubernetes/common/mariadb-galera/templates/metrics-svc.yaml
@@ -14,7 +14,9 @@
# limitations under the License.
*/}}
-{{- if default false .Values.global.metrics.enabled }}
+{{- if not .Values.global.mariadbGalera.useOperator }}
+{{- if default false .Values.global.metrics.enabled }}
+---
apiVersion: v1
kind: Service
metadata:
@@ -31,4 +33,5 @@ spec:
port: {{ .Values.metrics.service.port }}
targetPort: tcp-metrics
selector: {{- include "common.matchLabels" . | nindent 4 }}
-{{- end }}
+{{- end }}
+{{- end }} \ No newline at end of file
diff --git a/kubernetes/common/mariadb-galera/templates/pdb.yaml b/kubernetes/common/mariadb-galera/templates/pdb.yaml
index 1d9d4141ab..734f03f237 100644
--- a/kubernetes/common/mariadb-galera/templates/pdb.yaml
+++ b/kubernetes/common/mariadb-galera/templates/pdb.yaml
@@ -14,17 +14,19 @@
# limitations under the License.
*/}}
-{{- if .Values.podDisruptionBudget.create }}
+{{- if not .Values.global.mariadbGalera.useOperator }}
+{{- if .Values.podDisruptionBudget.create }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
spec:
-{{- if .Values.podDisruptionBudget.minAvailable }}
+{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
-{{- end }}
-{{- if .Values.podDisruptionBudget.maxUnavailable }}
+{{- end }}
+{{- if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
-{{- end }}
+{{- end }}
selector:
matchLabels: {{- include "common.matchLabels" . | nindent 6 }}
-{{- end }}
+{{- end }}
+{{- end }} \ No newline at end of file
diff --git a/kubernetes/common/mariadb-galera/templates/pv.yaml b/kubernetes/common/mariadb-galera/templates/pv.yaml
index 54a02cf2db..129b5b26c7 100644
--- a/kubernetes/common/mariadb-galera/templates/pv.yaml
+++ b/kubernetes/common/mariadb-galera/templates/pv.yaml
@@ -15,4 +15,6 @@
# limitations under the License.
*/}}
+{{- if not .Values.global.mariadbGalera.useOperator }}
{{ include "common.replicaPV" . }}
+{{- end }} \ No newline at end of file
diff --git a/kubernetes/common/mariadb-galera/templates/service.yaml b/kubernetes/common/mariadb-galera/templates/service.yaml
index 6af9135367..4cabde1e4d 100644
--- a/kubernetes/common/mariadb-galera/templates/service.yaml
+++ b/kubernetes/common/mariadb-galera/templates/service.yaml
@@ -15,11 +15,13 @@
# limitations under the License.
*/}}
+{{- if not .Values.global.mariadbGalera.useOperator }}
{{ include "common.service" . }}
---
{{ include "common.headlessService" . }}
+{{- end }}
{{- if (include "common.onServiceMesh" .) }}
-{{- if eq (default "istio" .Values.global.serviceMesh.engine) "istio" }}
+{{- if eq (default "istio" .Values.global.serviceMesh.engine) "istio" }}
---
apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
@@ -29,9 +31,9 @@ metadata:
spec:
selector:
matchLabels:
- app.kubernetes.io/name: {{ include "common.servicename" . }}
+ app: {{ include "common.servicename" . }}
portLevelMtls:
'{{ .Values.service.internalPort }}':
mode: DISABLE
-{{- end}}
-{{- end}}
+{{- end }}
+{{- end }}
diff --git a/kubernetes/common/mariadb-galera/templates/servicemonitor.yaml b/kubernetes/common/mariadb-galera/templates/servicemonitor.yaml
index 6d1ed40e13..4cbf7b394f 100644
--- a/kubernetes/common/mariadb-galera/templates/servicemonitor.yaml
+++ b/kubernetes/common/mariadb-galera/templates/servicemonitor.yaml
@@ -14,6 +14,8 @@
# limitations under the License.
*/}}
-{{- if .Values.metrics.serviceMonitor.enabled }}
+{{- if not .Values.global.mariadbGalera.useOperator }}
+{{- if .Values.metrics.serviceMonitor.enabled }}
{{ include "common.serviceMonitor" . }}
-{{- end }}
+{{- end }}
+{{- end }} \ No newline at end of file
diff --git a/kubernetes/common/mariadb-galera/templates/statefulset.yaml b/kubernetes/common/mariadb-galera/templates/statefulset.yaml
index c95b572465..2f5b33fd97 100644
--- a/kubernetes/common/mariadb-galera/templates/statefulset.yaml
+++ b/kubernetes/common/mariadb-galera/templates/statefulset.yaml
@@ -18,6 +18,7 @@
# limitations under the License.
*/}}
+{{- if not .Values.global.mariadbGalera.useOperator }}
apiVersion: apps/v1
kind: StatefulSet
metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
@@ -266,3 +267,4 @@ spec:
volumeClaimTemplates:
- {{ include "common.PVCTemplate" (dict "dot" . "suffix" "data" "persistenceInfos" .Values.persistence) | indent 6 | trim }}
{{- end }}
+{{- end }} \ No newline at end of file
diff --git a/kubernetes/common/mariadb-galera/values.yaml b/kubernetes/common/mariadb-galera/values.yaml
index e9fe577233..a749c0959c 100644
--- a/kubernetes/common/mariadb-galera/values.yaml
+++ b/kubernetes/common/mariadb-galera/values.yaml
@@ -15,6 +15,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+#################################################################
+# Global configuration defaults.
+#################################################################
+global:
+ nodePortPrefix: 302
+ persistence:
+ mountPath: /dockerdata-nfs
+ backup:
+ mountPath: /dockerdata-nfs/backup
+ clusterDomain: cluster.local
+ metrics: {}
+ mariadbGalera:
+ # flag to enable the DB creation via mariadb-operator
+ useOperator: true
+ # if useOperator set to "true", set "enableServiceAccount to "false"
+ # as the SA is created by the Operator
+ enableServiceAccount: false
+ nameOverride: mariadb-galera
+ service: mariadb-galera
#################################################################
# Secrets metaconfig
@@ -35,21 +54,108 @@ secrets:
login: '{{ .Values.galera.mariabackup.user }}'
password: '{{ .Values.galera.mariabackup.password }}'
+mariadbOperator:
+ image: mariadb
+ appVersion: 11.1.2
+ galera:
+ enabled: true
+ agentImage: mariadb-operator/agent
+ agentVersion: v0.0.2
+ initImage: mariadb-operator/init
+ initVersion: v0.0.5
+
+## String to partially override common.names.fullname template (will maintain the release name)
+##
+nameOverride: mariadb-galera
+
+## Custom db configuration
+##
+db:
+ ## MariaDB username and password
+ ## Password is ignored if externalSecret is specified.
+ ## If not set, password will be "randomly" generated
+ ## ref: https://github.com/bitnami/bitnami-docker-mariadb-galera#creating-a-database-user-on-first-run
+ ##
+ user: my-user
+ # password:
+ # externalSecret:
+ ## Database to create
+ ## ref: https://github.com/bitnami/bitnami-docker-mariadb-galera#creating-a-database-on-first-run
+ ##
+ # name: my_database
+
+## Desired number of cluster nodes
+##
+replicaCount: 3
+
+## Additional pod annotations for MariaDB Galera pods
+## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
+## -> here required to enable mariadb-galera in istio
+##
+podAnnotations:
+ # sidecar.istio.io/inject: "false"
+ traffic.sidecar.istio.io/excludeInboundPorts: "4444,4567,4568"
+ traffic.sidecar.istio.io/includeInboundPorts: '*'
+ traffic.sidecar.istio.io/excludeOutboundPorts: "4444,4567,4568"
+
+mariadbOpConfiguration: |-
+ [mysqld]
+ max_allowed_packet=256M
+ lower_case_table_names = 1
+
+ ## Character set
+ collation_server=utf8_unicode_ci
+ init_connect='SET NAMES utf8'
+ character_set_server=utf8
+
+ ## MyISAM
+ key_buffer_size=32M
+ myisam_recover_options=FORCE,BACKUP
+
+ ## Safety
+ skip_host_cache
+ skip_name_resolve
+ max_allowed_packet=16M
+ max_connect_errors=1000000
+ sql_mode=STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY
+ sysdate_is_now=1
+
+ ## Caches and Limits
+ tmp_table_size=32M
+ max_heap_table_size=32M
+ # Re-enabling as now works with Maria 10.1.2
+ query_cache_type=1
+ query_cache_limit=4M
+ query_cache_size=256M
+ max_connections=500
+ thread_cache_size=50
+ open_files_limit=65535
+ table_definition_cache=4096
+ table_open_cache=4096
+
+ ## InnoDB
+ innodb=FORCE
+ innodb_strict_mode=1
+ # Mandatory per https://github.com/codership/documentation/issues/25
+ innodb_autoinc_lock_mode=2
+ # Per https://www.percona.com/blog/2006/08/04/innodb-double-write/
+ innodb_doublewrite=1
+ innodb_flush_method=O_DIRECT
+ innodb_log_files_in_group=2
+ innodb_log_file_size=128M
+ innodb_flush_log_at_trx_commit=1
+ innodb_file_per_table=1
+ # 80% Memory is default reco.
+ # Need to re-evaluate when DB size grows
+ innodb_buffer_pool_size=2G
+ innodb_file_format=Barracuda
+
+##########################################################################################
+# !!! the following configuration entries are ignored, when mariadbOperator is enabled !!!
+##########################################################################################
# bitnami image doesn't support well single quote in password
passwordStrengthOverride: basic
-#################################################################
-# Global configuration defaults.
-#################################################################
-global:
- nodePortPrefix: 302
- persistence:
- mountPath: /dockerdata-nfs
- backup:
- mountPath: /dockerdata-nfs/backup
- clusterDomain: cluster.local
- metrics: {}
-
image: bitnami/mariadb-galera:10.5.8
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
@@ -66,10 +172,6 @@ debug: true
## actions performed on the databases are tried to be done before actual start.
init_sleep_time: 5
-## String to partially override common.names.fullname template (will maintain the release name)
-##
-nameOverride: mariadb-galera
-
## Use an alternate scheduler, e.g. "stork".
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
##
@@ -129,22 +231,6 @@ rootUser:
# password:
# externalSecret:
-## Custom db configuration
-##
-db:
- ## MariaDB username and password
- ## Password is ignored if externalSecret is specified.
- ## If not set, password will be "randomly" generated
- ## ref: https://github.com/bitnami/bitnami-docker-mariadb-galera#creating-a-database-user-on-first-run
- ##
- user: my-user
- # password:
- # externalSecret:
- ## Database to create
- ## ref: https://github.com/bitnami/bitnami-docker-mariadb-galera#creating-a-database-on-first-run
- ##
- # name: my_database
-
## Galera configuration
##
galera:
@@ -212,7 +298,8 @@ backup:
readinessCheck:
wait_for:
- - '{{ include "common.name" . }}'
+ apps:
+ - '{{ include "common.name" . }}'
## TLS configuration
##
@@ -368,26 +455,12 @@ mariadbConfiguration: |-
##
## extraFlags: "--max-connect-errors=1000 --max_connections=155"
-## Desired number of cluster nodes
-##
-replicaCount: 3
-
## updateStrategy for MariaDB Master StatefulSet
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies
##
updateStrategy:
type: RollingUpdate
-## Additional pod annotations for MariaDB Galera pods
-## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
-## -> here required to enable mariadb-galera in istio
-##
-podAnnotations:
- # sidecar.istio.io/inject: "false"
- traffic.sidecar.istio.io/excludeInboundPorts: "4444,4567,4568"
- traffic.sidecar.istio.io/includeInboundPorts: '*'
- traffic.sidecar.istio.io/excludeOutboundPorts: "4444,4567,4568"
-
## Pod affinity preset
## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity
## Allowed values: soft, hard