init job fix -5

This commit is contained in:
Vaibhav Pathak 2026-02-24 12:13:32 +05:30
parent aa079d30b3
commit 03f90680e6
3 changed files with 38 additions and 55 deletions

View File

@ -1,47 +0,0 @@
{{- if .Values.config.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "hades.fullname" . }}-hibernate
labels:
{{- include "hades.labels" . | nindent 4 }}
data:
hibernate.cfg.xml: |
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings (dynamically resolved) -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">{{ include "hades.jdbcUrl" . | replace "&" "&amp;" }}</property>
<property name="connection.username">{{ include "hades.databaseUsername" . }}</property>
<property name="connection.password">{{ .Values.database.password | default .Values.mysql.mysqlPassword | default "local-mysql-pass" }}</property>
<!-- JDBC connection pool settings -->
<property name="connection.pool_size">{{ .Values.hibernate.connectionPoolSize | default 10 }}</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="current_session_context_class">thread</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">{{ .Values.hibernate.showSql | default "true" }}</property>
<property name="connection.isolation">2</property>
<property name="connection.autocommit">true</property>
<property name="use_keying_service">false</property>
<!-- C3P0 connection pool settings -->
<property name="c3p0.acquire_increment">10</property>
<property name="c3p0.idle_test_period">60</property>
<property name="c3p0.max_size">50</property>
<property name="c3p0.max_statements">0</property>
<property name="c3p0.min_size">10</property>
<property name="c3p0.timeout">65</property>
<property name="hibernate.c3p0.maxConnectionAge">3600</property>
<property name="hibernate.c3p0.preferredTestQuery">select 1;</property>
</session-factory>
</hibernate-configuration>
{{- end }}

View File

@ -9,4 +9,42 @@ data:
{{- with .Values.config.files }}
{{- toYaml . | nindent 2 }}
{{- end }}
hibernate.cfg.xml: |
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings (dynamically resolved) -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">{{ include "hades.jdbcUrl" . | replace "&" "&amp;" }}</property>
<property name="connection.username">{{ include "hades.databaseUsername" . }}</property>
<property name="connection.password">{{ .Values.database.password | default .Values.mysql.mysqlPassword | default "local-mysql-pass" }}</property>
<!-- JDBC connection pool settings -->
<property name="connection.pool_size">{{ .Values.hibernate.connectionPoolSize | default 10 }}</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="current_session_context_class">thread</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">{{ .Values.hibernate.showSql | default "true" }}</property>
<property name="connection.isolation">2</property>
<property name="connection.autocommit">true</property>
<property name="use_keying_service">false</property>
<!-- C3P0 connection pool settings -->
<property name="c3p0.acquire_increment">10</property>
<property name="c3p0.idle_test_period">60</property>
<property name="c3p0.max_size">50</property>
<property name="c3p0.max_statements">0</property>
<property name="c3p0.min_size">10</property>
<property name="c3p0.timeout">65</property>
<property name="hibernate.c3p0.maxConnectionAge">3600</property>
<property name="hibernate.c3p0.preferredTestQuery">select 1;</property>
</session-factory>
</hibernate-configuration>
{{- end }}

View File

@ -20,7 +20,6 @@ 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 }}
@ -149,10 +148,6 @@ 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
@ -167,9 +162,6 @@ 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