[MARIADB] Provide S3 Backup for MariaDB instances 81/136981/4
authorAndreas Geissler <andreas-geissler@telekom.de>
Fri, 12 Jan 2024 11:19:03 +0000 (12:19 +0100)
committerAndreas Geissler <andreas-geissler@telekom.de>
Wed, 17 Jan 2024 13:29:00 +0000 (14:29 +0100)
Using the mariadb-operator version 0.24.0 a backup to
S3 storages is supported and implemented in the
templates and mariadb chart
Add a missing mariadbOperator config for mariadb-init

Issue-ID: OOM-3264

Change-Id: I065053832c226740b2a3b64b065cecc599f28296
Signed-off-by: Andreas Geissler <andreas-geissler@telekom.de>
docs/sections/guides/infra_guides/oom_infra_deployment_requirements.rst
kubernetes/common/common/Chart.yaml
kubernetes/common/common/templates/_mariadb.tpl
kubernetes/common/mariadb-galera/Chart.yaml
kubernetes/common/mariadb-galera/values.yaml
kubernetes/common/mariadb-init/values.yaml

index 3d824c7..4eefdaf 100644 (file)
@@ -48,9 +48,9 @@ The versions of software that are supported and tested by OOM are as follows:
   ==============     ===========  =======  ========  ========  =============  ========
   Release            Kubernetes   Helm     kubectl   Docker    Cert-Manager   Strimzi
   ==============     ===========  =======  ========  ========  =============  ========
   ==============     ===========  =======  ========  ========  =============  ========
   Release            Kubernetes   Helm     kubectl   Docker    Cert-Manager   Strimzi
   ==============     ===========  =======  ========  ========  =============  ========
-  Kohn               1.23.8       3.8.2    1.23.8    20.10.x   1.8.0          0.32.0
   London             1.23.8       3.8.2    1.23.x    20.10.x   1.12.2         0.35.0
   Montreal           1.27.5       3.12.3   1.27.x    20.10.x   1.13.2         0.36.1
   London             1.23.8       3.8.2    1.23.x    20.10.x   1.12.2         0.35.0
   Montreal           1.27.5       3.12.3   1.27.x    20.10.x   1.13.2         0.36.1
+  New Delhi          1.27.5       3.12.3   1.27.x    20.10.x   1.13.2         0.36.3
   ==============     ===========  =======  ========  ========  =============  ========
 
 .. table:: OOM Software Requirements (production)
   ==============     ===========  =======  ========  ========  =============  ========
 
 .. table:: OOM Software Requirements (production)
@@ -60,6 +60,7 @@ The versions of software that are supported and tested by OOM are as follows:
   ==============     ======  ============ ==============
   London             1.17.2  v0.6.2       19.0.3-legacy
   Montreal           1.19.3  v1.0.0       19.0.3-legacy
   ==============     ======  ============ ==============
   London             1.17.2  v0.6.2       19.0.3-legacy
   Montreal           1.19.3  v1.0.0       19.0.3-legacy
+  New Delhi          1.19.3  v1.0.0       19.0.3-legacy
   ==============     ======  ============ ==============
 
 .. table:: OOM Software Requirements (optional)
   ==============     ======  ============ ==============
 
 .. table:: OOM Software Requirements (optional)
@@ -67,7 +68,7 @@ The versions of software that are supported and tested by OOM are as follows:
   ==============     ================= ========== =================
   Release            Prometheus Stack  K8ssandra  MariaDB-Operator
   ==============     ================= ========== =================
   ==============     ================= ========== =================
   Release            Prometheus Stack  K8ssandra  MariaDB-Operator
   ==============     ================= ========== =================
-  Kohn               35.x
   London             45.x              1.6.1
   Montreal           45.x              1.10.2     0.23.1
   London             45.x              1.6.1
   Montreal           45.x              1.10.2     0.23.1
+  New Delhi          45.x              1.11.0     0.24.0
   ==============     ================= ========== =================
   ==============     ================= ========== =================
index 4025924..1294546 100644 (file)
@@ -16,4 +16,4 @@
 apiVersion: v2
 description: Common templates for inclusion in other charts
 name: common
 apiVersion: v2
 description: Common templates for inclusion in other charts
 name: common
-version: 13.0.2
+version: 13.0.3
index a2d4117..a0dd49d 100644 (file)
@@ -80,7 +80,7 @@
     {{- index .Values "mariadb-galera" "nameOverride" -}}
   {{-   end }}
   {{- else -}}
     {{- index .Values "mariadb-galera" "nameOverride" -}}
   {{-   end }}
   {{- else -}}
-  {{-   if and .Values.global.mariadbGalera.useOperator }}
+  {{-   if .Values.global.mariadbGalera.useOperator }}
     {{- printf "%s-primary" (.Values.global.mariadbGalera.service) }}
   {{-   else }}
     {{- .Values.global.mariadbGalera.service -}}
     {{- printf "%s-primary" (.Values.global.mariadbGalera.service) }}
   {{-   else }}
     {{- .Values.global.mariadbGalera.service -}}
@@ -194,26 +194,37 @@ spec:
 {{- define "common.mariadbOpBackup" -}}
 {{- $dot := default . .dot -}}
 {{- $dbinst := include "common.name" $dot -}}
 {{- define "common.mariadbOpBackup" -}}
 {{- $dot := default . .dot -}}
 {{- $dbinst := include "common.name" $dot -}}
+{{- $name := default $dbinst $dot.Values.backup.nameOverride -}}
+---
+apiVersion: mariadb.mmontes.io/v1alpha1
 kind: Backup
 metadata:
 kind: Backup
 metadata:
