Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a shared config map for all services. #514

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 0 additions & 72 deletions charts/temporal/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -69,78 +69,6 @@ Source: https://stackoverflow.com/a/52024583/3027614
{{- include $template (dict "Chart" (dict "Name" $subchart) "Values" (index $dot.Values $subchart) "Release" $dot.Release "Capabilities" $dot.Capabilities) }}
{{- end }}

{{- define "temporal.frontend.grpcPort" -}}
{{- if $.Values.server.frontend.service.port -}}
{{- $.Values.server.frontend.service.port -}}
{{- else -}}
{{- 7233 -}}
{{- end -}}
{{- end -}}

{{- define "temporal.frontend.httpPort" -}}
{{- if $.Values.server.frontend.service.httpPort -}}
{{- $.Values.server.frontend.service.httpPort -}}
{{- else -}}
{{- 7243 -}}
{{- end -}}
{{- end -}}

{{- define "temporal.frontend.membershipPort" -}}
{{- if $.Values.server.frontend.service.membershipPort -}}
{{- $.Values.server.frontend.service.membershipPort -}}
{{- else -}}
{{- 6933 -}}
{{- end -}}
{{- end -}}

{{- define "temporal.history.grpcPort" -}}
{{- if $.Values.server.history.service.port -}}
{{- $.Values.server.history.service.port -}}
{{- else -}}
{{- 7234 -}}
{{- end -}}
{{- end -}}

{{- define "temporal.history.membershipPort" -}}
{{- if $.Values.server.history.service.membershipPort -}}
{{- $.Values.server.history.service.membershipPort -}}
{{- else -}}
{{- 6934 -}}
{{- end -}}
{{- end -}}

{{- define "temporal.matching.grpcPort" -}}
{{- if $.Values.server.matching.service.port -}}
{{- $.Values.server.matching.service.port -}}
{{- else -}}
{{- 7235 -}}
{{- end -}}
{{- end -}}

{{- define "temporal.matching.membershipPort" -}}
{{- if $.Values.server.matching.service.membershipPort -}}
{{- $.Values.server.matching.service.membershipPort -}}
{{- else -}}
{{- 6935 -}}
{{- end -}}
{{- end -}}

{{- define "temporal.worker.grpcPort" -}}
{{- if $.Values.server.worker.service.port -}}
{{- $.Values.server.worker.service.port -}}
{{- else -}}
{{- 7239 -}}
{{- end -}}
{{- end -}}

{{- define "temporal.worker.membershipPort" -}}
{{- if $.Values.server.worker.service.membershipPort -}}
{{- $.Values.server.worker.service.membershipPort -}}
{{- else -}}
{{- 6939 -}}
{{- end -}}
{{- end -}}

