diff options
author | Andreas Geissler <andreas-geissler@telekom.de> | 2023-08-16 17:18:49 +0200 |
---|---|---|
committer | Andreas Geissler <andreas-geissler@telekom.de> | 2023-09-29 13:42:29 +0200 |
commit | cfd8434fe9484b9219560159094b174421d6d6a2 (patch) | |
tree | 0825b2650bb861444f18444f0279479e4dcbf7c4 | |
parent | 533403925a6b60f4113c4d9e54cd99be36dc9cc5 (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>
92 files changed, 712 insertions, 175 deletions
diff --git a/docs/sections/guides/infra_guides/oom_infra_optional_addons.rst b/docs/sections/guides/infra_guides/oom_infra_optional_addons.rst index ad1104e569..71ce344f09 100644 --- a/docs/sections/guides/infra_guides/oom_infra_optional_addons.rst +++ b/docs/sections/guides/infra_guides/oom_infra_optional_addons.rst @@ -9,6 +9,8 @@ .. _Istio setup guide: https://istio.io/latest/docs/setup/install/helm/ .. _Kiali setup guide: https://kiali.io/docs/installation/installation-guide/example-install/ .. _Kserve setup guide: https://kserve.github.io/website/0.10/admin/kubernetes_deployment/ +.. _K8ssandra setup guide: https://docs.k8ssandra.io/install/ +.. _Mariadb-Operator setup guide: https://github.com/mariadb-operator/mariadb-operator .. _oom_base_optional_addons: @@ -99,7 +101,49 @@ To be done... K8ssandra-Operator Installation ------------------------------- -To be done... +K8ssandra-Operator is used to ease the installation and lifecycle management +Cassandra clusters, including monitoring and backup + +For setup the K8ssandra operator is used, see `K8ssandra setup guide`_ + +- Install k8ssandra-operator namespace:: + + > kubectl create namespace k8ssandra-operator + + > kubectl label namespace k8ssandra-operator istio-injection=enabled + +- Install the k8ssandra-operator:: + + > helm repo add k8ssandra https://helm.k8ssandra.io/stable + + > helm repo update k8ssandra + + > helm install k8ssandra-operator --namespace k8ssandra-operator + k8ssandra/k8ssandra-operator --set global.clusterScoped=true + +Mariadb-Operator Installation +----------------------------- + +Mariadb-Operator is used to ease the installation and lifecycle management +MariaDB Galera and Replication clusters, including monitoring and backup + +For setup the Mariadb-Operator is used, see `Mariadb-Operator setup guide`_ + +- Install mariadb-operator namespace:: + + > kubectl create namespace mariadb-operator + + > kubectl label namespace mariadb-operator istio-injection=enabled + +- Install the mariadb-operator:: + + > helm repo add mariadb-operator https://mariadb-operator.github.io/mariadb-operator + + > helm repo update mariadb-operator + + > helm install mariadb-operator --namespace mariadb-operator + mariadb-operator/mariadb-operator --set ha.enabled=true + Kserve Installation ------------------- diff --git a/kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml b/kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml index 536fc9d1aa..c3e36c2be6 100644 --- a/kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml +++ b/kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml @@ -81,7 +81,7 @@ spec: {{ else }} - /app/ready.py args: - - --container-name + - --app-name {{- if .Values.global.cassandra.localCluster }} - aai-cassandra {{- else }} diff --git a/kubernetes/aai/components/aai-graphadmin/templates/job-copy-db-backup.yaml b/kubernetes/aai/components/aai-graphadmin/templates/job-copy-db-backup.yaml index 407c9fb1da..865dfe3eeb 100644 --- a/kubernetes/aai/components/aai-graphadmin/templates/job-copy-db-backup.yaml +++ b/kubernetes/aai/components/aai-graphadmin/templates/job-copy-db-backup.yaml @@ -64,7 +64,7 @@ spec: - command: - /bin/bash - -c - - /app/ready.py --container-name aai-cassandra --timeout 1 || /app/ready.py --container-name cassandra + - /app/ready.py --app-name aai-cassandra --timeout 1 || /app/ready.py --app-name cassandra env: - name: NAMESPACE valueFrom: diff --git a/kubernetes/aai/components/aai-graphadmin/templates/job-create-db.yaml b/kubernetes/aai/components/aai-graphadmin/templates/job-create-db.yaml index 31669dd7e8..1a8124929f 100644 --- a/kubernetes/aai/components/aai-graphadmin/templates/job-create-db.yaml +++ b/kubernetes/aai/components/aai-graphadmin/templates/job-create-db.yaml @@ -58,7 +58,7 @@ spec: - command: - /app/ready.py args: - - --container-name + - --app-name {{- if .Values.global.cassandra.localCluster }} - aai-cassandra {{- else }} diff --git a/kubernetes/aai/components/aai-graphadmin/templates/job-migration.yaml b/kubernetes/aai/components/aai-graphadmin/templates/job-migration.yaml index d5854918b5..bf3279fde7 100644 --- a/kubernetes/aai/components/aai-graphadmin/templates/job-migration.yaml +++ b/kubernetes/aai/components/aai-graphadmin/templates/job-migration.yaml @@ -63,7 +63,7 @@ spec: - command: - /app/ready.py args: - - --container-name + - --app-name {{- if .Values.global.cassandra.localCluster }} - aai-cassandra {{- else }} @@ -218,7 +218,7 @@ spec: - command: - /bin/bash - -c - - /app/ready.py --container-name aai-cassandra --timeout 1 || /app/ready.py --container-name cassandra + - /app/ready.py --app-name aai-cassandra --timeout 1 || /app/ready.py --app-name cassandra env: - name: NAMESPACE valueFrom: diff --git a/kubernetes/aai/components/aai-resources/templates/deployment.yaml b/kubernetes/aai/components/aai-resources/templates/deployment.yaml index 2f60811331..5b9e9d222f 100644 --- a/kubernetes/aai/components/aai-resources/templates/deployment.yaml +++ b/kubernetes/aai/components/aai-resources/templates/deployment.yaml @@ -105,7 +105,7 @@ spec: - --job-name - {{ include "common.release" . }}-aai-graphadmin-create-db-schema {{- else }} - - --container-name + - --app-name {{- if .Values.global.cassandra.localCluster }} - aai-cassandra {{- else }} diff --git a/kubernetes/aai/components/aai-traversal/templates/deployment.yaml b/kubernetes/aai/components/aai-traversal/templates/deployment.yaml index a2c81cf673..6d12f08755 100644 --- a/kubernetes/aai/components/aai-traversal/templates/deployment.yaml +++ b/kubernetes/aai/components/aai-traversal/templates/deployment.yaml @@ -123,7 +123,7 @@ spec: - --job-name - {{ include "common.release" . }}-aai-graphadmin-create-db-schema {{- else }} - - --container-name + - --app-name {{- if .Values.global.cassandra.localCluster }} - aai-cassandra {{- else }} diff --git a/kubernetes/aai/values.yaml b/kubernetes/aai/values.yaml index fbd3438c1c..b9223b1a9a 100644 --- a/kubernetes/aai/values.yaml +++ b/kubernetes/aai/values.yaml @@ -25,7 +25,7 @@ global: # global defaults dockerhubRepository: docker.io busyboxImage: busybox - readinessImage: onap/oom/readiness:3.0.1 + readinessImage: onap/oom/readiness:5.0.1 loggingRepository: docker.elastic.co loggingImage: beats/filebeat:5.5.0 @@ -39,6 +39,13 @@ global: # global defaults #This will instantiate AAI cassandra cluster, default:shared cassandra. localCluster: false + # in case of a local cassandra cluster + # flag to enable the DB creation via k8ssandra-operator + useOperator: true + # if useOperator set to "true", set "enableServiceAccount to "false" + # as the SA is created by the Operator + enableServiceAccount: false + #Service Name of the cassandra cluster to connect to. #Override it to aai-cassandra if localCluster is enabled. #in case of using k8ssandra-operator in the common cassandra installation @@ -53,7 +60,7 @@ global: # global defaults #then it should be same as aai-cassandra replicaCount replicas: 3 - #Cassanara login details + #Cassandra login details username: cassandra password: cassandra @@ -357,7 +364,6 @@ cassandra: mountSubPath: aai/cassandra enabled: true k8ssandraOperator: - enabled: false config: clusterName: aai-cassandra diff --git a/kubernetes/cds/components/cds-blueprints-processor/values.yaml b/kubernetes/cds/components/cds-blueprints-processor/values.yaml index 42abd1660f..e6c0856421 100755 --- a/kubernetes/cds/components/cds-blueprints-processor/values.yaml +++ b/kubernetes/cds/components/cds-blueprints-processor/values.yaml @@ -219,7 +219,8 @@ resources: readinessCheck: wait_for: - - cds-db + apps: + - cds-db #Pods Service Account serviceAccount: diff --git a/kubernetes/cds/values.yaml b/kubernetes/cds/values.yaml index 27d5e84b19..199c438863 100644 --- a/kubernetes/cds/values.yaml +++ b/kubernetes/cds/values.yaml @@ -78,6 +78,9 @@ mariadb-galera: name: &mysqlDbName sdnctl nameOverride: &dbServer cds-db replicaCount: 1 + mariadbOperator: + galera: + enabled: false persistence: enabled: true mountSubPath: cds/data diff --git a/kubernetes/common/cassandra/Chart.yaml b/kubernetes/common/cassandra/Chart.yaml index c861b1a8c8..75e07a1373 100644 --- a/kubernetes/common/cassandra/Chart.yaml +++ b/kubernetes/common/cassandra/Chart.yaml @@ -30,3 +30,4 @@ dependencies: - name: serviceAccount version: ~13.x-0 repository: 'file://../serviceAccount' + condition: global.cassandra.enableServiceAccount
\ No newline at end of file diff --git a/kubernetes/common/cassandra/templates/backup/configmap.yaml b/kubernetes/common/cassandra/templates/backup/configmap.yaml index b566b6107e..2c85a1a01f 100644 --- a/kubernetes/common/cassandra/templates/backup/configmap.yaml +++ b/kubernetes/common/cassandra/templates/backup/configmap.yaml @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. */}} -{{- if not .Values.k8ssandraOperator.enabled }} +{{- if not .Values.global.cassandra.useOperator }} {{- if .Values.backup.enabled }} apiVersion: v1 kind: ConfigMap diff --git a/kubernetes/common/cassandra/templates/backup/cronjob.yaml b/kubernetes/common/cassandra/templates/backup/cronjob.yaml index e2f675a384..06bb7434c5 100644 --- a/kubernetes/common/cassandra/templates/backup/cronjob.yaml +++ b/kubernetes/common/cassandra/templates/backup/cronjob.yaml @@ -14,7 +14,7 @@ # limitations under the License. */}} {{- if .Values.backup.enabled }} -{{- if .Values.k8ssandraOperator.enabled }} +{{- if .Values.global.cassandra.useOperator }} {{ else }} apiVersion: batch/v1beta1 kind: CronJob @@ -39,7 +39,7 @@ spec: - command: - /app/ready.py args: - - --container-name + - --app-name - {{ include "common.name" . }} env: - name: NAMESPACE diff --git a/kubernetes/common/cassandra/templates/backup/pv.yaml b/kubernetes/common/cassandra/templates/backup/pv.yaml index 23e4551c10..e7218fae7d 100644 --- a/kubernetes/common/cassandra/templates/backup/pv.yaml +++ b/kubernetes/common/cassandra/templates/backup/pv.yaml @@ -14,7 +14,7 @@ # limitations under the License. */}} {{- if .Values.backup.enabled }} -{{- if .Values.k8ssandraOperator.enabled }} +{{- if .Values.global.cassandra.useOperator }} {{ else }} {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} {{- if eq "True" (include "common.needPV" .) -}} diff --git a/kubernetes/common/cassandra/templates/backup/pvc.yaml b/kubernetes/common/cassandra/templates/backup/pvc.yaml index e60a1db510..56b3ba8b02 100644 --- a/kubernetes/common/cassandra/templates/backup/pvc.yaml +++ b/kubernetes/common/cassandra/templates/backup/pvc.yaml @@ -14,7 +14,7 @@ # limitations under the License. */}} {{- if .Values.backup.enabled }} -{{- if .Values.k8ssandraOperator.enabled }} +{{- if .Values.global.cassandra.useOperator }} {{ else }} {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} --- diff --git a/kubernetes/common/cassandra/templates/cassOp.yaml b/kubernetes/common/cassandra/templates/cassOp.yaml index cb6ce4adc5..9f463adf08 100644 --- a/kubernetes/common/cassandra/templates/cassOp.yaml +++ b/kubernetes/common/cassandra/templates/cassOp.yaml @@ -1,5 +1,5 @@ {{/* -# Copyright © 2018 Amdocs, AT&T, Bell Canada +# 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. @@ -14,6 +14,6 @@ # limitations under the License. */}} -{{- if .Values.k8ssandraOperator.enabled }} +{{- if .Values.global.cassandra.useOperator }} {{ include "common.k8ssandraCluster" . }} {{- end }}
\ No newline at end of file diff --git a/kubernetes/common/cassandra/templates/configmap.yaml b/kubernetes/common/cassandra/templates/configmap.yaml index 8f2b39e1a1..5510986e54 100644 --- a/kubernetes/common/cassandra/templates/configmap.yaml +++ b/kubernetes/common/cassandra/templates/configmap.yaml @@ -1,4 +1,4 @@ -{{- if not .Values.k8ssandraOperator.enabled }} +{{- if not .Values.global.cassandra.useOperator }} {{- if .Values.configOverrides }} apiVersion: v1 kind: ConfigMap diff --git a/kubernetes/common/cassandra/templates/pv.yaml b/kubernetes/common/cassandra/templates/pv.yaml index 8e2ad663c3..d18e51d2f4 100644 --- a/kubernetes/common/cassandra/templates/pv.yaml +++ b/kubernetes/common/cassandra/templates/pv.yaml @@ -13,6 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. */}} -{{- if not .Values.k8ssandraOperator.enabled }} +{{- if not .Values.global.cassandra.useOperator }} {{ include "common.replicaPV" . }} {{- end }}
\ No newline at end of file diff --git a/kubernetes/common/cassandra/templates/secrets.yaml b/kubernetes/common/cassandra/templates/secrets.yaml index b776caf6b6..5a611a9bef 100644 --- a/kubernetes/common/cassandra/templates/secrets.yaml +++ b/kubernetes/common/cassandra/templates/secrets.yaml @@ -16,6 +16,6 @@ # limitations under the License. */}} -{{- if .Values.k8ssandraOperator.enabled }} +{{- if .Values.global.cassandra.useOperator }} {{ include "common.secretFast" . }} {{- end }}
\ No newline at end of file diff --git a/kubernetes/common/cassandra/templates/service.yaml b/kubernetes/common/cassandra/templates/service.yaml index 092c677812..8b2e534a5f 100644 --- a/kubernetes/common/cassandra/templates/service.yaml +++ b/kubernetes/common/cassandra/templates/service.yaml @@ -14,6 +14,6 @@ # limitations under the License. */}} -{{- if not .Values.k8ssandraOperator.enabled }} +{{- if not .Values.global.cassandra.useOperator }} {{ include "common.headlessService" . }} {{- end }}
\ No newline at end of file diff --git a/kubernetes/common/cassandra/templates/servicemonitor.yaml b/kubernetes/common/cassandra/templates/servicemonitor.yaml index 759586fcdb..078107393a 100644 --- a/kubernetes/common/cassandra/templates/servicemonitor.yaml +++ b/kubernetes/common/cassandra/templates/servicemonitor.yaml @@ -14,7 +14,7 @@ # limitations under the License. */}} -{{- if not .Values.k8ssandraOperator.enabled }} +{{- if not .Values.global.cassandra.useOperator }} {{- if .Values.metrics.serviceMonitor.enabled }} {{ include "common.serviceMonitor" . }} {{- end }} diff --git a/kubernetes/common/cassandra/templates/statefulset.yaml b/kubernetes/common/cassandra/templates/statefulset.yaml index dff70820e9..4815d14594 100644 --- a/kubernetes/common/cassandra/templates/statefulset.yaml +++ b/kubernetes/common/cassandra/templates/statefulset.yaml @@ -14,7 +14,7 @@ # limitations under the License. */}} -{{- if not .Values.k8ssandraOperator.enabled }} +{{- if not .Values.global.cassandra.useOperator }} apiVersion: apps/v1 kind: StatefulSet metadata: {{- include "common.resourceMetadata" . | nindent 2 }} diff --git a/kubernetes/common/cassandra/values.yaml b/kubernetes/common/cassandra/values.yaml index 2f24750072..930fe9b2d3 100644 --- a/kubernetes/common/cassandra/values.yaml +++ b/kubernetes/common/cassandra/values.yaml @@ -21,9 +21,14 @@ global: # global defaults mountPath: /dockerdata-nfs backup: mountPath: /dockerdata-nfs/backup + cassandra: + # flag to enable the DB creation via k8ssandra-operator + useOperator: true + # if useOperator set to "true", set "enableServiceAccount to "false" + # as the SA is created by the Operator + enableServiceAccount: false k8ssandraOperator: - enabled: true cassandraVersion: 4.0.1 persistence: #storageClassName: default diff --git a/kubernetes/common/common/Chart.yaml b/kubernetes/common/common/Chart.yaml index e134fe8048..4025924f80 100644 --- a/kubernetes/common/common/Chart.yaml +++ b/kubernetes/common/common/Chart.yaml @@ -16,4 +16,4 @@ apiVersion: v2 description: Common templates for inclusion in other charts name: common -version: 13.0.1 +version: 13.0.2 diff --git a/kubernetes/common/common/templates/_cassOp.tpl b/kubernetes/common/common/templates/_cassOp.tpl index c360a0f626..d0f23877a4 100644 --- a/kubernetes/common/common/templates/_cassOp.tpl +++ b/kubernetes/common/common/templates/_cassOp.tpl @@ -1,3 +1,19 @@ +{{/* +# Copyright © 2022 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. +*/}} + {{/* Cassandra Data Center. */}} {{- define "common.k8ssandraCluster" -}} {{- $global := .Values.global }} @@ -10,7 +26,6 @@ spec: reaper: containerImage: registry: {{ include "repositoryGenerator.dockerHubRepository" . }} - heapSize: 512Mi autoScheduling: enabled: true stargate: @@ -67,5 +82,8 @@ spec: pods: annotations: {{ toYaml .Values.podAnnotations | nindent 10 }} + commonLabels: + app: {{ .Values.k8ssandraOperator.config.clusterName }} + version: {{ .Values.k8ssandraOperator.cassandraVersion }} {{- end }} {{ end }} diff --git a/kubernetes/common/common/templates/_mariadb.tpl b/kubernetes/common/common/templates/_mariadb.tpl index 5021c500b0..7e127e2437 100644 --- a/kubernetes/common/common/templates/_mariadb.tpl +++ b/kubernetes/common/common/templates/_mariadb.tpl @@ -59,6 +59,17 @@ {{- end -}} {{/* + Choose the name of the mariadb app label to use. +*/}} +{{- define "common.mariadbAppName" -}} + {{- if .Values.global.mariadbGalera.localCluster -}} + {{- index .Values "mariadb-galera" "nameOverride" -}} + {{- else -}} + {{- .Values.global.mariadbGalera.nameOverride -}} + {{- end -}} +{{- end -}} + +{{/* Choose the name of the mariadb service to use. */}} {{- define "common.mariadbService" -}} @@ -97,3 +108,246 @@ {{- define "common.mariadbSecretParam" -}} {{ printf "password" -}} {{- end -}} + +{{/* + Create MariDB Database via mariadb-operator +*/}} +{{- define "common.mariadbOpDatabase" -}} +{{- $dot := default . .dot -}} +{{- $dbname := (required "'dbame' param, is required." .dbname) -}} +{{- $dbinst := (required "'dbinst' param, is required." .dbinst) -}} +--- +apiVersion: mariadb.mmontes.io/v1alpha1 +kind: Database +metadata: + name: {{ $dbname }} +spec: + mariaDbRef: + name: {{ $dbinst }} + characterSet: utf8 + collate: utf8_general_ci +{{- end -}} + +{{/* + Create MariaDB User via mariadb-operator +*/}} +{{- define "common.mariadbOpUser" -}} +{{- $dot := default . .dot -}} +{{- $dbuser := (required "'dbuser' param, is required." .dbuser) -}} +{{- $dbinst := (required "'dbinst' param, is required." .dbinst) -}} +{{- $dbsecret := (required "'dbsecret' param, is required." .dbsecret) -}} +--- +apiVersion: mariadb.mmontes.io/v1alpha1 +kind: User +metadata: + name: {{ $dbuser }} +spec: + # If you want the user to be created with a different name than the resource name + # name: user-custom + mariaDbRef: + name: {{ $dbinst }} + passwordSecretKeyRef: + name: {{ $dbsecret }} + key: password + # This field is immutable and defaults to 10 + maxUserConnections: 100 +{{- end -}} + +{{/* + Grant rights to a MariaDB User via mariadb-operator +*/}} +{{- define "common.mariadbOpGrants" -}} +{{- $dot := default . .dot -}} +{{- $dbuser := (required "'dbuser' param, is required." .dbuser) -}} +{{- $dbname := (required "'dbame' param, is required." .dbname) -}} +{{- $dbinst := (required "'dbinst' param, is required." .dbinst) -}} +--- +apiVersion: mariadb.mmontes.io/v1alpha1 +kind: Grant +metadata: + name: {{ $dbuser }}-{{ $dbname }}-{{ $dbinst }} +spec: + mariaDbRef: + name: {{ $dbinst }} + privileges: + - "ALL" + database: {{ $dbname }} + table: "*" + username: {{ $dbuser }} + grantOption: true +{{- end -}} + +{{/* + MariaDB Backup via mariadb-operator +*/}} +{{- define "common.mariadbOpBackup" -}} +{{- $dot := default . .dot -}} +{{- $dbinst := include "common.name" $dot -}} +kind: Backup +metadata: + name: backup-scheduled +spec: + mariaDbRef: + name: {{ $dbinst }} + schedule: + cron: "*/1 * * * *" + suspend: false + maxRetentionDays: 30 + storage: + persistentVolumeClaim: + resources: + requests: + storage: 100Mi + {{- if .Values.mariadbOperator.storageClassName }} + storageClassName: {{ .Values.mariadbOperator.storageClassName }} + {{- end }} + accessModes: + - ReadWriteOnce + resources: + requests: + cpu: 100m + memory: 128Mi + limits: + cpu: 300m + memory: 512Mi +{{- end -}} + +{{/* + Create a MariaDB instance via mariadb-operator +*/}} +{{- define "common.mariadbOpInstance" -}} +{{- $dot := default . .dot -}} +{{- $global := $dot.Values.global -}} +{{- $dbinst := include "common.name" $dot -}} +{{- $dbrootsecret := tpl (default (include "common.mariadb.secret.rootPassSecretName" (dict "dot" $dot "chartName" "")) $dot.Values.rootUser.externalSecret) $dot -}} +{{- $dbusersecret := tpl (default (include "common.mariadb.secret.userCredentialsSecretName" (dict "dot" $dot "chartName" "")) $dot.Values.db.externalSecret) $dot -}} +--- +apiVersion: mariadb.mmontes.io/v1alpha1 +kind: MariaDB +metadata: + name: {{ $dbinst }} +spec: + podSecurityContext: + runAsUser: 10001 + runAsGroup: 10001 + fsGroup: 10001 + inheritMetadata: + {{ if .Values.podAnnotations -}} + annotations: {{ toYaml .Values.podAnnotations | nindent 6 }} + {{- end }} + labels: + app: {{ $dbinst }} + version: {{ .Values.mariadbOperator.appVersion }} + rootPasswordSecretKeyRef: + name: {{ $dbrootsecret }} + key: password + image: + repository: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.mariadbOperator.image }} + tag: {{ $dot.Values.mariadbOperator.appVersion }} + pullPolicy: IfNotPresent + imagePullSecrets: + - name: {{ include "common.namespace" . }}-docker-registry-key + port: 3306 + replicas: {{ $dot.Values.replicaCount }} + galera: + {{- if eq (int $dot.Values.replicaCount) 1 }} + enabled: false + {{- else }} + enabled: {{ $dot.Values.mariadbOperator.galera.enabled }} + {{- end }} + sst: mariabackup + replicaThreads: 1 + agent: + image: + repository: {{ include "repositoryGenerator.githubContainerRegistry" . }}/{{ .Values.mariadbOperator.galera.agentImage }} + tag: {{ $dot.Values.mariadbOperator.galera.agentVersion }} + pullPolicy: IfNotPresent + port: 5555 + kubernetesAuth: + enabled: true + authDelegatorRoleName: {{ $dbinst }}-auth + gracefulShutdownTimeout: 5s + recovery: + enabled: true + clusterHealthyTimeout: 5m + clusterBootstrapTimeout: 10m + podRecoveryTimeout: 5m + podSyncTimeout: 10m + initContainer: + image: + repository: {{ include "repositoryGenerator.githubContainerRegistry" . }}/{{ $dot.Values.mariadbOperator.galera.initImage }} + tag: {{ $dot.Values.mariadbOperator.galera.initVersion }} + pullPolicy: IfNotPresent + volumeClaimTemplate: + resources: + requests: + storage: 50Mi + accessModes: + - ReadWriteOnce + livenessProbe: + exec: + command: + - bash + - '-c' + - mariadb -u root -p"${MARIADB_ROOT_PASSWORD}" -e "SELECT 1;" + initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 5 + readinessProbe: + exec: + command: + - bash + - '-c' + - mariadb -u root -p"${MARIADB_ROOT_PASSWORD}" -e "SELECT 1;" + initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 5 + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - topologyKey: kubernetes.io/hostname + tolerations: + - key: mariadb.mmontes.io/ha + operator: Exists + effect: NoSchedule + podDisruptionBudget: + maxUnavailable: 50% + updateStrategy: + type: RollingUpdate + #myCnf: | + # [mysqld] + # bind-address=0.0.0.0 + # default_storage_engine=InnoDB + # binlog_format=row + # innodb_autoinc_lock_mode=2 + # 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 + + myCnfConfigMapKeyRef: + key: my.cnf + name: {{ printf "%s-configuration" (include "common.fullname" $dot) }} + resources: {{ include "common.resources" . | nindent 4 }} + volumeClaimTemplate: + {{- if $dot.Values.mariadbOperator.storageClassName }} + storageClassName: {{ $dot.Values.k8ssandraOperator.persistence.storageClassName }} + {{- end }} + resources: + requests: + storage: {{ $dot.Values.persistence.size | quote }} + accessModes: + - ReadWriteOnce +{{- if $dot.Values.db.user }} +{{ include "common.mariadbOpUser" (dict "dot" . "dbuser" $dot.Values.db.user "dbinst" $dbinst "dbsecret" $dbusersecret) }} +{{- end }} +{{- if $dot.Values.db.name }} +{{ include "common.mariadbOpDatabase" (dict "dot" . "dbname" $dot.Values.db.name "dbinst" $dbinst) }} +{{- end }} +{{- if and $dot.Values.db.user $dot.Values.db.name }} +{{ include "common.mariadbOpGrants" (dict "dot" . "dbuser" $dot.Values.db.user "dbname" $dot.Values.db.name "dbinst" $dbinst) }} +{{- end }} +{{- end -}} diff --git a/kubernetes/common/dgbuilder/templates/deployment.yaml b/kubernetes/common/dgbuilder/templates/deployment.yaml index 92fc13d21a..84d6bc1d47 100644 --- a/kubernetes/common/dgbuilder/templates/deployment.yaml +++ b/kubernetes/common/dgbuilder/templates/deployment.yaml @@ -61,7 +61,7 @@ spec: - command: - /app/ready.py args: - - --container-name + - --app-name - {{ .Values.config.dbPodName }} env: - name: NAMESPACE 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 diff --git a/kubernetes/common/mariadb-init/templates/job.yaml b/kubernetes/common/mariadb-init/templates/job.yaml index a899d93a28..f41f5232a9 100644 --- a/kubernetes/common/mariadb-init/templates/job.yaml +++ b/kubernetes/common/mariadb-init/templates/job.yaml @@ -41,7 +41,7 @@ spec: command: - /app/ready.py args: - - --container-name + - --app-name - {{ default .Values.global.mariadbGalera.nameOverride .Values.mariadbGalera.containerName }} env: - name: NAMESPACE diff --git a/kubernetes/common/network-name-gen/templates/deployment.yaml b/kubernetes/common/network-name-gen/templates/deployment.yaml index b170c8fea6..1eed35c0c5 100644 --- a/kubernetes/common/network-name-gen/templates/deployment.yaml +++ b/kubernetes/common/network-name-gen/templates/deployment.yaml @@ -29,7 +29,7 @@ spec: - /app/ready.py args: {{- if .Values.global.mariadbGalera.localCluster }} - - --container-name + - --app-name - {{ index .Values "mariadb-galera" "nameOverride" }} {{- else }} - --job-name diff --git a/kubernetes/common/network-name-gen/values.yaml b/kubernetes/common/network-name-gen/values.yaml index 5858e84389..adfa468d6e 100644 --- a/kubernetes/common/network-name-gen/values.yaml +++ b/kubernetes/common/network-name-gen/values.yaml @@ -30,7 +30,7 @@ global: #as the dependency check will not work otherwise (Chart.yaml) localCluster: false globalCluster: true - service: mariadb-galera + service: mariadb-galera-primary internalPort: 3306 nameOverride: mariadb-galera @@ -63,6 +63,10 @@ mariadb-galera: name: nengdb portName: nengdbport replicaCount: 1 + mariadbOperator: + galera: + enabled: false + persistence: enabled: true mountSubPath: network-name-gen/data diff --git a/kubernetes/common/readinessCheck/templates/_readinessCheck.tpl b/kubernetes/common/readinessCheck/templates/_readinessCheck.tpl index 90c278e4c5..879be1288f 100644 --- a/kubernetes/common/readinessCheck/templates/_readinessCheck.tpl +++ b/kubernetes/common/readinessCheck/templates/_readinessCheck.tpl @@ -35,6 +35,20 @@ - aaf-cm - aaf-service + the powerful one allows also to wait for pod names with this + (has to start with the given pod name): + wait_for: + name: myname + pods: + - test-pod + + the powerful one allows also to wait for pods with the + given "app" label: + wait_for: + name: myname + apps: + - mariadb-galera + the powerful one allows also to wait for jobs with this: wait_for: name: myname @@ -48,7 +62,7 @@ - .dot : environment (.) - .initRoot : the root dictionary of readinessCheck submodule (default to .Values.readinessCheck) - - .wait_for : list of containers / jobs to wait for (default to + - .wait_for : list of containers / pods /apps / jobs to wait for (default to .Values.wait_for) Example calls: @@ -62,6 +76,8 @@ {{- $subchartDot := fromJson (include "common.subChartDot" (dict "dot" $dot "initRoot" $initRoot)) }} {{- $wait_for := default $initRoot.wait_for .wait_for -}} {{- $containers := index (ternary (dict "containers" $wait_for) $wait_for (kindIs "slice" $wait_for)) "containers" -}} +{{- $pods := index (ternary (dict) $wait_for (kindIs "slice" $wait_for)) "pods" -}} +{{- $apps := index (ternary (dict) $wait_for (kindIs "slice" $wait_for)) "apps" -}} {{- $namePart := index (ternary (dict) $wait_for (kindIs "slice" $wait_for)) "name" -}} {{- $jobs := index (ternary (dict) $wait_for (kindIs "slice" $wait_for)) "jobs" -}} - name: {{ include "common.name" $dot }}{{ ternary "" (printf "-%s" $namePart) (empty $namePart) }}-readiness @@ -77,6 +93,14 @@ - --container-name - {{ tpl $container $dot }} {{- end }} + {{- range $pod := default (list) $pods }} + - --pod-name + - {{ tpl $pod $dot }} + {{- end }} + {{- range $app := default (list) $apps }} + - --app-name + - {{ tpl $app $dot }} + {{- end }} {{- range $job := $jobs }} - --job-name - {{ tpl $job $dot }} diff --git a/kubernetes/common/repositoryGenerator/values.yaml b/kubernetes/common/repositoryGenerator/values.yaml index 66ab4e239e..03ffddafd1 100644 --- a/kubernetes/common/repositoryGenerator/values.yaml +++ b/kubernetes/common/repositoryGenerator/values.yaml @@ -39,10 +39,10 @@ global: mariadbImage: bitnami/mariadb:10.5.8 nginxImage: bitnami/nginx:1.21.4 postgresImage: crunchydata/crunchy-postgres:centos8-13.2-4.6.1 - readinessImage: onap/oom/readiness:3.0.1 + readinessImage: onap/oom/readiness:5.0.1 dcaePolicySyncImage: onap/org.onap.dcaegen2.deployments.dcae-services-policy-sync:1.0.1 drProvClientImage: onap/dmaap/datarouter-prov-client:2.1.15 - quitQuitImage: onap/oom/readiness:4.1.0 + quitQuitImage: onap/oom/readiness:5.0.1 # Default credentials # they're optional. If the target repository doesn't need them, comment them diff --git a/kubernetes/dmaap/components/dmaap-dr-prov/values.yaml b/kubernetes/dmaap/components/dmaap-dr-prov/values.yaml index 979769667b..da37a819c6 100644 --- a/kubernetes/dmaap/components/dmaap-dr-prov/values.yaml +++ b/kubernetes/dmaap/components/dmaap-dr-prov/values.yaml @@ -19,7 +19,7 @@ global: mariadbGalera: &mariadbGalera #This flag allows DMAAP-DR to instantiate its own mariadb-galera cluster localCluster: false - service: mariadb-galera + service: mariadb-galera-primary internalPort: 3306 nameOverride: mariadb-galera @@ -93,6 +93,9 @@ readiness: mariadb-galera: nameOverride: &dbServer dmaap-dr-db replicaCount: 1 + mariadbOperator: + galera: + enabled: false db: name: &mysqlDbName datarouter user: datarouter diff --git a/kubernetes/modeling/components/modeling-etsicatalog/templates/deployment.yaml b/kubernetes/modeling/components/modeling-etsicatalog/templates/deployment.yaml index 64cd894799..9e1dcdd084 100644 --- a/kubernetes/modeling/components/modeling-etsicatalog/templates/deployment.yaml +++ b/kubernetes/modeling/components/modeling-etsicatalog/templates/deployment.yaml @@ -42,7 +42,7 @@ spec: - /app/ready.py args: {{- if .Values.global.mariadbGalera.localCluster }} - - --container-name + - --app-name - {{ index .Values "mariadb-galera" "nameOverride" }} {{- else }} - --job-name diff --git a/kubernetes/modeling/components/modeling-etsicatalog/values.yaml b/kubernetes/modeling/components/modeling-etsicatalog/values.yaml index d5814bc35b..0aef0f5ce5 100644 --- a/kubernetes/modeling/components/modeling-etsicatalog/values.yaml +++ b/kubernetes/modeling/components/modeling-etsicatalog/values.yaml @@ -27,7 +27,7 @@ global: #as the dependency check will not work otherwise (Chart.yaml) localCluster: false globalCluster: true - service: mariadb-galera + service: mariadb-galera-primary internalPort: 3306 nameOverride: mariadb-galera @@ -70,6 +70,10 @@ mariadb-galera: disableNfsProvisioner: true serviceAccount: nameOverride: *modeling-db + replicaCount: 1 + mariadbOperator: + galera: + enabled: false mariadb-init: config: diff --git a/kubernetes/nbi/values.yaml b/kubernetes/nbi/values.yaml index 3591d94cc1..a1f6527f5d 100644 --- a/kubernetes/nbi/values.yaml +++ b/kubernetes/nbi/values.yaml @@ -19,12 +19,12 @@ global: nodePortPrefix: 302 mariadbGalera: &mariadbGalera - #This flag allows SO to instantiate its own mariadb-galera cluster + #This flag allows NBI to instantiate its own mariadb-galera cluster #When changing it to "true", also set "globalCluster: false" #as the dependency check will not work otherwise (Chart.yaml) localCluster: false globalCluster: true - service: mariadb-galera + service: mariadb-galera-primary internalPort: 3306 nameOverride: mariadb-galera msbEnabled: false @@ -77,6 +77,9 @@ mariadb-galera: internalPort: 3306 nameOverride: &nbi-galera nbi-galera replicaCount: 1 + mariadbOperator: + galera: + enabled: false persistence: enabled: true mountSubPath: nbi/maria/data diff --git a/kubernetes/onap/values.yaml b/kubernetes/onap/values.yaml index 1f40bd3906..a157414810 100755 --- a/kubernetes/onap/values.yaml +++ b/kubernetes/onap/values.yaml @@ -89,7 +89,7 @@ global: postgresImage: crunchydata/crunchy-postgres:centos8-13.2-4.6.1 # readiness check image - readinessImage: onap/oom/readiness:3.0.1 + readinessImage: onap/oom/readiness:5.0.1 # image pull policy pullPolicy: Always diff --git a/kubernetes/policy/components/policy-api/values.yaml b/kubernetes/policy/components/policy-api/values.yaml index c9ee8eb980..27d30e0aaf 100755 --- a/kubernetes/policy/components/policy-api/values.yaml +++ b/kubernetes/policy/components/policy-api/values.yaml @@ -56,7 +56,7 @@ debugEnabled: false # application configuration db: - user: policy_user + user: policy-user password: policy_user service: name: policy-mariadb diff --git a/kubernetes/policy/components/policy-clamp-runtime-acm/values.yaml b/kubernetes/policy/components/policy-clamp-runtime-acm/values.yaml index 83e4350e7d..34c128e343 100644 --- a/kubernetes/policy/components/policy-clamp-runtime-acm/values.yaml +++ b/kubernetes/policy/components/policy-clamp-runtime-acm/values.yaml @@ -82,7 +82,7 @@ kafkaTopic: - name: *acRuntimeTopic db: - user: policy_user + user: policy-user password: policy_user service: name: policy-mariadb diff --git a/kubernetes/policy/components/policy-drools-pdp/values.yaml b/kubernetes/policy/components/policy-drools-pdp/values.yaml index 9ef74e8d86..d2f1630934 100755 --- a/kubernetes/policy/components/policy-drools-pdp/values.yaml +++ b/kubernetes/policy/components/policy-drools-pdp/values.yaml @@ -101,7 +101,7 @@ nexus: db: name: policy-mariadb - user: policy_user + user: policy-user password: policy_user pap: diff --git a/kubernetes/policy/components/policy-pap/values.yaml b/kubernetes/policy/components/policy-pap/values.yaml index 22428e7736..d52ff883aa 100755 --- a/kubernetes/policy/components/policy-pap/values.yaml +++ b/kubernetes/policy/components/policy-pap/values.yaml @@ -78,7 +78,7 @@ debugEnabled: false # application configuration db: - user: policy_user + user: policy-user password: policy_user service: name: policy-mariadb diff --git a/kubernetes/policy/components/policy-xacml-pdp/values.yaml b/kubernetes/policy/components/policy-xacml-pdp/values.yaml index d399cd5c4c..4cebf4f58c 100755 --- a/kubernetes/policy/components/policy-xacml-pdp/values.yaml +++ b/kubernetes/policy/components/policy-xacml-pdp/values.yaml @@ -58,7 +58,7 @@ debugEnabled: false # application configuration db: - user: policy_user + user: policy-user password: policy_user service: name: policy-mariadb diff --git a/kubernetes/policy/resources/config/db.sh b/kubernetes/policy/resources/config/db.sh index 36574bc1ad..d793a024df 100755 --- a/kubernetes/policy/resources/config/db.sh +++ b/kubernetes/policy/resources/config/db.sh @@ -17,12 +17,31 @@ # limitations under the License. */}} -mysqlcmd() { mysql -h ${MYSQL_HOST} -P ${MYSQL_USER} "$@"; }; +mysqlcmd() { mysql -h ${MYSQL_HOST} -P ${MYSQL_PORT} "$@"; }; +i=5 +RESULT_VARIABLE=0 +echo "Check if user ${MYSQL_USER} is created in DB ${MYSQL_HOST}" +while [ $i -gt 0 ] && [ "$RESULT_VARIABLE" != 1 ] +do + i=$(( i-1 )) + RESULT_VARIABLE="$(mysqlcmd -uroot -p"${MYSQL_ROOT_PASSWORD}" -se "SELECT EXISTS(SELECT 1 FROM mysql.user WHERE user = '${MYSQL_USER}')")" + if [ "$RESULT_VARIABLE" = 1 ]; then + echo "User ${MYSQL_USER} exists" + else + echo "User ${MYSQL_USER} does not exist" + sleep 10 + fi +done +if [ "$RESULT_VARIABLE" != 1 ]; then + exit 1 +fi for db in migration pooling policyadmin policyclamp operationshistory clampacm do + echo "Create DB ${db}" mysqlcmd -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "CREATE DATABASE IF NOT EXISTS ${db};" + echo "Grand access for user ${MYSQL_USER}" mysqlcmd -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "GRANT ALL PRIVILEGES ON \`${db}\`.* TO '${MYSQL_USER}'@'%' ;" done - -mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "FLUSH PRIVILEGES;" +echo "Flush privileges" +mysqlcmd -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "FLUSH PRIVILEGES;" diff --git a/kubernetes/policy/templates/job.yaml b/kubernetes/policy/templates/job.yaml index 2503c6fd5f..8161bc1963 100755 --- a/kubernetes/policy/templates/job.yaml +++ b/kubernetes/policy/templates/job.yaml @@ -41,7 +41,7 @@ spec: imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} command: - /app/ready.py - - --container-name + - --app-name - {{ index .Values "mariadb-galera" "service" "name" }} env: - name: NAMESPACE diff --git a/kubernetes/policy/values.yaml b/kubernetes/policy/values.yaml index 9027e490f0..b3b47439c4 100755 --- a/kubernetes/policy/values.yaml +++ b/kubernetes/policy/values.yaml @@ -212,7 +212,7 @@ config: mariadb-galera: # mariadb-galera.config and global.mariadb.config must be equals db: - user: policy_user + user: policy-user # password: externalSecret: *dbSecretName name: &mysqlDbName policyadmin @@ -222,6 +222,9 @@ mariadb-galera: # mariadb-galera.service and global.mariadb.service must be equals service: *mariadbService replicaCount: 1 + mariadbOperator: + galera: + enabled: false persistence: enabled: true mountSubPath: policy/maria/data @@ -244,7 +247,7 @@ postgres: mountSubPath: policy/postgres/data mountInitPath: policy config: - pgUserName: policy_user + pgUserName: policy-user pgDatabase: policyadmin pgUserExternalSecret: *dbSecretName pgRootPasswordExternalSecret: *dbRootPassSecretName diff --git a/kubernetes/sdc/components/sdc-cs/templates/job.yaml b/kubernetes/sdc/components/sdc-cs/templates/job.yaml index 61104ede0b..3738ff4a22 100644 --- a/kubernetes/sdc/components/sdc-cs/templates/job.yaml +++ b/kubernetes/sdc/components/sdc-cs/templates/job.yaml @@ -34,7 +34,7 @@ spec: command: - /app/ready.py args: - - --container-name + - --app-name {{- if .Values.global.sdc_cassandra.localCluster }} - sdc-cs {{- else }} diff --git a/kubernetes/sdc/components/sdc-cs/values.yaml b/kubernetes/sdc/components/sdc-cs/values.yaml index e5d1c84129..ac8103e380 100644 --- a/kubernetes/sdc/components/sdc-cs/values.yaml +++ b/kubernetes/sdc/components/sdc-cs/values.yaml @@ -25,6 +25,14 @@ global: #This flag allows SDC to instantiate its own cluster, serviceName #should be sdc-cs if this flag is enabled localCluster: false + + # in case of a local cassandra cluster + # flag to enable the DB creation via k8ssandra-operator + useOperator: true + # if useOperator set to "true", set "enableServiceAccount to "false" + # as the SA is created by the Operator + enableServiceAccount: false + #The cassandra service name to connect to (default: shared cassandra service) #in case of using k8ssandra-operator in the common cassandra installation #the service name is: @@ -59,7 +67,6 @@ cassandra: mountSubPath: sdc/sdc-cs/CS enabled: true k8ssandraOperator: - enabled: false config: clusterName: sdc-cs diff --git a/kubernetes/sdnc/components/dmaap-listener/templates/deployment.yaml b/kubernetes/sdnc/components/dmaap-listener/templates/deployment.yaml index 411dc01166..03c546321a 100644 --- a/kubernetes/sdnc/components/dmaap-listener/templates/deployment.yaml +++ b/kubernetes/sdnc/components/dmaap-listener/templates/deployment.yaml @@ -50,8 +50,8 @@ spec: - command: - /app/ready.py args: - - --container-name - - {{ include "common.mariadbService" . }} + - --app-name + - {{ include "common.mariadbAppName" . }} - --container-name - {{ .Values.config.sdncChartName }} - --container-name diff --git a/kubernetes/sdnc/components/dmaap-listener/values.yaml b/kubernetes/sdnc/components/dmaap-listener/values.yaml index 57419728c8..db15a7a2f6 100644 --- a/kubernetes/sdnc/components/dmaap-listener/values.yaml +++ b/kubernetes/sdnc/components/dmaap-listener/values.yaml @@ -21,7 +21,7 @@ global: #This flag allows SO to instantiate its own mariadb-galera cluster #If shared instance is used, this chart assumes that DB already exists localCluster: false - service: mariadb-galera + service: mariadb-galera-primary internalPort: 3306 nameOverride: mariadb-galera diff --git a/kubernetes/sdnc/components/sdnc-ansible-server/values.yaml b/kubernetes/sdnc/components/sdnc-ansible-server/values.yaml index 4a48b64956..cb778aefff 100644 --- a/kubernetes/sdnc/components/sdnc-ansible-server/values.yaml +++ b/kubernetes/sdnc/components/sdnc-ansible-server/values.yaml @@ -21,7 +21,7 @@ global: #This flag allows SO to instantiate its own mariadb-galera cluster #If shared instance is used, this chart assumes that DB already exists localCluster: false - service: mariadb-galera + service: mariadb-galera-primary internalPort: 3306 nameOverride: mariadb-galera diff --git a/kubernetes/sdnc/components/ueb-listener/templates/deployment.yaml b/kubernetes/sdnc/components/ueb-listener/templates/deployment.yaml index 9956e06cda..0ca1601ca4 100644 --- a/kubernetes/sdnc/components/ueb-listener/templates/deployment.yaml +++ b/kubernetes/sdnc/components/ueb-listener/templates/deployment.yaml @@ -53,8 +53,8 @@ spec: - command: - /app/ready.py args: - - --container-name - - {{ include "common.mariadbService" . }} + - --app-name + - {{ include "common.mariadbAppName" . }} - --container-name - {{ .Values.config.sdncChartName }} - --container-name diff --git a/kubernetes/sdnc/components/ueb-listener/values.yaml b/kubernetes/sdnc/components/ueb-listener/values.yaml index df559e9d9f..83d0e78f7c 100644 --- a/kubernetes/sdnc/components/ueb-listener/values.yaml +++ b/kubernetes/sdnc/components/ueb-listener/values.yaml @@ -21,7 +21,7 @@ global: #This flag allows SO to instantiate its own mariadb-galera cluster #If shared instance is used, this chart assumes that DB already exists localCluster: false - service: mariadb-galera + service: mariadb-galera-primary internalPort: 3306 nameOverride: mariadb-galera diff --git a/kubernetes/sdnc/templates/job.yaml b/kubernetes/sdnc/templates/job.yaml index e1d24b10fe..afe0e72f15 100755 --- a/kubernetes/sdnc/templates/job.yaml +++ b/kubernetes/sdnc/templates/job.yaml @@ -80,8 +80,8 @@ spec: command: - /app/ready.py args: - - --container-name - - {{ include "common.mariadbService" . }} + - --app-name + - {{ include "common.mariadbAppName" . }} env: - name: NAMESPACE valueFrom: diff --git a/kubernetes/sdnc/templates/sdnrdb-init-job.yaml b/kubernetes/sdnc/templates/sdnrdb-init-job.yaml index 4b2f773f06..e42757e5ba 100755 --- a/kubernetes/sdnc/templates/sdnrdb-init-job.yaml +++ b/kubernetes/sdnc/templates/sdnrdb-init-job.yaml @@ -28,9 +28,9 @@ spec: - /app/ready.py args: {{- if .Values.config.sdnr.mariadb.enabled }} - - --container-name - - {{ include "common.mariadbService" . }} - {{- else -}} + - --app-name + - {{ include "common.mariadbAppName" . }} + {{- else }} - --container-name - {{.Values.elasticsearch.nameOverride}}-elasticsearch - --container-name @@ -56,7 +56,7 @@ spec: - | {{- if .Values.config.sdnr.mariadb.enabled }} "{{ .Values.config.binDir }}/createSdnrDb.sh"; - {{- end -}} + {{- end }} sleep 90; "{{ .Values.config.binDir }}/startODL.sh" env: - name: SDNC_AAF_ENABLED @@ -85,12 +85,12 @@ spec: {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnrdb-secret" "key" "login") | indent 12 }} - name: SDNRDBPASSWORD {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnrdb-secret" "key" "password") | indent 12 }} - {{- else -}} + {{- else }} - name: SDNRDBURL value: "http://{{ .Values.elasticsearch.service.name | default "sdnrdb"}}.{{.Release.Namespace}}:{{.Values.elasticsearch.service.port | default "9200"}}" - name: SDNRDBPARAMETER value: "-k" - {{- end }} + {{- end }} {{- if .Values.config.sdnr.mariadb.enabled }} volumeMounts: - mountPath: {{ .Values.config.binDir }}/createSdnrDb.sh @@ -140,5 +140,4 @@ spec: restartPolicy: Never imagePullSecrets: - name: "{{ include "common.namespace" . }}-docker-registry-key" - {{ end -}} diff --git a/kubernetes/sdnc/templates/statefulset.yaml b/kubernetes/sdnc/templates/statefulset.yaml index 20f82e0d74..4607b62d46 100644 --- a/kubernetes/sdnc/templates/statefulset.yaml +++ b/kubernetes/sdnc/templates/statefulset.yaml @@ -138,8 +138,8 @@ spec: - /app/ready.py args: {{ if .Values.dgbuilder.enabled -}} - - --container-name - - {{ include "common.mariadbService" . }} + - --app-name + - {{ include "common.mariadbAppName" . }} - --job-name - {{ include "common.fullname" . }}-dbinit-job {{ end -}} @@ -313,7 +313,7 @@ spec: value: {{ .Values.config.sdnr.mariadb.asyncHandling | default "false" | quote }} - name: SDNR_ASYNC_POOLSIZE value: {{ .Values.config.sdnr.mariadb.asyncPoolSize | default 200 | quote }} - {{- else -}} + {{- else }} - name: SDNRDBURL value: "http://{{ .Values.elasticsearch.service.name | default "sdnrdb"}}.{{.Release.Namespace}}:{{.Values.elasticsearch.service.port | default "9200"}}" {{- if .Values.config.sdnr.sdnrdbTrustAllCerts }} diff --git a/kubernetes/sdnc/values.yaml b/kubernetes/sdnc/values.yaml index e35dfde593..2c6abdd23b 100644 --- a/kubernetes/sdnc/values.yaml +++ b/kubernetes/sdnc/values.yaml @@ -27,9 +27,9 @@ global: #This flag allows SO to instantiate its own mariadb-galera cluster #If shared instance is used, this chart assumes that DB already exists localCluster: false - service: mariadb-galera + service: &mariadbService mariadb-galera-primary internalPort: 3306 - nameOverride: mariadb-galera + nameOverride: &mariadbName mariadb-galera ################################################################# @@ -323,12 +323,12 @@ config: sdnrdbTrustAllCerts: true elasticsearch: ## for legacy eleasticsearch database - # enabled: &esdbenabled true - enabled: &esdbenabled false + enabled: &esdbenabled true + # enabled: &esdbenabled false mariadb: ## for legacy eleasticsearch database - # enabled: false - enabled: true + enabled: false + # enabled: true databaseName: sdnrdb user: sdnrdb externalSecret: *sdnrdbSecretName @@ -425,6 +425,9 @@ mariadb-galera: &mariadbGalera mountSubPath: sdnc/mariadb-galera enabled: true replicaCount: 1 + mariadbOperator: + galera: + enabled: false serviceAccount: nameOverride: *sdnc-db @@ -485,8 +488,8 @@ dgbuilder: (include "common.mariadb.secret.rootPassSecretName" (dict "dot" . "chartName" "mariadb-galera")) }}' userCredentialsExternalSecret: *dbSecretName - dbPodName: mariadb-galera - dbServiceName: mariadb-galera + dbPodName: *mariadbName + dbServiceName: *mariadbService # This should be revisited and changed to plain text dgUserPassword: cc03e747a6afbbcbf8be7668acfebee5 serviceAccount: diff --git a/kubernetes/so/components/so-admin-cockpit/values.yaml b/kubernetes/so/components/so-admin-cockpit/values.yaml index 5e81fa622f..32074d94b5 100644 --- a/kubernetes/so/components/so-admin-cockpit/values.yaml +++ b/kubernetes/so/components/so-admin-cockpit/values.yaml @@ -31,7 +31,7 @@ global: persistence: mountPath: /dockerdata-nfs mariadbGalera: - serviceName: mariadb-galera + service: mariadb-galera-primary servicePort: '3306' ################################################################# diff --git a/kubernetes/so/components/so-bpmn-infra/values.yaml b/kubernetes/so/components/so-bpmn-infra/values.yaml index 31573afb3e..0d5a0c4e59 100755 --- a/kubernetes/so/components/so-bpmn-infra/values.yaml +++ b/kubernetes/so/components/so-bpmn-infra/values.yaml @@ -23,7 +23,7 @@ global: sdncOamService: sdnc-oam sdncOamPort: 8282 mariadbGalera: - serviceName: mariadb-galera + service: mariadb-galera-primary servicePort: '3306' readinessCheck: diff --git a/kubernetes/so/components/so-catalog-db-adapter/values.yaml b/kubernetes/so/components/so-catalog-db-adapter/values.yaml index c9410ca551..23a3b69355 100755 --- a/kubernetes/so/components/so-catalog-db-adapter/values.yaml +++ b/kubernetes/so/components/so-catalog-db-adapter/values.yaml @@ -22,7 +22,7 @@ global: app: msoKey: 07a7159d3bf51a0e53be7a8f89699be7 mariadbGalera: - serviceName: mariadb-galera + service: mariadb-galera-primary servicePort: '3306' readinessCheck: diff --git a/kubernetes/so/components/so-cnfm-lcm/values.yaml b/kubernetes/so/components/so-cnfm-lcm/values.yaml index 4e6adc4ef7..c3388d66e4 100644 --- a/kubernetes/so/components/so-cnfm-lcm/values.yaml +++ b/kubernetes/so/components/so-cnfm-lcm/values.yaml @@ -19,7 +19,7 @@ global: persistence: mountPath: /dockerdata-nfs mariadbGalera: - serviceName: mariadb-galera + service: mariadb-galera-primary servicePort: '3306' ################################################################# diff --git a/kubernetes/so/components/so-etsi-nfvo-ns-lcm/values.yaml b/kubernetes/so/components/so-etsi-nfvo-ns-lcm/values.yaml index 5d3807eb14..32171baf20 100644 --- a/kubernetes/so/components/so-etsi-nfvo-ns-lcm/values.yaml +++ b/kubernetes/so/components/so-etsi-nfvo-ns-lcm/values.yaml @@ -20,7 +20,7 @@ global: persistence: mountPath: /dockerdata-nfs mariadbGalera: - serviceName: mariadb-galera + service: mariadb-galera-primary servicePort: '3306' ################################################################# diff --git a/kubernetes/so/components/so-etsi-sol005-adapter/values.yaml b/kubernetes/so/components/so-etsi-sol005-adapter/values.yaml index ccdb58c322..e2816b0cfc 100755 --- a/kubernetes/so/components/so-etsi-sol005-adapter/values.yaml +++ b/kubernetes/so/components/so-etsi-sol005-adapter/values.yaml @@ -20,7 +20,7 @@ global: persistence: mountPath: /dockerdata-nfs mariadbGalera: - serviceName: mariadb-galera + service: mariadb-galera-primary servicePort: '3306' readinessCheck: diff --git a/kubernetes/so/components/so-mariadb/values.yaml b/kubernetes/so/components/so-mariadb/values.yaml index bf546a2776..85336813e5 100755 --- a/kubernetes/so/components/so-mariadb/values.yaml +++ b/kubernetes/so/components/so-mariadb/values.yaml @@ -22,11 +22,11 @@ global: nodePortPrefix: 302 nodePortPrefixExt: 304 repository: nexus3.onap.org:10001 - readinessImage: onap/oom/readiness:4.1.0 + readinessImage: onap/oom/readiness:5.0.1 ubuntuInitRepository: docker.io mariadbGalera: nameOverride: &mariadbName mariadb-galera - serviceName: mariadb-galera + service: mariadb-galera-primary servicePort: "3306" migration: enabled: false @@ -37,7 +37,8 @@ global: readinessCheck: wait_for: - - *mariadbName + apps: + - *mariadbName ################################################################# # Secrets metaconfig diff --git a/kubernetes/so/components/so-nssmf-adapter/values.yaml b/kubernetes/so/components/so-nssmf-adapter/values.yaml index 636e32c5b1..c6a6f351db 100755 --- a/kubernetes/so/components/so-nssmf-adapter/values.yaml +++ b/kubernetes/so/components/so-nssmf-adapter/values.yaml @@ -20,7 +20,7 @@ global: persistence: mountPath: /dockerdata-nfs mariadbGalera: - serviceName: mariadb-galera + service: mariadb-galera-primary servicePort: '3306' readinessCheck: diff --git a/kubernetes/so/components/so-oof-adapter/values.yaml b/kubernetes/so/components/so-oof-adapter/values.yaml index 7c5ab2397a..24a171cf99 100755 --- a/kubernetes/so/components/so-oof-adapter/values.yaml +++ b/kubernetes/so/components/so-oof-adapter/values.yaml @@ -21,7 +21,7 @@ global: persistence: mountPath: /dockerdata-nfs mariadbGalera: - serviceName: mariadb-galera + service: mariadb-galera-primary servicePort: '3306' # Secrets metaconfig diff --git a/kubernetes/so/components/so-openstack-adapter/values.yaml b/kubernetes/so/components/so-openstack-adapter/values.yaml index f4a33cb7b7..3258f8f2df 100755 --- a/kubernetes/so/components/so-openstack-adapter/values.yaml +++ b/kubernetes/so/components/so-openstack-adapter/values.yaml @@ -20,7 +20,7 @@ global: persistence: mountPath: /dockerdata-nfs mariadbGalera: - serviceName: mariadb-galera + service: mariadb-galera-primary servicePort: '3306' readinessCheck: diff --git a/kubernetes/so/components/so-request-db-adapter/values.yaml b/kubernetes/so/components/so-request-db-adapter/values.yaml index db6f59ad20..0ec56c07c6 100755 --- a/kubernetes/so/components/so-request-db-adapter/values.yaml +++ b/kubernetes/so/components/so-request-db-adapter/values.yaml @@ -20,7 +20,7 @@ global: persistence: mountPath: /dockerdata-nfs mariadbGalera: - serviceName: mariadb-galera + service: mariadb-galera-primary servicePort: '3306' readinessCheck: diff --git a/kubernetes/so/components/so-sdc-controller/values.yaml b/kubernetes/so/components/so-sdc-controller/values.yaml index 681ff724e9..eea19df8c1 100755 --- a/kubernetes/so/components/so-sdc-controller/values.yaml +++ b/kubernetes/so/components/so-sdc-controller/values.yaml @@ -20,7 +20,7 @@ global: persistence: mountPath: /dockerdata-nfs mariadbGalera: - serviceName: mariadb-galera + service: mariadb-galera-primary servicePort: '3306' soSdcListenerKafkaUser: so-sdc-list-user diff --git a/kubernetes/so/components/so-sdnc-adapter/values.yaml b/kubernetes/so/components/so-sdnc-adapter/values.yaml index d05213ce01..1f0a18d143 100755 --- a/kubernetes/so/components/so-sdnc-adapter/values.yaml +++ b/kubernetes/so/components/so-sdnc-adapter/values.yaml @@ -23,7 +23,7 @@ global: sdncOamService: sdnc-oam sdncOamPort: 8282 mariadbGalera: - serviceName: mariadb-galera + service: mariadb-galera-primary servicePort: '3306' ################################################################# diff --git a/kubernetes/so/values.yaml b/kubernetes/so/values.yaml index f2db958b5a..bf412e8349 100755 --- a/kubernetes/so/values.yaml +++ b/kubernetes/so/values.yaml @@ -22,9 +22,8 @@ global: centralizedLoggingEnabled: true mariadbGalera: nameOverride: mariadb-galera - serviceName: mariadb-galera servicePort: '3306' - service: mariadb-galera + service: mariadb-galera-primary internalPort: '3306' # mariadbRootPassword: secretpassword # rootPasswordExternalSecret: some secret @@ -584,6 +583,9 @@ mariadb-galera: externalSecret: *dbRootPassSecretName nameOverride: &so-mariadb so-mariadb-galera replicaCount: 1 + mariadbOperator: + galera: + enabled: false persistence: mountSubPath: so/mariadb-galera/data enabled: true diff --git a/kubernetes/vfc/components/vfc-nslcm/templates/deployment.yaml b/kubernetes/vfc/components/vfc-nslcm/templates/deployment.yaml index ebfacf52c0..b04238825c 100644 --- a/kubernetes/vfc/components/vfc-nslcm/templates/deployment.yaml +++ b/kubernetes/vfc/components/vfc-nslcm/templates/deployment.yaml @@ -41,8 +41,8 @@ spec: - command: - /app/ready.py args: - - --container-name - - '{{ ternary (index .Values "mariadb-galera" "nameOverride") .Values.global.mariadbGalera.service .Values.global.mariadbGalera.localCluster }}' + - --app-name + - {{ include "common.mariadbAppName" . }} env: - name: NAMESPACE valueFrom: diff --git a/kubernetes/vfc/components/vfc-nslcm/values.yaml b/kubernetes/vfc/components/vfc-nslcm/values.yaml index 0cd3ce178a..1b0fd7c735 100644 --- a/kubernetes/vfc/components/vfc-nslcm/values.yaml +++ b/kubernetes/vfc/components/vfc-nslcm/values.yaml @@ -21,7 +21,7 @@ global: ssl_enabled: false mariadbGalera: localCluster: false - service: mariadb-galera + service: mariadb-galera-primary internalPort: 3306 nameOverride: mariadb-galera diff --git a/kubernetes/vfc/components/vfc-vnflcm/templates/deployment.yaml b/kubernetes/vfc/components/vfc-vnflcm/templates/deployment.yaml index 870541d2f2..ffa834e466 100644 --- a/kubernetes/vfc/components/vfc-vnflcm/templates/deployment.yaml +++ b/kubernetes/vfc/components/vfc-vnflcm/templates/deployment.yaml @@ -41,8 +41,8 @@ spec: - command: - /app/ready.py args: - - --container-name - - '{{ ternary (index .Values "mariadb-galera" "nameOverride") .Values.global.mariadbGalera.service .Values.global.mariadbGalera.localCluster }}' + - --app-name + - {{ include "common.mariadbAppName" . }} env: - name: NAMESPACE valueFrom: diff --git a/kubernetes/vfc/components/vfc-vnflcm/values.yaml b/kubernetes/vfc/components/vfc-vnflcm/values.yaml index fcad261817..191a6ee9b4 100644 --- a/kubernetes/vfc/components/vfc-vnflcm/values.yaml +++ b/kubernetes/vfc/components/vfc-vnflcm/values.yaml @@ -21,7 +21,7 @@ global: ssl_enabled: false mariadbGalera: localCluster: false - service: mariadb-galera + service: mariadb-galera-primary internalPort: 3306 nameOverride: mariadb-galera diff --git a/kubernetes/vfc/components/vfc-vnfmgr/templates/deployment.yaml b/kubernetes/vfc/components/vfc-vnfmgr/templates/deployment.yaml index a690a9d08d..23ea79f5f8 100644 --- a/kubernetes/vfc/components/vfc-vnfmgr/templates/deployment.yaml +++ b/kubernetes/vfc/components/vfc-vnfmgr/templates/deployment.yaml @@ -41,8 +41,8 @@ spec: - command: - /app/ready.py args: - - --container-name - - '{{ ternary (index .Values "mariadb-galera" "nameOverride") .Values.global.mariadbGalera.service .Values.global.mariadbGalera.localCluster }}' + - --app-name + - {{ include "common.mariadbAppName" . }} env: - name: NAMESPACE valueFrom: diff --git a/kubernetes/vfc/components/vfc-vnfmgr/values.yaml b/kubernetes/vfc/components/vfc-vnfmgr/values.yaml index 528bbe0c01..e6f5654184 100644 --- a/kubernetes/vfc/components/vfc-vnfmgr/values.yaml +++ b/kubernetes/vfc/components/vfc-vnfmgr/values.yaml @@ -21,7 +21,7 @@ global: ssl_enabled: false mariadbGalera: localCluster: false - service: mariadb-galera + service: mariadb-galera-primary internalPort: 3306 nameOverride: mariadb-galera diff --git a/kubernetes/vfc/components/vfc-vnfres/templates/deployment.yaml b/kubernetes/vfc/components/vfc-vnfres/templates/deployment.yaml index 7994294cd1..9433e13cfe 100644 --- a/kubernetes/vfc/components/vfc-vnfres/templates/deployment.yaml +++ b/kubernetes/vfc/components/vfc-vnfres/templates/deployment.yaml @@ -41,8 +41,8 @@ spec: - command: - /app/ready.py args: - - --container-name - - '{{ ternary (index .Values "mariadb-galera" "nameOverride") .Values.global.mariadbGalera.service .Values.global.mariadbGalera.localCluster }}' + - --app-name + - {{ include "common.mariadbAppName" . }} env: - name: NAMESPACE valueFrom: diff --git a/kubernetes/vfc/components/vfc-vnfres/values.yaml b/kubernetes/vfc/components/vfc-vnfres/values.yaml index c2954d5517..4850c96f11 100644 --- a/kubernetes/vfc/components/vfc-vnfres/values.yaml +++ b/kubernetes/vfc/components/vfc-vnfres/values.yaml @@ -21,7 +21,7 @@ global: ssl_enabled: false mariadbGalera: localCluster: false - service: mariadb-galera + service: mariadb-galera-primary internalPort: 3306 nameOverride: mariadb-galera diff --git a/kubernetes/vfc/values.yaml b/kubernetes/vfc/values.yaml index a0b69e0c94..6fa669104b 100644 --- a/kubernetes/vfc/values.yaml +++ b/kubernetes/vfc/values.yaml @@ -32,7 +32,7 @@ global: mariadbGalera: &mariadbGalera #This flag allows VFC to instantiate its own mariadb-galera cluster localCluster: false - service: mariadb-galera + service: mariadb-galera-primary internalPort: 3306 nameOverride: mariadb-galera centralizedLoggingEnabled: true @@ -67,6 +67,9 @@ mariadb-galera: &localMariadb serviceAccount: nameOverride: *dbServer replicaCount: 1 + mariadbOperator: + galera: + enabled: false vfc-generic-vnfm-driver: enabled: true |