Skip to content

Commit

Permalink
Adjust Helm Chart templates in dev branch
Browse files Browse the repository at this point in the history
  • Loading branch information
kezhenxu94 committed Dec 12, 2021
1 parent bacb7c1 commit 06998a1
Show file tree
Hide file tree
Showing 13 changed files with 165 additions and 217 deletions.
72 changes: 37 additions & 35 deletions deploy/kubernetes/dolphinscheduler/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,22 @@ If release name contains chart name it will be used as a full name.
{{- end -}}

{{/*
Create a default docker image fullname.
Create default docker images' fullname.
*/}}
{{- define "dolphinscheduler.image.fullname" -}}
{{- .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion -}}
{{- define "dolphinscheduler.image.fullname.master" -}}
{{- .Values.image.registry }}/dolphinscheduler-master:{{ .Values.image.tag | default .Chart.AppVersion -}}
{{- end -}}
{{- define "dolphinscheduler.image.fullname.worker" -}}
{{- .Values.image.registry }}/dolphinscheduler-worker:{{ .Values.image.tag | default .Chart.AppVersion -}}
{{- end -}}
{{- define "dolphinscheduler.image.fullname.api" -}}
{{- .Values.image.registry }}/dolphinscheduler-api:{{ .Values.image.tag | default .Chart.AppVersion -}}
{{- end -}}
{{- define "dolphinscheduler.image.fullname.alert" -}}
{{- .Values.image.registry }}/dolphinscheduler-alert-server:{{ .Values.image.tag | default .Chart.AppVersion -}}
{{- end -}}
{{- define "dolphinscheduler.image.fullname.tools" -}}
{{- .Values.image.registry }}/dolphinscheduler-tools:{{ .Values.image.tag | default .Chart.AppVersion -}}
{{- end -}}
{{/*
Expand Down Expand Up @@ -108,37 +120,25 @@ Create a default fully qualified zookkeeper quorum.
Create a database environment variables.
*/}}
{{- define "dolphinscheduler.database.env_vars" -}}
- name: DATABASE_TYPE
- name: DATABASE
{{- if .Values.postgresql.enabled }}
value: "postgresql"
{{- else }}
value: {{ .Values.externalDatabase.type | quote }}
{{- end }}
- name: DATABASE_DRIVER
{{- if .Values.postgresql.enabled }}
value: "org.postgresql.Driver"
{{- else }}
value: {{ .Values.externalDatabase.driver | quote }}
{{- end }}
- name: DATABASE_HOST
{{- if .Values.postgresql.enabled }}
value: {{ template "dolphinscheduler.postgresql.fullname" . }}
{{- else }}
value: {{ .Values.externalDatabase.host | quote }}
{{- end }}
- name: DATABASE_PORT
- name: SPRING_DATASOURCE_URL
{{- if .Values.postgresql.enabled }}
value: "5432"
value: jdbc:postgresql://{{ template "dolphinscheduler.postgresql.fullname" . }}:5432/{{ .Values.postgresql.postgresqlDatabase }}?characterEncoding=utf8
{{- else }}
value: {{ .Values.externalDatabase.port | quote }}
value: jdbc:{{ .Values.externalDatabase.type }}://{{ .Values.externalDatabase.host }}:{{ .Values.externalDatabase.port }}/{{ .Values.externalDatabase.database }}?{{ .Values.externalDatabase.params }}
{{- end }}
- name: DATABASE_USERNAME
- name: SPRING_DATASOURCE_USERNAME
{{- if .Values.postgresql.enabled }}
value: {{ .Values.postgresql.postgresqlUsername }}
{{- else }}
value: {{ .Values.externalDatabase.username | quote }}
{{- end }}
- name: DATABASE_PASSWORD
- name: SPRING_DATASOURCE_PASSWORD
valueFrom:
secretKeyRef:
{{- if .Values.postgresql.enabled }}
Expand All @@ -148,31 +148,33 @@ Create a database environment variables.
name: {{ include "dolphinscheduler.fullname" . }}-externaldb
key: database-password
{{- end }}
- name: DATABASE_DATABASE
{{- if .Values.postgresql.enabled }}
value: {{ .Values.postgresql.postgresqlDatabase }}
{{- else }}
value: {{ .Values.externalDatabase.database | quote }}
{{- end }}
- name: DATABASE_PARAMS
{{- if .Values.postgresql.enabled }}
value: "characterEncoding=utf8"
{{- else }}
value: {{ .Values.externalDatabase.params | quote }}
{{- end }}
{{- end -}}
{{/*
Wait for database to be ready.
*/}}
{{- define "dolphinscheduler.database.wait-for-ready" -}}
- name: wait-for-database
image: busybox:1.30
imagePullPolicy: IfNotPresent
{{- if .Values.postgresql.enabled }}
command: ['sh', '-xc', 'for i in $(seq 1 180); do nc -z -w3 {{ template "dolphinscheduler.postgresql.fullname" . }} 5432 && exit 0 || sleep 5; done; exit 1']
{{- else }}
command: ['sh', '-xc', 'for i in $(seq 1 180); do nc -z -w3 {{ .Values.externalDatabase.host }} {{ .Values.externalDatabase.port }} && exit 0 || sleep 5; done; exit 1']
{{- end }}
{{- end -}}

