Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
8 changes: 5 additions & 3 deletions charts/temporal/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,12 @@ Source: https://stackoverflow.com/a/52024583/3027614
All Cassandra hosts.
*/}}
{{- define "cassandra.hosts" -}}
{{- range $i := (until (int .Values.cassandra.config.cluster_size)) }}
{{- $hosts := list -}}
{{- range $i := (until (int .Values.cassandra.config.cluster_size)) -}}
{{- $cassandraName := include "call-nested" (list $ "cassandra" "cassandra.fullname") -}}
{{- printf "%s.%s," $cassandraName $.Release.Namespace -}}
{{- end }}
{{- $hosts = append $hosts (printf "%s.%s" $cassandraName $.Release.Namespace) -}}
Comment thread
chaptersix marked this conversation as resolved.
{{- end -}}
{{- join "," $hosts -}}
{{- end -}}

{{/*
Expand Down
34 changes: 9 additions & 25 deletions charts/temporal/templates/server-configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{{- if .Values.server.enabled -}}
{{- if and .Values.server.enabled (or (eq .Values.server.configMapsToMount "both") (eq .Values.server.configMapsToMount "modern")) -}}
{{- $server := .Values.server -}}
{{- $elasticsearch := .Values.elasticsearch -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: "{{ include "temporal.fullname" $ }}-config"
name: "{{ include "temporal.fullname" $ }}-modern-config"
Comment thread
chaptersix marked this conversation as resolved.
Outdated
labels:
{{- include "temporal.resourceLabels" (list $ "" "") | nindent 4 }}
data:
config_template.yaml: |-
# enable-template
log:
stdout: true
level: {{ $server.config.logLevel | quote }}

persistence:
defaultStore: {{ $server.config.persistence.defaultStore }}
Comment thread
chaptersix marked this conversation as resolved.
visibilityStore: visibility
Expand All @@ -24,7 +24,7 @@ data:
cassandra:
hosts: "{{ include "temporal.persistence.cassandra.hosts" (list $ "default") }}"
port: {{ include "temporal.persistence.cassandra.port" (list $ "default") }}
password: {{ `{{ .Env.TEMPORAL_STORE_PASSWORD | quote }}` }}
password: {{ `{{ env "TEMPORAL_STORE_PASSWORD" | quote }}` }}
{{- with (omit $server.config.persistence.default.cassandra "hosts" "port" "password" "existingSecret") }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand All @@ -36,7 +36,7 @@ data:
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 | quote }}` }}
password: {{ `{{ env "TEMPORAL_STORE_PASSWORD" | quote }}` }}
{{- with (omit $server.config.persistence.default.sql "driver" "driverName" "host" "port" "connectAddr" "connectProtocol" "database" "databaseName" "user" "password" "existingSecret") }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand All @@ -57,7 +57,7 @@ data:
scheme: "{{ $elasticsearch.scheme }}"
host: "{{ $elasticsearch.host }}:{{ $elasticsearch.port }}"
username: "{{ $elasticsearch.username }}"
password: {{ `{{ .Env.TEMPORAL_VISIBILITY_STORE_PASSWORD | quote }}` }}
password: {{ `{{ env "TEMPORAL_VISIBILITY_STORE_PASSWORD" | quote }}` }}
logLevel: "{{ $elasticsearch.logLevel }}"
indices:
visibility: "{{ $elasticsearch.visibilityIndex }}"
Expand All @@ -73,24 +73,21 @@ data:
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 | quote }}` }}
password: {{ `{{ env "TEMPORAL_VISIBILITY_STORE_PASSWORD" | quote }}` }}
{{- with (omit $server.config.persistence.visibility.sql "driver" "driverName" "host" "port" "connectAddr" "connectProtocol" "database" "databaseName" "user" "password" "existingSecret") }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}

global:
membership:
name: temporal
maxJoinDuration: 30s
broadcastAddress: {{ `{{ default .Env.POD_IP "0.0.0.0" }}` }}

broadcastAddress: {{ `{{ env "POD_IP" }}` }}
pprof:
port: 7936

metrics:
tags:
type: {{ `{{ .Env.SERVICES }}` }}
type: {{ `{{ env "TEMPORAL_SERVICES" }}` }}
{{- with $server.metrics.tags }}
{{- toYaml . | nindent 10 }}
{{- end }}
Expand All @@ -109,25 +106,21 @@ data:
timerType: histogram
listenAddress: "0.0.0.0:9090"
{{- end }}

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

{{- with $server.config.authorization }}
authorization:
{{- toYaml . | nindent 10 }}
{{- end }}

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

{{- if and (hasKey .Values.server "internalFrontend") .Values.server.internalFrontend.enabled }}
internal-frontend:
rpc:
Expand All @@ -136,24 +129,20 @@ data:
membershipPort: {{ $server.internalFrontend.service.membershipPort }}
bindOnIP: "0.0.0.0"
{{- end }}

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

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

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

clusterMetadata:
{{- with $server.config.clusterMetadata }}
{{- toYaml . | nindent 8 }}
Expand All @@ -170,32 +159,27 @@ data:
rpcAddress: "127.0.0.1:{{ $server.frontend.service.port }}"
httpAddress: "127.0.0.1:{{ $server.frontend.service.httpPort }}"
{{- end }}

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

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

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

{{- if not (and (hasKey .Values.server "internalFrontend") .Values.server.internalFrontend.enabled) }}
publicClient:
hostPort: "{{ include "temporal.componentname" (list $ "frontend") }}:{{ $server.frontend.service.port }}"
{{- end }}

dynamicConfigClient:
filepath: "/etc/temporal/dynamic_config/dynamic_config.yaml"
pollInterval: "10s"
Expand Down
134 changes: 123 additions & 11 deletions charts/temporal/templates/server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,69 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- if or (or $.Values.server.additionalInitContainers $.Values.cassandra.enabled) (or $.Values.elasticsearch.enabled $.Values.elasticsearch.external)}}
{{- if or $.Values.server.additionalInitContainers $.Values.cassandra.enabled (or $.Values.elasticsearch.enabled $.Values.elasticsearch.external) }}
initContainers:
{{- with $.Values.server.additionalInitContainers }}
{{- toYaml . | nindent 8}}
{{- end }}
{{- if $.Values.cassandra.enabled }}
- name: check-cassandra
image: "{{ $.Values.cassandra.image.repo }}:{{ $.Values.cassandra.image.tag }}"
imagePullPolicy: {{ $.Values.cassandra.image.pullPolicy }}
command: ['sh', '-c', 'until cqlsh {{ include "cassandra.host" $ }} {{ $.Values.cassandra.config.ports.cql }} -e "SHOW VERSION"; do echo waiting for cassandra to start; sleep 1; done;']
image: "{{ $.Values.admintools.image.repository }}:{{ $.Values.admintools.image.tag }}"
imagePullPolicy: {{ $.Values.admintools.image.pullPolicy }}
command: ['/bin/sh', '-c']
args:
- |
set -e
echo "Waiting for Cassandra to become available..."

if command -v temporal-cassandra-tool >/dev/null 2>&1; then
echo "Using temporal-cassandra-tool to check Cassandra availability"
until temporal-cassandra-tool --ep {{ include "cassandra.host" $ }} --port {{ $.Values.cassandra.config.ports.cql }} validate-health 2>&1 > /dev/null; do
echo "waiting for cassandra to start"
sleep 1
done
elif command -v cqlsh >/dev/null 2>&1; then
echo "Using cqlsh to check Cassandra availability"
until cqlsh {{ include "cassandra.host" $ }} {{ $.Values.cassandra.config.ports.cql }} -e "SHOW VERSION" 2>&1 > /dev/null; do
echo "waiting for cassandra to start"
sleep 1
done
else
echo "ERROR: Neither temporal-cassandra-tool nor cqlsh found"
Comment thread
chaptersix marked this conversation as resolved.
Outdated
exit 1
fi
echo "Cassandra is ready"
{{- with $serviceValues.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
- name: check-cassandra-temporal-schema
image: "{{ $.Values.cassandra.image.repo }}:{{ $.Values.cassandra.image.tag }}"
imagePullPolicy: {{ $.Values.cassandra.image.pullPolicy }}
command: ['sh', '-c', 'until cqlsh {{ include "cassandra.host" $ }} {{ $.Values.cassandra.config.ports.cql }} -e "SELECT keyspace_name FROM system_schema.keyspaces" | grep {{ $.Values.server.config.persistence.default.cassandra.keyspace }}$; do echo waiting for default keyspace to become ready; sleep 1; done;']
image: "{{ $.Values.admintools.image.repository }}:{{ $.Values.admintools.image.tag }}"
imagePullPolicy: {{ $.Values.admintools.image.pullPolicy }}
command: ['/bin/sh', '-c']
args:
- |
set -e
echo "Waiting for Cassandra keyspace to become ready..."

if command -v temporal-cassandra-tool >/dev/null 2>&1; then
Comment thread
chaptersix marked this conversation as resolved.
Outdated
echo "Using temporal-cassandra-tool to check keyspace: {{ $.Values.server.config.persistence.default.cassandra.keyspace }}"
# temporal-cassandra-tool doesn't have a direct keyspace check, so we validate health and assume schema job created it
until temporal-cassandra-tool --ep {{ include "cassandra.host" $ }} --port {{ $.Values.cassandra.config.ports.cql }} --keyspace {{ $.Values.server.config.persistence.default.cassandra.keyspace }} validate-health 2>&1 > /dev/null; do
echo "waiting for default keyspace to become ready"
sleep 1
done
elif command -v cqlsh >/dev/null 2>&1; then
echo "Using cqlsh to check keyspace: {{ $.Values.server.config.persistence.default.cassandra.keyspace }}"
until cqlsh {{ include "cassandra.host" $ }} {{ $.Values.cassandra.config.ports.cql }} -e "SELECT keyspace_name FROM system_schema.keyspaces" | grep {{ $.Values.server.config.persistence.default.cassandra.keyspace }}$ 2>&1 > /dev/null; do
echo "waiting for default keyspace to become ready"
sleep 1
done
else
echo "ERROR: Neither temporal-cassandra-tool nor cqlsh found"
exit 1
fi
echo "Cassandra keyspace is ready"
{{- with $serviceValues.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
Expand All @@ -65,7 +110,28 @@ spec:
- name: check-elasticsearch-index
image: "{{ $.Values.admintools.image.repository }}:{{ $.Values.admintools.image.tag }}"
imagePullPolicy: {{ $.Values.admintools.image.pullPolicy }}
command: ['sh', '-c', 'until curl --silent --fail --user "$ES_USER:$ES_PWD" $ES_SCHEME://$ES_HOST:$ES_PORT/$ES_VISIBILITY_INDEX 2>&1 > /dev/null; do echo waiting for elasticsearch index to become ready; sleep 1; done;']
command: ['/bin/sh', '-c']
args:
- |
set -e
echo "Waiting for Elasticsearch index to become ready..."

if [ -x /usr/local/bin/temporal-elasticsearch-tool ]; then
echo "Using temporal-elasticsearch-tool to check index: $ES_VISIBILITY_INDEX"
# Use ping to verify ES is accessible, assuming index was created by setup job
until temporal-elasticsearch-tool --endpoint "$ES_SCHEME://$ES_HOST:$ES_PORT" --user "$ES_USER" --password "$ES_PWD" ping 2>&1 > /dev/null; do
sleep 1
done
elif command -v curl >/dev/null 2>&1; then
echo "Using curl to check index: $ES_VISIBILITY_INDEX"
until curl --silent --fail --user "$ES_USER:$ES_PWD" "$ES_SCHEME://$ES_HOST:$ES_PORT/$ES_VISIBILITY_INDEX" 2>&1 > /dev/null; do
sleep 1
done
else
echo "ERROR: Neither temporal-elasticsearch-tool nor curl found"
exit 1
fi
echo "Elasticsearch index is ready"
env:
{{- include "temporal.admintools-env" (list $ "visibility") | nindent 12 }}
{{- with $serviceValues.containerSecurityContext }}
Expand All @@ -78,15 +144,22 @@ spec:
- name: {{ $.Chart.Name }}-{{ $service }}
image: "{{ $.Values.server.image.repository }}:{{ $.Values.server.image.tag }}"
imagePullPolicy: {{ $.Values.server.image.pullPolicy }}
{{- if $.Values.server.useEntrypointScript }}
command: ['/entrypoint/entrypoint.sh']
{{- end }}
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: SERVICES
value: {{ $service }}
- name: TEMPORAL_SERVICES
value: {{ $service }}
{{- if not $.Values.server.useEntrypointScript }}
Comment thread
chaptersix marked this conversation as resolved.
Outdated
- name: TEMPORAL_SERVER_CONFIG_FILE_PATH
value: /etc/temporal/config/config_template.yaml
{{- end }}
Comment thread
chaptersix marked this conversation as resolved.
Outdated
{{- if ne (include "temporal.persistence.driver" (list $ "default")) "custom" }}
- name: TEMPORAL_STORE_PASSWORD
valueFrom:
Expand Down Expand Up @@ -143,9 +216,33 @@ spec:
port: rpc
{{- end }}
volumeMounts:
- name: config
{{- if $.Values.server.useEntrypointScript }}
{{- if or (eq $.Values.server.configMapsToMount "both") (eq $.Values.server.configMapsToMount "legacy") }}
- name: config-legacy
Comment thread
chaptersix marked this conversation as resolved.
Outdated
mountPath: /etc/temporal/config-source/legacy
readOnly: true
{{- end }}
{{- if or (eq $.Values.server.configMapsToMount "both") (eq $.Values.server.configMapsToMount "modern") }}
- name: config-modern
mountPath: /etc/temporal/config-source/modern
readOnly: true
{{- end }}
- name: entrypoint-script
mountPath: /entrypoint
readOnly: true
- name: config-processed
mountPath: /etc/temporal/config
{{- else }}
{{- if eq $.Values.server.configMapsToMount "legacy" }}
- name: config-legacy
mountPath: /etc/temporal/config/config_template.yaml
subPath: config_template.yaml
{{- else }}
- name: config-modern
mountPath: /etc/temporal/config/config_template.yaml
subPath: config_template.yaml
{{- end }}
{{- end }}
- name: dynamic-config
mountPath: /etc/temporal/dynamic_config
{{- if $.Values.server.additionalVolumeMounts }}
Expand All @@ -162,9 +259,24 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: config
{{- if or (eq $.Values.server.configMapsToMount "both") (eq $.Values.server.configMapsToMount "legacy") }}
- name: config-legacy
configMap:
name: "{{ include "temporal.fullname" $ }}-config"
name: "{{ include "temporal.fullname" $ }}-legacy-config"
{{- end }}
{{- if or (eq $.Values.server.configMapsToMount "both") (eq $.Values.server.configMapsToMount "modern") }}
- name: config-modern
configMap:
name: "{{ include "temporal.fullname" $ }}-modern-config"
{{- end }}
{{- if $.Values.server.useEntrypointScript }}
- name: entrypoint-script
configMap:
name: "{{ include "temporal.fullname" $ }}-entrypoint-script"
defaultMode: 0755
- name: config-processed
emptyDir: {}
{{- end }}
- name: dynamic-config
configMap:
name: "{{ include "temporal.fullname" $ }}-dynamic-config"
Expand Down
Loading
Loading