aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/common/mariadb-galera/templates
diff options
context:
space:
mode:
authorAndreas Geissler <andreas-geissler@telekom.de>2023-08-16 17:18:49 +0200
committerAndreas Geissler <andreas-geissler@telekom.de>2023-09-29 13:42:29 +0200
commitcfd8434fe9484b9219560159094b174421d6d6a2 (patch)
tree0825b2650bb861444f18444f0279479e4dcbf7c4 /kubernetes/common/mariadb-galera/templates
parent533403925a6b60f4113c4d9e54cd99be36dc9cc5 (diff)
[MARIADB][COMMON] Add support for mariadb-operator
Add template functions for the mariadb-operator resources and update the mariadb-galera chart to support them Change the flag to "useOperator" in cassandra to the global setup and additional labels for cassandra resources Changed Policy DB users to support the new mariadb User and fixed db.sh script to wait for the DB user creation Use the new readiness image 5.0.1 with the "app-name" option Change the MariaDB-Galera Service to the "primary" to avoid Deadlocks Fix previous SDNC patch (https://gerrit.onap.org/r/c/oom/+/135308) and temporary disable MariaDB for SDNR, as it is not compatible to MariaDB 11 Issue-ID: OOM-3236 Change-Id: Ie63fcc9c6d5fa802d38c592b449e7ff8553c2ab9 Signed-off-by: Andreas Geissler <andreas-geissler@telekom.de>
Diffstat (limited to 'kubernetes/common/mariadb-galera/templates')
-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
11 files changed, 71 insertions, 15 deletions
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