From 3b1918978abf6800bfb1c054fe0af2c146bb0b56 Mon Sep 17 00:00:00 2001 From: Vaibhav Pathak Date: Tue, 24 Feb 2026 12:06:42 +0530 Subject: [PATCH] init job fix -4 --- hades/templates/_helpers.tpl | 2 +- hades/templates/configmap-hibernate.yaml | 47 ++++++++++++++++++++++++ hades/templates/deployment.yaml | 8 ++++ hades/values-local.yaml | 41 ++------------------- hades/values.yaml | 6 +++ 5 files changed, 66 insertions(+), 38 deletions(-) create mode 100644 hades/templates/configmap-hibernate.yaml diff --git a/hades/templates/_helpers.tpl b/hades/templates/_helpers.tpl index 2c6b8bb..b428c80 100644 --- a/hades/templates/_helpers.tpl +++ b/hades/templates/_helpers.tpl @@ -129,5 +129,5 @@ Get database secret name Create JDBC connection string */}} {{- define "hades.jdbcUrl" -}} -{{- printf "jdbc:mysql://%s:%s/%s?useSSL=false&serverTimezone=UTC&characterEncoding=utf8" (include "hades.databaseHost" .) (include "hades.databasePort" .) (include "hades.databaseName" .) }} +{{- printf "jdbc:mysql://%s:%s/%s?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true&characterEncoding=latin1" (include "hades.databaseHost" .) (include "hades.databasePort" .) (include "hades.databaseName" .) }} {{- end }} diff --git a/hades/templates/configmap-hibernate.yaml b/hades/templates/configmap-hibernate.yaml new file mode 100644 index 0000000..61541c7 --- /dev/null +++ b/hades/templates/configmap-hibernate.yaml @@ -0,0 +1,47 @@ +{{- if .Values.config.enabled }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "hades.fullname" . }}-hibernate + labels: + {{- include "hades.labels" . | nindent 4 }} +data: + hibernate.cfg.xml: | + + + + + + com.mysql.jdbc.Driver + {{ include "hades.jdbcUrl" . | replace "&" "&" }} + {{ include "hades.databaseUsername" . }} + {{ .Values.database.password | default .Values.mysql.mysqlPassword | default "local-mysql-pass" }} + + + {{ .Values.hibernate.connectionPoolSize | default 10 }} + + + org.hibernate.dialect.MySQLDialect + thread + org.hibernate.cache.NoCacheProvider + + + {{ .Values.hibernate.showSql | default "true" }} + 2 + true + false + + + 10 + 60 + 50 + 0 + 10 + 65 + 3600 + select 1; + + +{{- end }} diff --git a/hades/templates/deployment.yaml b/hades/templates/deployment.yaml index 7d24160..d454b30 100644 --- a/hades/templates/deployment.yaml +++ b/hades/templates/deployment.yaml @@ -20,6 +20,7 @@ spec: metadata: annotations: checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + checksum/hibernate: {{ include (print $.Template.BasePath "/configmap-hibernate.yaml") . | sha256sum }} {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} @@ -148,6 +149,10 @@ spec: - name: config mountPath: /etc/onlinesales/config/hades readOnly: true + - name: hibernate-config + mountPath: /etc/onlinesales/config/hades/hibernate.cfg.xml + subPath: hibernate.cfg.xml + readOnly: true {{- end }} {{- if .Values.allhosts.enabled }} - name: allhosts @@ -162,6 +167,9 @@ spec: - name: config configMap: name: {{ include "hades.fullname" . }}-config + - name: hibernate-config + configMap: + name: {{ include "hades.fullname" . }}-hibernate {{- end }} {{- if .Values.allhosts.enabled }} - name: allhosts diff --git a/hades/values-local.yaml b/hades/values-local.yaml index 79de691..f417d1b 100644 --- a/hades/values-local.yaml +++ b/hades/values-local.yaml @@ -290,40 +290,7 @@ config: } } - hibernate.cfg.xml: | - - - - - - com.mysql.jdbc.Driver - jdbc:mysql://hades-mysql-db-service:3306/hades_db?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true&characterEncoding=latin1 - hades_user - local-hades-pass - - - 10 - - - org.hibernate.dialect.MySQLDialect - thread - org.hibernate.cache.NoCacheProvider - - - true - 2 - true - false - - 10 - 60 - 50 - 0 - 10 - 65 - 3600 - select 1; - - +# Hibernate configuration options (hibernate.cfg.xml is now generated dynamically) +hibernate: + connectionPoolSize: 10 + showSql: "true" diff --git a/hades/values.yaml b/hades/values.yaml index 5f7a2bc..6773fc1 100644 --- a/hades/values.yaml +++ b/hades/values.yaml @@ -182,6 +182,12 @@ config: allhosts: enabled: true +# Hibernate configuration options +# The hibernate.cfg.xml is generated dynamically from these values +hibernate: + connectionPoolSize: 10 + showSql: "true" + nodeSelector: {} tolerations: []