Skip to content
Closed
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
2 changes: 2 additions & 0 deletions charts/temporal/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ Source: https://stackoverflow.com/a/52024583/3027614
{{- define "temporal.persistence.schema" -}}
{{- if eq . "default" -}}
{{- print "temporal" -}}
{{- else if eq . "secondaryVisibility" -}}
{{- print "visibility" -}}
{{- else -}}
{{- print . -}}
{{- end -}}
Expand Down
7 changes: 7 additions & 0 deletions charts/temporal/templates/server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ spec:
name: {{ include "temporal.persistence.secretName" (list $ "visibility") }}
key: {{ include "temporal.persistence.secretKey" (list $ "visibility") }}
{{- end }}
{{- if $.Values.server.config.persistence.secondaryVisibilityStore }}
- name: TEMPORAL_SECONDARY_VISIBILITY_STORE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "temporal.persistence.secretName" (list $ "secondaryVisibility") }}
key: {{ include "temporal.persistence.secretKey" (list $ "secondaryVisibility") }}
{{- end }}
{{- if and (hasKey $.Values.server "internalFrontend") $.Values.server.internalFrontend.enabled }}
- name: USE_INTERNAL_FRONTEND
value: "1"
Expand Down
31 changes: 31 additions & 0 deletions charts/temporal/templates/server-dockerize-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ data:
persistence:
defaultStore: {{ $server.config.persistence.defaultStore }}
visibilityStore: visibility
{{- if $server.config.persistence.secondaryVisibilityStore }}
secondaryVisibilityStore: {{ $server.config.persistence.secondaryVisibilityStore }}
{{- end }}
numHistoryShards: {{ $server.config.numHistoryShards }}
datastores:
{{- if ne (include "temporal.persistence.driver" (list $ "default")) "custom" }}
Expand Down Expand Up @@ -79,6 +82,34 @@ data:
{{- end }}
{{- end }}

{{- if $server.config.persistence.secondaryVisibilityStore }}
secondaryVisibility:
{{- if or $elasticsearch.enabled $elasticsearch.external }}
elasticsearch:
version: "{{ $elasticsearch.version }}"
url:
scheme: "{{ $elasticsearch.scheme }}"
host: "{{ $elasticsearch.host }}:{{ $elasticsearch.port }}"
username: "{{ $elasticsearch.username }}"
password: {{ `{{ .Env.TEMPORAL_SECONDARY_VISIBILITY_STORE_PASSWORD | quote }}` }}
logLevel: "{{ $elasticsearch.logLevel }}"
indices:
visibility: "{{ $elasticsearch.secondaryVisibilityIndex }}"
{{- else if eq (include "temporal.persistence.driver" (list $ "secondaryVisibility")) "sql" }}
sql:
pluginName: "{{ include "temporal.persistence.sql.driver" (list $ "secondaryVisibility") }}"
driverName: "{{ include "temporal.persistence.sql.driver" (list $ "secondaryVisibility") }}"
databaseName: "{{ $server.config.persistence.secondaryVisibility.sql.database }}"
connectAddr: "{{ include "temporal.persistence.sql.host" (list $ "secondaryVisibility") }}:{{ include "temporal.persistence.sql.port" (list $ "secondaryVisibility") }}"
connectProtocol: "tcp"
user: "{{ include "temporal.persistence.sql.user" (list $ "secondaryVisibility") }}"
password: {{ `{{ .Env.TEMPORAL_SECONDARY_VISIBILITY_STORE_PASSWORD | quote }}` }}
{{- with (omit $server.config.persistence.secondaryVisibility.sql "driver" "driverName" "host" "port" "connectAddr" "connectProtocol" "database" "databaseName" "user" "password" "existingSecret") }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- end }}

