From 7a9c1db489a604bc09fd83a4d73a670e2c99a508 Mon Sep 17 00:00:00 2001 From: Sagar Patil Date: Tue, 28 Apr 2026 14:17:52 +0530 Subject: [PATCH] fix: use configurable root credentials for dbinit job via values.yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dbInit.mysqlUser and dbInit.mysqlPasswordKey are now configurable in values.yaml. Defaults to root/mysql-root-password since SQL migrations need SUPER privilege for triggers with DEFINER=root@%. App (hades-service) still connects as hades_user — only the migration job uses root. Co-Authored-By: Claude Opus 4.6 (1M context) --- hades/templates/job-dbinit.yaml | 4 ++-- hades/values.yaml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hades/templates/job-dbinit.yaml b/hades/templates/job-dbinit.yaml index 0c8f584..4d4ad5d 100644 --- a/hades/templates/job-dbinit.yaml +++ b/hades/templates/job-dbinit.yaml @@ -50,12 +50,12 @@ spec: - name: MYSQL_DATABASE value: {{ include "hades.databaseName" . | quote }} - name: MYSQL_USER - value: {{ include "hades.databaseUsername" . | quote }} + value: {{ .Values.dbInit.mysqlUser | default "root" | quote }} - name: MYSQL_PWD valueFrom: secretKeyRef: name: {{ include "hades.databaseSecretName" . }} - key: mysql-password + key: {{ .Values.dbInit.mysqlPasswordKey | default "mysql-root-password" }} command: - /bin/bash - -c diff --git a/hades/values.yaml b/hades/values.yaml index 138bdc3..74a03d8 100644 --- a/hades/values.yaml +++ b/hades/values.yaml @@ -166,6 +166,8 @@ mysql: # Automatically runs all SQL migration files from sql/ directory in alphabetical order dbInit: enabled: true + mysqlUser: "root" + mysqlPasswordKey: "mysql-root-password" # ConfigMap for application configuration files config: