mysql dependancy issue resolved

This commit is contained in:
Vaibhav Pathak 2026-01-29 12:56:32 +05:30
parent b16a920c3d
commit e9b48d31f3
8 changed files with 62 additions and 40 deletions

View File

@ -15,7 +15,7 @@ metadata:
helm.cnoe.io/chart-path: "helm/schedulerservice" helm.cnoe.io/chart-path: "helm/schedulerservice"
helm.cnoe.io/values-file: "values-local.yaml" helm.cnoe.io/values-file: "values-local.yaml"
helm.cnoe.io/available-values-files: '["values.yaml", "values-local.yaml"]' helm.cnoe.io/available-values-files: '["values.yaml", "values-local.yaml"]'
helm.cnoe.io/dependencies: '{"mysql": {"name": "MySQL Database", "required": false, "default": true, "externalParams": [{"param": "externalDatabase.host", "label": "Database Host", "placeholder": "mysql.example.com"}, {"param": "externalDatabase.port", "label": "Database Port", "placeholder": "3306"}, {"param": "externalDatabase.database", "label": "Database Name", "placeholder": "os_scheduling_db"}, {"param": "externalDatabase.username", "label": "Username", "placeholder": "scheduler_user"}, {"param": "externalDatabase.password", "label": "Password", "placeholder": "", "secret": true}]}}' helm.cnoe.io/dependencies: '{"scheduling-mysql": {"name": "Scheduling MySQL Database", "required": true, "default": false, "shared": true, "sharedKey": "os-scheduling-db", "externalParams": [{"param": "externalDatabase.host", "label": "Database Host", "placeholder": "scheduling-mysql"}, {"param": "externalDatabase.port", "label": "Database Port", "placeholder": "3306"}, {"param": "externalDatabase.database", "label": "Database Name", "placeholder": "os_scheduling_db"}, {"param": "externalDatabase.username", "label": "Username", "placeholder": "scheduler_user"}, {"param": "externalDatabase.password", "label": "Password", "placeholder": "", "secret": true}]}}'
helm.cnoe.io/dependency-urls: '{}' helm.cnoe.io/dependency-urls: '{}'
tags: tags:
- java - java

View File

@ -1,6 +0,0 @@
dependencies:
- name: mysql
repository: https://helm.wso2.com
version: 1.6.9
digest: sha256:bdbd774f845f1f0f4b7346e75b80f6c2e244cf92cf9feacf3d4807f8e50f9bce
generated: "2026-01-29T10:58:50.337803+05:30"

View File

@ -16,8 +16,5 @@ maintainers:
home: https://github.com/onlinesales-ai/schedulerService home: https://github.com/onlinesales-ai/schedulerService
sources: sources:
- https://github.com/onlinesales-ai/schedulerService - https://github.com/onlinesales-ai/schedulerService
dependencies: # MySQL is deployed as a shared dependency, not as a subchart
- name: mysql # Configure externalDatabase values to connect to the shared MySQL instance
version: 1.6.9
repository: https://helm.wso2.com
condition: mysql.enabled

View File

@ -54,21 +54,35 @@ spec:
{{- end }} {{- end }}
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.config.enabled }} {{- if or .Values.config.enabled .Values.externalDatabase.host }}
volumeMounts: volumeMounts:
{{- if .Values.config.enabled }}
- name: config - name: config
mountPath: {{ .Values.config.mountPath }} mountPath: {{ .Values.config.mountPath }}
{{- end }} {{- end }}
{{- if .Values.externalDatabase.host }}
- name: db-config
mountPath: /etc/onlinesales/db
readOnly: true
{{- end }}
{{- end }}
{{- with .Values.env }} {{- with .Values.env }}
env: env:
{{- toYaml . | nindent 12 }} {{- toYaml . | nindent 12 }}
{{- end }} {{- end }}
{{- if .Values.config.enabled }} {{- if or .Values.config.enabled .Values.externalDatabase.host }}
volumes: volumes:
{{- if .Values.config.enabled }}
- name: config - name: config
configMap: configMap:
name: {{ include "schedulerservice.fullname" . }}-config name: {{ include "schedulerservice.fullname" . }}-config
{{- end }} {{- end }}
{{- if .Values.externalDatabase.host }}
- name: db-config
secret:
secretName: {{ include "schedulerservice.fullname" . }}-db-config
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}

View File

@ -0,0 +1,31 @@
{{- if .Values.externalDatabase.host }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "schedulerservice.fullname" . }}-db-config
labels:
{{- include "schedulerservice.labels" . | nindent 4 }}
type: Opaque
stringData:
hibernate.cfg.xml: |
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.mysql.cj.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://{{ .Values.externalDatabase.host }}:{{ .Values.externalDatabase.port }}/{{ .Values.externalDatabase.database }}?useUnicode=true&amp;characterEncoding=utf8</property>
<property name="connection.username">{{ .Values.externalDatabase.username }}</property>
<property name="connection.password">{{ .Values.externalDatabase.password }}</property>
<property name="connection.pool_size">1</property>
<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>
<property name="show_sql">false</property>
<!-- Transaction isolation 2 = READ_COMMITTED -->
<property name="connection.isolation">2</property>
<property name="connection.autocommit">true</property>
</session-factory>
</hibernate-configuration>
{{- end }}

View File

@ -101,24 +101,12 @@ env:
- name: LOG_LEVEL - name: LOG_LEVEL
value: "DEBUG" value: "DEBUG"
# MySQL enabled for local development # External Database configuration for local development
mysql: # MySQL is deployed as a shared dependency (scheduling-mysql)
enabled: true # The shared MySQL service is deployed separately and shared with osSchedulesArgoSyncer
image: "mysql" externalDatabase:
imageTag: "8.0" host: "scheduling-mysql"
mysqlRootPassword: "rootpassword" port: "3306"
mysqlUser: "scheduler_user" database: "os_scheduling_db"
mysqlPassword: "localpassword" username: "scheduler_user"
mysqlDatabase: "os_scheduling_db" password: "localpassword"
fullnameOverride: "schedulerservice-mysql"
persistence:
enabled: false
resources: {}
podLabels:
backstage.io/kubernetes-id: "schedulerservice"
configurationFiles:
mysql.cnf: |-
[mysqld]
max_connections=200
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci

View File

@ -130,11 +130,9 @@ config:
env: [] env: []
# MySQL subchart disabled for production (use external DB) # External Database configuration
mysql: # MySQL is deployed as a shared dependency (not a subchart)
enabled: false # Set externalDatabase.host to connect to the shared MySQL instance
# External Database configuration (used when mysql.enabled=false)
externalDatabase: externalDatabase:
host: "" host: ""
port: "3306" port: "3306"