Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ Then install:
```bash
helm install --repo https://go.temporal.io/helm-charts -f elasticsearch.values.yaml temporal temporal --timeout 900s
```
**Note:** In shared Elasticsearch clusters `elasticsearch.skipClusterSettings` may be useful. If `true`, skip applying cluster-wide settings (`action.auto_create_index`) during schema setup. (default: `false`)

### Enable Archival

Expand Down
5 changes: 4 additions & 1 deletion charts/temporal/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ app.kubernetes.io/part-of: {{ $global.Chart.Name }}
{{- $_ := unset $storeConfig "password" -}}
{{- end -}}
{{- end -}}
{{- $_ := set $dsCopy $storeType (omit $storeConfig "existingSecret" "secretKey" "createDatabase" "manageSchema") -}}
{{- $_ := set $dsCopy $storeType (omit $storeConfig "existingSecret" "secretKey" "createDatabase" "manageSchema" "skipClusterSettings") -}}
{{- end -}}
{{- end -}}
{{- $_ := set $patchedDatastores $name $dsCopy -}}
Expand Down Expand Up @@ -210,6 +210,9 @@ app.kubernetes.io/part-of: {{ $global.Chart.Name }}
{{- if not (hasKey $storeConfig "manageSchema") -}}
{{- $_ := set $storeConfig "manageSchema" true -}}
{{- end -}}
{{- if not (hasKey $storeConfig "skipClusterSettings") -}}
{{- $_ := set $storeConfig "skipClusterSettings" false -}}
{{- end -}}
{{- $_ := set $store "config" $storeConfig -}}
{{- else -}}
{{- fail (printf "No valid driver configured for %s store" $store.name) -}}
Expand Down
4 changes: 4 additions & 0 deletions charts/temporal/templates/server-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ spec:
{{- fail (printf "manageSchema is not supported for %s SQL database plugin" $store.config.pluginName) -}}
{{- end }}
{{- else if eq $store.driver "elasticsearch" }}
{{- if $store.config.skipClusterSettings }}
- temporal-elasticsearch-tool create-index && temporal-elasticsearch-tool update-schema --index "$ES_VISIBILITY_INDEX"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't quite right, if we create-index without the template being there then the index will lack the proper settings/mappings.

{{- else }}
- temporal-elasticsearch-tool setup-schema && temporal-elasticsearch-tool create-index && temporal-elasticsearch-tool update-schema --index "$ES_VISIBILITY_INDEX"
{{- end }}
{{- end }}
env:
{{- include "temporal.admintools-env" (list $ $store) | nindent 12 }}
Expand Down
54 changes: 54 additions & 0 deletions charts/temporal/tests/server_job_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -585,3 +585,57 @@ tests:
- equal:
path: spec.template.spec.initContainers[?(@.name=="manage-schema-default-store")].env[?(@.name=="SQL_PORT")].value
value: "5432"
- it: skips setup-schema when skipClusterSettings is true for elasticsearch
set:
server:
config:
persistence:
datastores:
default:
sql:
pluginName: mysql8
connectAddr: "temporal-persistence:3306"
databaseName: temporal
visibility:
elasticsearch:
version: v7
skipClusterSettings: true
url:
scheme: http
host: "elasticsearch:9200"
username: ""
password: ""
indices:
visibility: temporal_visibility_v1
asserts:
- matchRegex:
path: spec.template.spec.initContainers[?(@.name=="manage-schema-visibility-store")].args[0]
pattern: "^temporal-elasticsearch-tool create-index"
- notMatchRegex:
path: spec.template.spec.initContainers[?(@.name=="manage-schema-visibility-store")].args[0]
pattern: "setup-schema"
- it: includes setup-schema by default for elasticsearch
set:
server:
config:
persistence:
datastores:
default:
sql:
pluginName: mysql8
connectAddr: "temporal-persistence:3306"
databaseName: temporal
visibility:
elasticsearch:
version: v7
url:
scheme: http
host: "elasticsearch:9200"
username: ""
password: ""
indices:
visibility: temporal_visibility_v1
asserts:
- matchRegex:
path: spec.template.spec.initContainers[?(@.name=="manage-schema-visibility-store")].args[0]
pattern: "setup-schema"
3 changes: 3 additions & 0 deletions charts/temporal/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ server:
# password: ""
# existingSecret: temporal-es-secret
# secretKey: password
# # Skip applying cluster-wide settings (action.auto_create_index) during schema setup.
# # Useful when sharing an ES cluster with other services that need auto-index creation.
# skipClusterSettings: false
# logLevel: error
# indices:
# visibility: temporal_visibility_v1
Expand Down
3 changes: 3 additions & 0 deletions charts/temporal/values/values.elasticsearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ server:
logLevel: error
indices:
visibility: temporal_visibility_v1
# Skip applying cluster-wide settings (action.auto_create_index) during schema setup.
# Useful when sharing an ES cluster with other services that need auto-index creation.
# skipClusterSettings: false
# tls:
# enabled: true
# caFile: /path/to/ca.crt
Expand Down
Loading