diff options
author | Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> | 2024-01-22 08:38:54 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2024-01-22 08:38:54 +0000 |
commit | 742fac48950ad3e8c6fff617bd53fd688ecd3751 (patch) | |
tree | 2007b32414e9ed99a0f18988616137cedc478c5d /kubernetes | |
parent | 21d48641d6344e9f00523ca15d49d44fcdb277b3 (diff) | |
parent | 829f11c4192d6306cfaa579b7d879c0275b6d4c2 (diff) |
Merge "[MARIADB] Provide S3 Backup for MariaDB instances"
Diffstat (limited to 'kubernetes')
-rw-r--r-- | kubernetes/common/common/Chart.yaml | 2 | ||||
-rw-r--r-- | kubernetes/common/common/templates/_mariadb.tpl | 44 | ||||
-rw-r--r-- | kubernetes/common/mariadb-galera/Chart.yaml | 2 | ||||
-rw-r--r-- | kubernetes/common/mariadb-galera/values.yaml | 30 | ||||
-rw-r--r-- | kubernetes/common/mariadb-init/values.yaml | 3 |
5 files changed, 57 insertions, 24 deletions
diff --git a/kubernetes/common/common/Chart.yaml b/kubernetes/common/common/Chart.yaml index 4025924f80..129454681e 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.2 +version: 13.0.3 diff --git a/kubernetes/common/common/templates/_mariadb.tpl b/kubernetes/common/common/templates/_mariadb.tpl index a2d4117e5c..a0dd49d750 100644 --- a/kubernetes/common/common/templates/_mariadb.tpl +++ b/kubernetes/common/common/templates/_mariadb.tpl @@ -80,7 +80,7 @@ {{- 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 -}} @@ -194,26 +194,37 @@ spec: {{- 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: - name: backup-scheduled + name: {{ $name }} spec: mariaDbRef: name: {{ $dbinst }} schedule: - cron: "*/1 * * * *" + cron: {{ $dot.Values.backup.cron }} suspend: false - maxRetentionDays: 30 + maxRetention: {{ $dot.Values.backup.maxRetention }} storage: + {{- if eq $dot.Values.backup.storageType "PVC" }} 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: - - 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 @@ -308,6 +319,10 @@ spec: initialDelaySeconds: 20 periodSeconds: 10 timeoutSeconds: 5 + {{- if default false .Values.global.metrics.enabled }} + metrics: + enabled: true + {{- end }} affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: @@ -320,19 +335,6 @@ spec: 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 diff --git a/kubernetes/common/mariadb-galera/Chart.yaml b/kubernetes/common/mariadb-galera/Chart.yaml index 71ff421d7b..470e64b5f1 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.1 +version: 13.1.0 keywords: - mariadb - mysql diff --git a/kubernetes/common/mariadb-galera/values.yaml b/kubernetes/common/mariadb-galera/values.yaml index 991c635749..be7ad8ef07 100644 --- a/kubernetes/common/mariadb-galera/values.yaml +++ b/kubernetes/common/mariadb-galera/values.yaml @@ -267,8 +267,16 @@ galera: ## 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 * * *" + # used by mariadb-operator to set the max retention time + maxRetention: 720h 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 ## @@ -297,7 +305,27 @@ backup: ## 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: diff --git a/kubernetes/common/mariadb-init/values.yaml b/kubernetes/common/mariadb-init/values.yaml index 2d5de97e7c..fb2e202fd0 100644 --- a/kubernetes/common/mariadb-init/values.yaml +++ b/kubernetes/common/mariadb-init/values.yaml @@ -81,6 +81,9 @@ mariadb-galera: service: internalPort: 3306 nameOverride: mariadb-galera + mariadbOperator: + galera: + enabled: false config: userPassword: Ci@shsOd3pky1Vji |