{{- define "temporal.persistence.schema" -}}
{{- if eq . "default" -}}
{{- print "temporal" -}}
Expand Down
4 changes: 2 additions & 2 deletions charts/temporal/templates/admintools-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ spec:
env:
# TEMPORAL_CLI_ADDRESS is deprecated, use TEMPORAL_ADDRESS instead
- name: TEMPORAL_CLI_ADDRESS
value: {{ include "temporal.fullname" . }}-frontend:{{ include "temporal.frontend.grpcPort" . }}
value: {{ include "temporal.fullname" . }}-frontend:{{ .Values.server.frontend.service.port }}
- name: TEMPORAL_ADDRESS
value: {{ include "temporal.fullname" . }}-frontend:{{ include "temporal.frontend.grpcPort" . }}
value: {{ include "temporal.fullname" . }}-frontend:{{ .Values.server.frontend.service.port }}
{{- if .Values.admintools.additionalEnv }}
{{- toYaml .Values.admintools.additionalEnv | nindent 12 }}
{{- end }}
Expand Down
146 changes: 59 additions & 87 deletions charts/temporal/templates/server-configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{{- if $.Values.server.enabled }}
{{- range $service := (list "frontend" "history" "matching" "worker") }}
{{- if .Values.server.enabled -}}
{{- $server := .Values.server -}}
{{- $elasticsearch := .Values.elasticsearch -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: "{{ include "temporal.componentname" (list $ $service) }}-config"
name: "{{ include "temporal.fullname" $ }}-config"
labels:
app.kubernetes.io/name: {{ include "temporal.name" $ }}
helm.sh/chart: {{ include "temporal.chart" $ }}
Expand All @@ -15,74 +16,66 @@ data:
config_template.yaml: |-
log:
stdout: true
level: {{ $.Values.server.config.logLevel | quote }}
level: {{ $server.config.logLevel | quote }}

persistence:
defaultStore: {{ $.Values.server.config.persistence.defaultStore }}
{{- if or $.Values.elasticsearch.enabled $.Values.elasticsearch.external }}
visibilityStore: es-visibility
{{- else }}
defaultStore: {{ $server.config.persistence.defaultStore }}
visibilityStore: visibility
{{- end }}
numHistoryShards: {{ $.Values.server.config.numHistoryShards }}
numHistoryShards: {{ $server.config.numHistoryShards }}
datastores:
{{- with $.Values.server.config.persistence.additionalStores }}
{{- toYaml . | nindent 8 }}
{{- end }}
default:
{{- if eq (include "temporal.persistence.driver" (list $ "default")) "cassandra" }}
cassandra:
hosts: "{{ include "temporal.persistence.cassandra.hosts" (list $ "default") }}"
port: {{ include "temporal.persistence.cassandra.port" (list $ "default") }}
password: "{{ `{{ .Env.TEMPORAL_STORE_PASSWORD }}` }}"
{{- with (omit $.Values.server.config.persistence.default.cassandra "hosts" "port" "password" "existingSecret") }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- with $.Values.server.config.persistence.default.faultInjection}}
faultInjection:
{{- with (omit $server.config.persistence.default.cassandra "hosts" "port" "password" "existingSecret") }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if eq (include "temporal.persistence.driver" (list $ "default")) "sql" }}
{{- end }}
{{- else if eq (include "temporal.persistence.driver" (list $ "default")) "sql" }}
sql:
pluginName: "{{ include "temporal.persistence.sql.driver" (list $ "default") }}"
driverName: "{{ include "temporal.persistence.sql.driver" (list $ "default") }}"
databaseName: "{{ $.Values.server.config.persistence.default.sql.database }}"
databaseName: "{{ $server.config.persistence.default.sql.database }}"
connectAddr: "{{ include "temporal.persistence.sql.host" (list $ "default") }}:{{ include "temporal.persistence.sql.port" (list $ "default") }}"
connectProtocol: "tcp"
user: {{ include "temporal.persistence.sql.user" (list $ "default") }}
password: "{{ `{{ .Env.TEMPORAL_STORE_PASSWORD }}` }}"
{{- with (omit $.Values.server.config.persistence.default.sql "driver" "driverName" "host" "port" "connectAddr" "connectProtocol" "database" "databaseName" "user" "password" "existingSecret") }}
{{- toYaml . | nindent 12 }}
{{- with (omit $server.config.persistence.default.sql "driver" "driverName" "host" "port" "connectAddr" "connectProtocol" "database" "databaseName" "user" "password" "existingSecret") }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- with $server.config.persistence.default.faultInjection}}
faultInjection:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with $server.config.persistence.additionalStores }}
{{- toYaml . | nindent 8 }}
{{- end }}
visibility:
{{- if eq (include "temporal.persistence.driver" (list $ "visibility")) "sql" }}
{{- if or $elasticsearch.enabled $elasticsearch.external }}
elasticsearch:
version: "{{ $elasticsearch.version }}"
url:
scheme: "{{ $elasticsearch.scheme }}"
host: "{{ $elasticsearch.host }}:{{ $elasticsearch.port }}"
username: "{{ $elasticsearch.username }}"
password: "{{ $elasticsearch.password }}"
logLevel: "{{ $elasticsearch.logLevel }}"
indices:
visibility: "{{ $elasticsearch.visibilityIndex }}"
{{- else if eq (include "temporal.persistence.driver" (list $ "visibility")) "sql" }}
sql:
pluginName: "{{ include "temporal.persistence.sql.driver" (list $ "visibility") }}"
driverName: "{{ include "temporal.persistence.sql.driver" (list $ "visibility") }}"
databaseName: "{{ $.Values.server.config.persistence.visibility.sql.database }}"
databaseName: "{{ $server.config.persistence.visibility.sql.database }}"
connectAddr: "{{ include "temporal.persistence.sql.host" (list $ "visibility") }}:{{ include "temporal.persistence.sql.port" (list $ "visibility") }}"
connectProtocol: "tcp"
user: "{{ include "temporal.persistence.sql.user" (list $ "visibility") }}"
password: "{{ `{{ .Env.TEMPORAL_VISIBILITY_STORE_PASSWORD }}` }}"
{{- with (omit $.Values.server.config.persistence.visibility.sql "driver" "driverName" "host" "port" "connectAddr" "connectProtocol" "database" "databaseName" "user" "password" "existingSecret") }}
{{- toYaml . | nindent 12 }}
{{- with (omit $server.config.persistence.visibility.sql "driver" "driverName" "host" "port" "connectAddr" "connectProtocol" "database" "databaseName" "user" "password" "existingSecret") }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}