{{/*
Create a registry environment variables.
*/}}
{{- define "dolphinscheduler.registry.env_vars" -}}
- name: REGISTRY_PLUGIN_NAME
- name: REGISTRY_TYPE
{{- if .Values.zookeeper.enabled }}
value: "zookeeper"
{{- else }}
value: {{ .Values.externalRegistry.registryPluginName }}
{{- end }}
- name: REGISTRY_SERVERS
- name: REGISTRY_ZOOKEEPER_CONNECT_STRING
{{- if .Values.zookeeper.enabled }}
value: {{ template "dolphinscheduler.zookeeper.quorum" . }}
{{- else }}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,32 @@ spec:
{{- end }}
containers:
- name: {{ include "dolphinscheduler.fullname" . }}-alert
image: {{ include "dolphinscheduler.image.fullname" . }}
image: {{ include "dolphinscheduler.image.fullname.alert" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "alert-server"
ports:
- containerPort: 50052
name: "alert-port"
- containerPort: 50053
name: "actuator-port"
env:
- name: TZ
value: {{ .Values.timezone }}
{{- include "dolphinscheduler.database.env_vars" . | nindent 12 }}
{{ range $key, $value := .Values.alert.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{ end }}
envFrom:
- configMapRef:
name: {{ include "dolphinscheduler.fullname" . }}-common
- configMapRef:
name: {{ include "dolphinscheduler.fullname" . }}-alert
{{- if .Values.alert.resources }}
resources:
{{- toYaml .Values.alert.resources | nindent 12 }}
{{- end }}
{{- if .Values.alert.livenessProbe.enabled }}
livenessProbe:
exec:
command: ["bash", "/root/checkpoint.sh", "AlertServer"]
command: ["curl", "-s", "http://localhost:50053/actuator/health/liveness"]
initialDelaySeconds: {{ .Values.alert.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.alert.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.alert.livenessProbe.timeoutSeconds }}
Expand All @@ -90,7 +92,7 @@ spec:
{{- if .Values.alert.readinessProbe.enabled }}
readinessProbe:
exec:
command: ["bash", "/root/checkpoint.sh", "AlertServer"]
command: ["curl", "-s", "http://localhost:50053/actuator/health/readiness"]
initialDelaySeconds: {{ .Values.alert.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.alert.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.alert.readinessProbe.timeoutSeconds }}
Expand All @@ -107,4 +109,4 @@ spec:
claimName: {{ include "dolphinscheduler.fullname" . }}-alert
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ spec:
{{- end }}
containers:
- name: {{ include "dolphinscheduler.fullname" . }}-api
image: {{ include "dolphinscheduler.image.fullname" . }}
image: {{ include "dolphinscheduler.image.fullname.api" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "api-server"
ports:
- containerPort: 12345
name: "api-port"
Expand All @@ -70,19 +68,21 @@ spec:
{{- include "dolphinscheduler.database.env_vars" . | nindent 12 }}
{{- include "dolphinscheduler.registry.env_vars" . | nindent 12 }}
{{- include "dolphinscheduler.fs_s3a.env_vars" . | nindent 12 }}
{{ range $key, $value := .Values.api.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{ end }}
envFrom:
- configMapRef:
name: {{ include "dolphinscheduler.fullname" . }}-common
- configMapRef:
name: {{ include "dolphinscheduler.fullname" . }}-api
{{- if .Values.api.resources }}
resources:
{{- toYaml .Values.api.resources | nindent 12 }}
{{- end }}
{{- if .Values.api.livenessProbe.enabled }}
livenessProbe:
exec:
command: ["bash", "/root/checkpoint.sh", "ApiApplicationServer"]
command: ["curl", "-s", "http://localhost:12345/actuator/health/liveness"]
initialDelaySeconds: {{ .Values.api.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.api.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.api.livenessProbe.timeoutSeconds }}
Expand All @@ -92,7 +92,7 @@ spec:
{{- if .Values.api.readinessProbe.enabled }}
readinessProbe:
exec:
command: ["bash", "/root/checkpoint.sh", "ApiApplicationServer"]
command: ["curl", "-s", "http://localhost:12345/actuator/health/readiness"]
initialDelaySeconds: {{ .Values.api.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.api.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.api.readinessProbe.timeoutSeconds }}
Expand All @@ -113,4 +113,4 @@ spec:
emptyDir: {}
{{- end }}
{{- include "dolphinscheduler.sharedStorage.volume" . | nindent 8 }}
{{- include "dolphinscheduler.fsFileResource.volume" . | nindent 8 }}
{{- include "dolphinscheduler.fsFileResource.volume" . | nindent 8 }}
Loading

0 comments on commit 06998a1

Please sign in to comment.