mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-02 21:30:46 +09:00
fix(mariadb): let mariadb-operator watch the credentials Secret
A password changed in users.<name>.password is written to the
<release>-credentials Secret, but mariadb-operator reconciles a User on
a change of its passwordSecretKeyRef Secret only when that Secret
carries the k8s.mariadb.com/watch label. Without it the new password
reaches the server only on the operator's periodic SQL requeue, 10h
plus up to 1h of jitter after the last reconcile, and the previous
password stays valid until then, even across a pod restart.
Main already carries the label since the passwords became
chart-generated (9f857f64e), which is a breaking change and not a
backport candidate. Add only the label on release-1.6.
Assisted-by: LLM
Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
This commit is contained in:
2 files changed
+33
No files matched your search
@@ -25,6 +25,15 @@ apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-credentials
|
||||
labels:
|
||||
{{- /*
|
||||
mariadb-operator reconciles a User when its passwordSecretKeyRef Secret
|
||||
changes only if that Secret carries this label. Without it, a password
|
||||
changed in users.<name>.password reaches the server only on the operator's
|
||||
periodic SQL requeue (10h plus up to 1h of jitter), and the previous
|
||||
password stays valid until then.
|
||||
*/}}
|
||||
k8s.mariadb.com/watch: ""
|
||||
stringData:
|
||||
{{- range $name, $u := $usersWithRoot }}
|
||||
{{ $name }}: {{ index $passwords $name }}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
suite: MariaDB credentials Secret is watched by mariadb-operator
|
||||
|
||||
templates:
|
||||
- templates/secret.yaml
|
||||
|
||||
tests:
|
||||
- it: labels the credentials Secret so a changed user password is reconciled on change
|
||||
release:
|
||||
name: mariadb-test
|
||||
namespace: tenant-test
|
||||
set:
|
||||
users:
|
||||
alice:
|
||||
password: rotated-password
|
||||
maxUserConnections: 10
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Secret
|
||||
- equal:
|
||||
path: metadata.labels["k8s.mariadb.com/watch"]
|
||||
value: ""
|
||||
- equal:
|
||||
path: stringData.alice
|
||||
value: rotated-password
|
||||
Reference in new issue
Block a user