diff --git a/support-files/kubernetes/charts/bk-job/Chart.yaml b/support-files/kubernetes/charts/bk-job/Chart.yaml index 82ec0a3e57..41c0ae7051 100644 --- a/support-files/kubernetes/charts/bk-job/Chart.yaml +++ b/support-files/kubernetes/charts/bk-job/Chart.yaml @@ -2,7 +2,9 @@ apiVersion: v2 name: "bk-job" description: The BK-JOB is a ops script management and execution system with the capability of dealing with multiple tasks simultaneously. type: application +# release 的时候需要改为实际的版本号 version: {{CHART_VERSION}} +# release 的时候需要改为实际的版本号 appVersion: "{{APP_VERSION}}" dependencies: diff --git a/support-files/kubernetes/charts/bk-job/templates/_helpers.tpl b/support-files/kubernetes/charts/bk-job/templates/_helpers.tpl index 00e0ee5061..f3f992aac3 100644 --- a/support-files/kubernetes/charts/bk-job/templates/_helpers.tpl +++ b/support-files/kubernetes/charts/bk-job/templates/_helpers.tpl @@ -220,6 +220,17 @@ Return the JDBC MySQL Driver Class {{- printf "io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver" -}} {{- end -}} +{{/* +Return the MariaDB jdbc connection url properties +*/}} +{{- define "job.mariadb.connection.properties" -}} +{{- if .Values.mariadb.enabled }} + {{- printf "%s" .Values.mariadb.connection.properties -}} +{{- else -}} + {{- printf "%s" .Values.externalMariaDB.connection.properties -}} +{{- end -}} +{{- end -}} + {{/* Return the JDBC MySQL scheme */}} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-analysis/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-analysis/configmap.yaml index 64002f5535..800f8730ab 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-analysis/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-analysis/configmap.yaml @@ -35,7 +35,7 @@ data: job-analysis: driver-class-name: {{ include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_analysis{{ include "job.mariadb.connection.properties" . }} username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-backup/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-backup/configmap.yaml index 7ae6f221aa..de4d84c337 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-backup/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-backup/configmap.yaml @@ -35,7 +35,7 @@ data: job-backup: driver-class-name: {{ include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_backup?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_backup{{ include "job.mariadb.connection.properties" . }} username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} @@ -50,7 +50,7 @@ data: job-execute-db: driver-class-name: {{ include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&sessionVariables=binlog_format=statement + jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute{{ include "job.mariadb.connection.properties" . }} username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} @@ -65,7 +65,7 @@ data: job-execute-archive: driver-class-name: {{ include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute{{ include "job.mariadb.connection.properties" . }} username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-crontab/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-crontab/configmap.yaml index 1d214f2ef8..d18866c318 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-crontab/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-crontab/configmap.yaml @@ -35,7 +35,7 @@ data: job-crontab: driver-class-name: {{ include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_crontab?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_crontab{{ include "job.mariadb.connection.properties" . }} username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} @@ -116,7 +116,7 @@ data: job: crontab: db: - url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_crontab?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_crontab{{ include "job.mariadb.connection.properties" . }} username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-execute/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-execute/configmap.yaml index 4a83e6fa39..1fe2c90773 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-execute/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-execute/configmap.yaml @@ -163,7 +163,7 @@ data: job-execute: driver-class-name: {{ include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true + jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute{{ include "job.mariadb.connection.properties" . }} username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-file-gateway/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-file-gateway/configmap.yaml index a5f4c24bdf..4fccf0c10f 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-file-gateway/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-file-gateway/configmap.yaml @@ -35,7 +35,7 @@ data: job-file-gateway: driver-class-name: {{ include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_file_gateway?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_file_gateway{{ include "job.mariadb.connection.properties" . }} username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml index 82961c8699..7e9dd457a2 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml @@ -35,7 +35,7 @@ data: job-manage: driver-class-name: {{ include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_manage?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_manage{{ include "job.mariadb.connection.properties" . }} username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/kubernetes/charts/bk-job/values.yaml b/support-files/kubernetes/charts/bk-job/values.yaml index 94a181f6f1..9e47a9c565 100644 --- a/support-files/kubernetes/charts/bk-job/values.yaml +++ b/support-files/kubernetes/charts/bk-job/values.yaml @@ -117,6 +117,9 @@ mariadb: grant all privileges on *.* to 'root'@'%' identified by 'job'; grant all privileges on *.* to 'job'@'%' identified by 'job'; flush privileges; + ## JDBC Connection properties + connection: + properties: ?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull ## External MariaDB configuration ## @@ -142,6 +145,9 @@ externalMariaDB: ## @param externalMariaDB.rootPassword Password for the MariaDB `root` user ## rootPassword: "" + ## JDBC Connection properties + connection: + properties: ?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull ## Redis chart configuration diff --git a/support-files/templates/#etc#job#job-backup#job-backup.yml b/support-files/templates/#etc#job#job-backup#job-backup.yml index 23726047ae..d334ed340d 100644 --- a/support-files/templates/#etc#job#job-backup#job-backup.yml +++ b/support-files/templates/#etc#job#job-backup#job-backup.yml @@ -30,7 +30,7 @@ spring: job-execute-db: driver-class-name: io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:otel:mysql://__BK_JOB_EXECUTE_MYSQL_HOST__:__BK_JOB_EXECUTE_MYSQL_PORT__/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai&sessionVariables=binlog_format=statement + jdbc-url: jdbc:otel:mysql://__BK_JOB_EXECUTE_MYSQL_HOST__:__BK_JOB_EXECUTE_MYSQL_PORT__/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: __BK_JOB_EXECUTE_MYSQL_USERNAME__ password: __BK_JOB_EXECUTE_MYSQL_PASSWORD__ maximum-pool-size: 10 @@ -42,7 +42,7 @@ spring: #job-execute-archive: #driver-class-name: io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver #type: com.zaxxer.hikari.HikariDataSource - #jdbc-url: jdbc:otel:mysql://__BK_JOB_EXECUTE_ARCHIVE_MYSQL_HOST__:__BK_JOB_EXECUTE_ARCHIVE_MYSQL_PORT__/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai + #jdbc-url: jdbc:otel:mysql://__BK_JOB_EXECUTE_ARCHIVE_MYSQL_HOST__:__BK_JOB_EXECUTE_ARCHIVE_MYSQL_PORT__/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull #username: __BK_JOB_EXECUTE_ARCHIVE_MYSQL_USERNAME__ #password: __BK_JOB_EXECUTE_ARCHIVE_MYSQL_PASSWORD__ #maximum-pool-size: 10