{{- if or $.Values.elasticsearch.enabled $.Values.elasticsearch.external }}
es-visibility:
elasticsearch:
version: "{{ $.Values.elasticsearch.version }}"
url:
scheme: "{{ $.Values.elasticsearch.scheme }}"
host: "{{ $.Values.elasticsearch.host }}:{{ $.Values.elasticsearch.port }}"
username: "{{ $.Values.elasticsearch.username }}"
password: "{{ $.Values.elasticsearch.password }}"
logLevel: "{{ $.Values.elasticsearch.logLevel }}"
indices:
visibility: "{{ $.Values.elasticsearch.visibilityIndex }}"
{{- end }}

global:
Expand All @@ -96,61 +89,53 @@ data:

metrics:
tags:
type: {{ $service }}
{{- with $.Values.server.metrics.tags }}
{{- toYaml . | nindent 10 }}
type: {{ `{{ .Env.SERVICES }}` }}
{{- with $server.metrics.tags }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- if $.Values.server.config.prometheus }}
{{- with $server.config.prometheus }}
prometheus:
{{- with $.Values.server.config.prometheus }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- else }}
prometheus:
timerType: histogram
listenAddress: "0.0.0.0:9090"
{{- end }}

{{- if $.Values.server.config.tls }}
{{- with $server.config.tls }}
tls:
{{- with $.Values.server.config.tls }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}

services:
frontend:
rpc:
grpcPort: {{ include "temporal.frontend.grpcPort" $ }}
httpPort: {{ include "temporal.frontend.httpPort" $ }}
membershipPort: {{ include "temporal.frontend.membershipPort" $ }}
grpcPort: {{ $server.frontend.service.port }}
httpPort: {{ $server.frontend.service.httpPort }}
membershipPort: {{ $server.frontend.service.membershipPort }}
bindOnIP: "0.0.0.0"

history:
rpc:
grpcPort: {{ include "temporal.history.grpcPort" $ }}
membershipPort: {{ include "temporal.history.membershipPort" $ }}
grpcPort: {{ $server.history.service.port }}
membershipPort: {{ $server.history.service.membershipPort }}
bindOnIP: "0.0.0.0"

matching:
rpc:
grpcPort: {{ include "temporal.matching.grpcPort" $ }}
membershipPort: {{ include "temporal.matching.membershipPort" $ }}
grpcPort: {{ $server.matching.service.port }}
membershipPort: {{ $server.matching.service.membershipPort }}
bindOnIP: "0.0.0.0"

worker:
rpc:
grpcPort: {{ include "temporal.worker.grpcPort" $ }}
membershipPort: {{ include "temporal.worker.membershipPort" $ }}
membershipPort: {{ $server.worker.service.membershipPort }}
bindOnIP: "0.0.0.0"

{{- if $.Values.server.config.clusterMetadata }}
clusterMetadata:
{{- with $.Values.server.config.clusterMetadata }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $server.config.clusterMetadata }}
{{- toYaml . | nindent 8 }}
{{- else }}
clusterMetadata:
enableGlobalDomain: false
failoverVersionIncrement: 10
masterClusterName: "active"
Expand All @@ -160,47 +145,34 @@ data:
enabled: true
initialFailoverVersion: 1
rpcName: "temporal-frontend"
rpcAddress: "127.0.0.1:7233"
httpAddress: "127.0.0.1:7243"
rpcAddress: "127.0.0.1:{{ $server.frontend.service.port }}"
httpAddress: "127.0.0.1:{{ $server.frontend.service.httpPort }}"
{{- end }}

{{- if $.Values.server.config.dcRedirectionPolicy }}
dcRedirectionPolicy:
{{- with $.Values.server.config.dcRedirectionPolicy }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $server.config.dcRedirectionPolicy }}
{{- toYaml . | nindent 8 }}
{{- else }}
dcRedirectionPolicy:
policy: "noop"
toDC: ""
{{- end }}

{{- if $.Values.server.archival }}
archival:
{{- with $.Values.server.archival }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with $server.archival }}
{{- toYaml . | nindent 6 }}
{{- else }}
archival:
status: "disabled"
{{- end }}

{{- if $.Values.server.namespaceDefaults }}
{{- with $server.namespaceDefaults }}
namespaceDefaults:
{{- with $.Values.server.namespaceDefaults }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- else }}

{{- toYaml . | nindent 6 }}
{{- end }}

publicClient:
hostPort: "{{ include "temporal.componentname" (list $ "frontend") }}:{{ $.Values.server.frontend.service.port }}"
hostPort: "{{ include "temporal.componentname" (list $ "frontend") }}:{{ $server.frontend.service.port }}"

dynamicConfigClient:
filepath: "/etc/temporal/dynamic_config/dynamic_config.yaml"
pollInterval: "10s"
---

{{- end }}
{{- end }}
Loading