From cb1f6fca69700f8ef952a6e7d8fdf8c4c4937ca4 Mon Sep 17 00:00:00 2001 From: Vaibhav Pathak Date: Wed, 25 Feb 2026 10:37:50 +0530 Subject: [PATCH] init job with root user --- .../templates/_db-helpers.tpl | 18 ++++++++++++++++++ .../templates/job-dbinit.yaml | 4 ++-- .../helm/property-settings-svc-v2/values.yaml | 2 ++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/test-framework/helm/property-settings-svc-v2/templates/_db-helpers.tpl b/test-framework/helm/property-settings-svc-v2/templates/_db-helpers.tpl index 74bd25c..daa3800 100644 --- a/test-framework/helm/property-settings-svc-v2/templates/_db-helpers.tpl +++ b/test-framework/helm/property-settings-svc-v2/templates/_db-helpers.tpl @@ -59,3 +59,21 @@ Database JDBC URL {{- define "property-settings-svc-v2-chart.databaseJdbcUrl" -}} {{- printf "jdbc:mysql://%s:%s/%s?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&" (include "property-settings-svc-v2-chart.databaseHost" .) (include "property-settings-svc-v2-chart.databasePort" .) (include "property-settings-svc-v2-chart.databaseName" .) -}} {{- end -}} + +{{/* +Database root username (for init job) +*/}} +{{- define "property-settings-svc-v2-chart.databaseRootUsername" -}} +root +{{- end -}} + +{{/* +Database root password (for init job) +*/}} +{{- define "property-settings-svc-v2-chart.databaseRootPassword" -}} +{{- if .Values.mysql.enabled -}} +{{- .Values.mysql.mysqlRootPassword -}} +{{- else -}} +{{- .Values.externalDatabase.rootPassword | default .Values.externalDatabase.password -}} +{{- end -}} +{{- end -}} diff --git a/test-framework/helm/property-settings-svc-v2/templates/job-dbinit.yaml b/test-framework/helm/property-settings-svc-v2/templates/job-dbinit.yaml index 0588ffe..67e44c0 100644 --- a/test-framework/helm/property-settings-svc-v2/templates/job-dbinit.yaml +++ b/test-framework/helm/property-settings-svc-v2/templates/job-dbinit.yaml @@ -51,9 +51,9 @@ spec: - name: MYSQL_DATABASE value: {{ include "property-settings-svc-v2-chart.databaseName" . | quote }} - name: MYSQL_USER - value: {{ include "property-settings-svc-v2-chart.databaseUsername" . | quote }} + value: {{ include "property-settings-svc-v2-chart.databaseRootUsername" . | quote }} - name: MYSQL_PWD - value: {{ include "property-settings-svc-v2-chart.databasePassword" . | quote }} + value: {{ include "property-settings-svc-v2-chart.databaseRootPassword" . | quote }} command: - /bin/bash - -c diff --git a/test-framework/helm/property-settings-svc-v2/values.yaml b/test-framework/helm/property-settings-svc-v2/values.yaml index 5523b3b..d1e5424 100644 --- a/test-framework/helm/property-settings-svc-v2/values.yaml +++ b/test-framework/helm/property-settings-svc-v2/values.yaml @@ -229,6 +229,8 @@ externalDatabase: database: "property_settings_db_v2" username: "propertysettings" password: "changeme" + # Root password for database initialization (defaults to password if not set) + rootPassword: "changeme" # Application Configuration Files # These values are used to generate the ConfigMap mounted at /etc/onlinesales/config/propertySettingsSvcV2