global:
membership:
name: temporal
Expand Down
88 changes: 88 additions & 0 deletions charts/temporal/templates/server-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,27 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- if $.Values.server.config.persistence.secondaryVisibilityStore }}
{{- $store := "secondaryVisibility" }}
{{- $storeConfig := index $.Values.server.config.persistence $store }}
{{- $driver := include "temporal.persistence.driver" (list $ $store) }}
{{- if ne $driver "elasticsearch" }}
- name: create-{{ $store | lower }}-store
image: "{{ $.Values.admintools.image.repository }}:{{ $.Values.admintools.image.tag }}"
imagePullPolicy: {{ $.Values.admintools.image.pullPolicy }}
{{- if eq $driver "cassandra" }}
command: ['temporal-cassandra-tool', 'create', '-k', '{{ $storeConfig.cassandra.keyspace }}', '--replication-factor', '{{ $storeConfig.cassandra.replicationFactor }}']
{{- else if eq $driver "sql" }}
command: ['temporal-sql-tool', 'create-database']
{{- end }}
env:
{{- include "temporal.admintools-env" (list $ $store) | nindent 12 }}
{{- with $.Values.server.additionalVolumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if $.Values.schema.setup.enabled }}
{{- range $store := (list "default" "visibility") }}
Expand Down Expand Up @@ -174,6 +195,38 @@ spec:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with $.Values.schema.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- if $.Values.server.config.persistence.secondaryVisibilityStore }}
{{- $store := "secondaryVisibility" }}
{{- $storeConfig := index $.Values.server.config.persistence $store }}
{{- $driver := include "temporal.persistence.driver" (list $ $store) }}
- name: setup-{{ $store | lower }}-store
image: "{{ $.Values.admintools.image.repository }}:{{ $.Values.admintools.image.tag }}"
imagePullPolicy: {{ $.Values.admintools.image.pullPolicy }}
{{- if eq $driver "cassandra" }}
command: ['temporal-cassandra-tool', 'setup-schema', '-v', '0.0']
{{- else if eq $driver "sql" }}
command: ['temporal-sql-tool', 'setup-schema', '-v', '0.0']
{{- else if eq $driver "elasticsearch" }}
command: ['sh', '-c']
args:
- 'curl -X PUT --fail --user "$ES_USER:$ES_PWD" $ES_SCHEME://$ES_HOST:$ES_PORT/_template/temporal_visibility_v1_template -H "Content-Type: application/json" --data-binary "@schema/elasticsearch/visibility/index_template_$ES_VERSION.json" 2>&1 &&
curl -X PUT --fail --user "$ES_USER:$ES_PWD" $ES_SCHEME://$ES_HOST:$ES_PORT/$ES_VISIBILITY_INDEX 2>&1'
{{- end }}
env:
{{- include "temporal.admintools-env" (list $ $store) | nindent 12 }}
{{- with $.Values.server.additionalVolumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with $.Values.schema.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with $.Values.schema.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -215,6 +268,41 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- if $.Values.server.config.persistence.secondaryVisibilityStore }}
{{- $store := "secondaryVisibility" }}
{{- $storeConfig := index $.Values.server.config.persistence $store }}
{{- $driver := include "temporal.persistence.driver" (list $ $store) }}
{{- $schema := include "temporal.persistence.schema" $store }}
{{- if ne $driver "elasticsearch" }}
- name: update-{{ $store | lower }}-store
image: "{{ $.Values.admintools.image.repository }}:{{ $.Values.admintools.image.tag }}"
imagePullPolicy: {{ $.Values.admintools.image.pullPolicy }}
{{- if eq $driver "cassandra" }}
command: ['temporal-cassandra-tool', 'update-schema', '--schema-dir', '/etc/temporal/schema/cassandra/{{ $schema }}/versioned']
{{- else if eq $driver "sql" }}
{{- $plugin := include "temporal.persistence.sql.driver" (list $ $store) }}
{{- if eq $plugin "mysql8" }}
command: ['temporal-sql-tool', 'update-schema', '--schema-dir', '/etc/temporal/schema/mysql/v8/{{ $schema }}/versioned']
{{- else if or (eq $plugin "postgres12") (eq $plugin "postgres12_pgx") }}
command: ['temporal-sql-tool', 'update-schema', '--schema-dir', '/etc/temporal/schema/postgresql/v12/{{ $schema }}/versioned']
{{- end }}
{{- end }}
env:
{{- include "temporal.admintools-env" (list $ $store) | nindent 12 }}
{{- with $.Values.server.additionalVolumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with $.Values.schema.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with $.Values.schema.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if $.Values.server.config.namespaces.create }}
{{- range $namespace := $.Values.server.config.namespaces.namespace }}
Expand Down