-  name: backup-scheduled
+  name: {{ $name }}
 spec:
   mariaDbRef:
     name: {{ $dbinst }}
   schedule:
 spec:
   mariaDbRef:
     name: {{ $dbinst }}
   schedule:
-    cron: "*/1 * * * *"
+    cron: {{ $dot.Values.backup.cron }}
     suspend: false
     suspend: false
-  maxRetentionDays: 30
+  maxRetention: {{ $dot.Values.backup.maxRetention }}
   storage:
   storage:
+    {{- if eq $dot.Values.backup.storageType "PVC" }}
     persistentVolumeClaim:
       resources:
         requests:
     persistentVolumeClaim:
       resources:
         requests:
-          storage: 100Mi
-      {{- if .Values.mariadbOperator.storageClassName }}
-      storageClassName: {{ .Values.mariadbOperator.storageClassName }}
+          storage: {{ $dot.Values.backup.persistence.size }}
+      {{- if $dot.Values.mariadbOperator.storageClassName }}
+      storageClassName: {{ $dot.Values.mariadbOperator.storageClassName }}
       {{- end }}
       accessModes:
       {{- end }}
       accessModes:
-        - ReadWriteOnce
+        - {{ $dot.Values.backup.persistence.accessMode }}
+    {{- end }}
+    {{- if eq $dot.Values.backup.storageType "S3" }}
+    s3: {{- include "common.tplValue" ( dict "value" .Values.backup.s3 "context" $) | nindent 6 }}
+    {{- end }}
+    {{- if eq $dot.Values.backup.storageType "volume" }}
+    volume: {{- include "common.tplValue" ( dict "value" .Values.backup.volume "context" $) | nindent 6 }}
+    {{- end }}
   resources:
     requests:
       cpu: 100m
   resources:
     requests:
       cpu: 100m
@@ -308,6 +319,10 @@ spec:
     initialDelaySeconds: 20
     periodSeconds: 10
     timeoutSeconds: 5
     initialDelaySeconds: 20
     periodSeconds: 10
     timeoutSeconds: 5
+  {{- if default false .Values.global.metrics.enabled }}
+  metrics:
+    enabled: true
+  {{- end }}
   affinity:
     podAntiAffinity:
       requiredDuringSchedulingIgnoredDuringExecution:
   affinity:
     podAntiAffinity:
       requiredDuringSchedulingIgnoredDuringExecution:
@@ -320,19 +335,6 @@ spec:
     maxUnavailable: 50%
   updateStrategy:
     type: RollingUpdate
     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
 
   myCnfConfigMapKeyRef:
     key: my.cnf
index 71ff421..470e64b 100644 (file)
@@ -18,7 +18,7 @@
 apiVersion: v2
 description: Chart for MariaDB Galera cluster
 name: mariadb-galera
 apiVersion: v2
 description: Chart for MariaDB Galera cluster
 name: mariadb-galera
-version: 13.0.1
+version: 13.1.0
 keywords:
   - mariadb
   - mysql
 keywords:
   - mariadb
   - mysql
index 991c635..be7ad8e 100644 (file)
@@ -267,8 +267,16 @@ galera:
 ## For this reason the db data pvc needs to have accessMode: ReadWriteMany.
 backup:
   enabled: false
 ## For this reason the db data pvc needs to have accessMode: ReadWriteMany.
 backup:
   enabled: false
+  # used in the mariadb-operator to override the backup name (default is DBName)
+  # nameOverride:
+  # defines the backup job execution period
   cron: "00 00 * * *"
   cron: "00 00 * * *"
+  # used by mariadb-operator to set the max retention time
+  maxRetention: 720h
   retentionPeriod: 3
   retentionPeriod: 3
+  # used by mariadb-operator to set the backup storage type (PVC, S3, volume)
+  storageType: PVC
+  # configuration used for PVC backup storage
   persistence:
     ## If true, use a Persistent Volume Claim, If false, use emptyDir
     ##
   persistence:
     ## If true, use a Persistent Volume Claim, If false, use emptyDir
     ##
@@ -297,7 +305,27 @@ backup:
     ## Persistent Volume size
     ##
     size: 2Gi
     ## Persistent Volume size
     ##
     size: 2Gi
-
+  # requires mariadb-operator v0.24.0
+  # configuration used for S3 backup storage
+  # see: https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/BACKUP.md
+  s3:
+    bucket: backups
+    endpoint: minio.minio.svc.cluster.local:9000
+    #region:  us-east-1
+    accessKeyIdSecretKeyRef:
+      name: minio
+      key: access-key-id
+    secretAccessKeySecretKeyRef:
+      name: minio
+      key: secret-access-key
+    tls:
+      enabled: false
+      caSecretKeyRef:
+        name: minio-ca
+        key: ca.crt
+  # configuration used for kubernetes volumes as backup storage
+  # see: https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/BACKUP.md
+  volume: {}
 
 readinessCheck:
   wait_for:
 
 readinessCheck:
   wait_for:
index 2d5de97..fb2e202 100644 (file)
@@ -81,6 +81,9 @@ mariadb-galera:
   service:
     internalPort: 3306
   nameOverride: mariadb-galera
   service:
     internalPort: 3306
   nameOverride: mariadb-galera
+  mariadbOperator:
+    galera:
+      enabled: false
 
 config:
   userPassword: Ci@shsOd3pky1Vji
 
 config:
   userPassword: Ci@shsOd3pky1Vji