Skip to content

Commit 6f7b87f

Browse files
committed
[mariadb][backup-v2] use granular backup/restore permissions
* remove unneeded privileges from the `backup` user * add `replace_grants` user option: when `true`, revokes all existing privileges before re-granting * add missing `serviceAccount` configuration for backup-v2 deployment * `maria-back-me-up` updated to `10.11-20260401122106`
1 parent a7ec649 commit 6f7b87f

File tree

5 files changed

+34
-3
lines changed

5 files changed

+34
-3
lines changed

common/mariadb/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## v0.34.0 - 2026/04/01
4+
* remove unneeded privileges from the `backup` user
5+
* add `replace_grants` user option: when `true`, revokes all existing privileges before re-granting
6+
* add missing `serviceAccount` configuration for backup-v2 deployment
7+
* `maria-back-me-up` updated to `10.11-20260401122106`
8+
* chart version bumped
9+
310
## v0.33.1 - 2026/03/27
411
* updated sidecar image:
512
* `mysqld-exporter` image updated to `0.19.0`

common/mariadb/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: v2
33
description: A Helm chart for Kubernetes
44
name: mariadb
5-
version: 0.33.1
5+
version: 0.34.0
66
# scripts/docker-entyrpoint.sh should be updated when appVersion is updated
77
appVersion: 10.11.16
88
dependencies:

common/mariadb/templates/backup-v2-deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ spec:
5454
{{- include "mariadb_node_reinstall_affinity" . }}
5555
{{- end }}
5656
priorityClassName: {{ .Values.priority_class | default "critical-infrastructure" | quote }}
57+
serviceAccountName: {{ .Values.name }}-db-backup-v2
5758
containers:
5859
- name: backup
5960
image: "{{ required ".Values.global.registryAlternateRegion is missing" .Values.global.registryAlternateRegion }}/{{ .Values.backup_v2.image }}:{{ .Values.backup_v2.image_version }}"

common/mariadb/templates/initdb/_init.sql.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ ALTER USER {{ include "mariadb.resolve_secret_squote" $username }} IDENTIFIED BY
3131
{{ $k | upper }} {{ $v }}
3232
{{- end }}
3333
{{- end }};
34+
{{- if $values.replace_grants }}
35+
REVOKE ALL PRIVILEGES, GRANT OPTION FROM {{ include "mariadb.resolve_secret_squote" $username }}@'%';
36+
{{- end }}
3437
{{- range $values.grants }}
3538
GRANT {{ . }} TO {{ include "mariadb.resolve_secret_squote" $username }};
3639
{{- end }}

common/mariadb/values.yaml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,36 @@ users:
4646
backup:
4747
name: backup
4848
password: null
49+
replace_grants: true
4950
limits:
5051
max_user_connections: 4
5152
grants:
52-
- ALL PRIVILEGES ON *.*
53+
- ALTER ON *.* # restore
54+
- BINLOG ADMIN ON *.* # backup; PURGE BINARY LOGS
55+
- BINLOG MONITOR ON *.* # backup; --master-data=1 (SHOW MASTER STATUS)
56+
- CREATE ON *.* # restore
57+
- CREATE VIEW ON *.* # restore
58+
- DROP ON *.* # restore
59+
- INDEX ON *.* # restore
60+
- INSERT ON *.* # restore
61+
- LOCK TABLES ON *.* # backup & restore
62+
- PROCESS ON *.* # backup
63+
- REFERENCES ON *.* # restore
64+
- RELOAD ON *.* # backup
65+
- REPLICATION SLAVE ADMIN ON *.* # restore; CHANGE MASTER TO, RESET SLAVE
66+
- REPLICATION SLAVE ON *.* # backup; BinlogSyncer streams binlogs as a replica
67+
- SELECT ON *.* # backup & restore
68+
- SET USER ON *.* # restore; DEFINER= clauses (mysql.user view)
69+
- SHOW VIEW ON *.* # backup & restore
70+
- SHUTDOWN ON *.* # restore
71+
- TRIGGER ON *.* # backup & restore
5372
# example:
5473
# name: example1 # This looks repetitive, but the point is that they key is the name
5574
# # you refer to in your charts, while the field 'name' is the actual name
5675
# # used as credentials. It should be possible to change the latter,
5776
# # without having to change the first.
5877
# password: null # Causes users not be be created, and even maybe to get locked
78+
# replace_grants: false # default; set to true to REVOKE ALL before re-granting
5979
# grants:
6080
# - ALL ON example.*
6181

@@ -202,7 +222,7 @@ backup_v2:
202222
enabled: false
203223
backup_dir: "./backup"
204224
image: maria-back-me-up
205-
image_version: "20260210150801"
225+
image_version: "10.11-20260401122106"
206226
full_backup_cron_schedule: "0 0 * * *"
207227
incremental_backup_in_minutes: 5
208228
purge_binlog_after_minutes: 60

0 commit comments

Comments
 (0)