diff --git a/CHANGELOG.md b/CHANGELOG.md index 8610732c..64b61fc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -95,7 +95,7 @@ Updates: - Bump github.com/cert-manager/cert-manager from 1.10.1 to 1.11.0 [#245](https://github.com/alexandrevilain/temporal-operator/pull/245) - Bump go.temporal.io/server from 1.19.0 to 1.19.1 [#248](https://github.com/alexandrevilain/temporal-operator/pull/248) - Bump go.temporal.io/sdk from 1.19.0 to 1.20.0 [#249](https://github.com/alexandrevilain/temporal-operator/pull/249) -- Bump github.com/onsi/gomega from 1.24.2 to 1.25.0 [#250](https://github.com/alexandrevilain/temporal-operator/pull/250) +- Bump github.com/onsi/gomega from 1.24.3 to 1.25.0 [#250](https://github.com/alexandrevilain/temporal-operator/pull/250) - Bump go.temporal.io/api from 1.14.0 to 1.15.0 [#253](https://github.com/alexandrevilain/temporal-operator/pull/253) ## 0.10.0 diff --git a/README.md b/README.md index 1e9c7516..39600abd 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 persistence: defaultStore: diff --git a/api/v1beta1/temporalcluster_defaults.go b/api/v1beta1/temporalcluster_defaults.go index f0e36e7c..4bf9d41f 100644 --- a/api/v1beta1/temporalcluster_defaults.go +++ b/api/v1beta1/temporalcluster_defaults.go @@ -26,7 +26,7 @@ import ( ) const ( - defaultTemporalVersion = "1.24.2" + defaultTemporalVersion = "1.24.3" defaultTemporalImage = "temporalio/server" defaultTemporalUIVersion = "2.27.3" diff --git a/bundle/manifests/temporal-operator.clusterserviceversion.yaml b/bundle/manifests/temporal-operator.clusterserviceversion.yaml index 22031c94..15a04f38 100644 --- a/bundle/manifests/temporal-operator.clusterserviceversion.yaml +++ b/bundle/manifests/temporal-operator.clusterserviceversion.yaml @@ -45,7 +45,7 @@ metadata: "ui": { "enabled": true }, - "version": "1.24.2" + "version": "1.24.3" } }, { @@ -191,7 +191,7 @@ spec: user: temporal ui: enabled: true - version: 1.24.2 + version: 1.24.3 ### Apply TemporalCluster CustomResource diff --git a/config/manifests/bases/temporal-operator.clusterserviceversion.yaml b/config/manifests/bases/temporal-operator.clusterserviceversion.yaml index 43885fc9..28c5cd26 100644 --- a/config/manifests/bases/temporal-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/temporal-operator.clusterserviceversion.yaml @@ -164,7 +164,7 @@ spec: user: temporal ui: enabled: true - version: 1.24.2 + version: 1.24.3 ### Apply TemporalCluster CustomResource diff --git a/config/manifests/bases/temporal-operator.clusterserviceversion.yaml-e b/config/manifests/bases/temporal-operator.clusterserviceversion.yaml-e index 1e74b2ab..8832e6f4 100644 --- a/config/manifests/bases/temporal-operator.clusterserviceversion.yaml-e +++ b/config/manifests/bases/temporal-operator.clusterserviceversion.yaml-e @@ -164,7 +164,7 @@ spec: user: temporal ui: enabled: true - version: 1.24.2 + version: 1.24.3 ### Apply TemporalCluster CustomResource diff --git a/config/samples/temporal.io_v1beta1_temporalcluster.yaml b/config/samples/temporal.io_v1beta1_temporalcluster.yaml index 29cf0dba..0f988472 100644 --- a/config/samples/temporal.io_v1beta1_temporalcluster.yaml +++ b/config/samples/temporal.io_v1beta1_temporalcluster.yaml @@ -4,7 +4,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 jobTtlSecondsAfterFinished: 300 persistence: @@ -29,4 +29,4 @@ spec: name: postgres-password key: PASSWORD ui: - enabled: true \ No newline at end of file + enabled: true diff --git a/docs/features/admin-tools.md b/docs/features/admin-tools.md index 760f0820..bc8de796 100644 --- a/docs/features/admin-tools.md +++ b/docs/features/admin-tools.md @@ -11,7 +11,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 # [...] admintools: @@ -19,5 +19,5 @@ spec: # You can specify the admin tools version if needed. # Check available tag you can check by the link below # https://hub.docker.com/r/temporalio/admin-tools/tags - version: 1.24.2-tctl-1.18.1-cli-0.13.2 + version: 1.24.2-tctl-1.18.1-cli-1.0.0 ``` diff --git a/docs/features/archival.md b/docs/features/archival.md index a5506a7d..a5e44191 100644 --- a/docs/features/archival.md +++ b/docs/features/archival.md @@ -68,7 +68,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 # [...] archival: @@ -104,7 +104,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 # [...] archival: @@ -142,7 +142,7 @@ kind: TemporalCluster metadata: name: prod spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 # [...] services: @@ -195,7 +195,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 # [...] archival: diff --git a/docs/features/dynamic-config.md b/docs/features/dynamic-config.md index 62f01868..ddcbe3e8 100644 --- a/docs/features/dynamic-config.md +++ b/docs/features/dynamic-config.md @@ -11,7 +11,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 # [...] dynamicConfig: @@ -23,4 +23,4 @@ spec: matching.numTaskqueueWritePartitions: - value: 5 constraints: {} -``` \ No newline at end of file +``` diff --git a/docs/features/monitoring/prometheus-operator.md b/docs/features/monitoring/prometheus-operator.md index cf67256f..fb0395d9 100644 --- a/docs/features/monitoring/prometheus-operator.md +++ b/docs/features/monitoring/prometheus-operator.md @@ -23,7 +23,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 # [...] metrics: @@ -67,4 +67,3 @@ spec: ``` To see all the features provided by this field check the `monitoring.coreos.com/v1.RelabelConfig` [API reference](https://prometheus-operator.dev/docs/operator/api/#monitoring.coreos.com/v1.RelabelConfig) on [prometheus-operator website](https://prometheus-operator.dev/). - \ No newline at end of file diff --git a/docs/features/monitoring/prometheus.md b/docs/features/monitoring/prometheus.md index 9393e578..ae2aa34c 100644 --- a/docs/features/monitoring/prometheus.md +++ b/docs/features/monitoring/prometheus.md @@ -19,7 +19,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 # [...] metrics: diff --git a/docs/features/temporal-ui.md b/docs/features/temporal-ui.md index 1f1f32fd..37886c8b 100644 --- a/docs/features/temporal-ui.md +++ b/docs/features/temporal-ui.md @@ -15,7 +15,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 # [...] ui: @@ -39,7 +39,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 # [...] ui: @@ -63,7 +63,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 # [...] ui: @@ -92,7 +92,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 ui: enabled: true diff --git a/docs/getting-started.md b/docs/getting-started.md index 575cd4e0..18db9444 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -34,7 +34,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 persistence: defaultStore: @@ -61,4 +61,4 @@ spec: Apply this file to the cluster. -To try more features the operator provides feel free to navigate in the documentation website or checkout the [examples/](https://github.com/alexandrevilain/temporal-operator/tree/main/examples) directory. \ No newline at end of file +To try more features the operator provides feel free to navigate in the documentation website or checkout the [examples/](https://github.com/alexandrevilain/temporal-operator/tree/main/examples) directory. diff --git a/examples/cluster-cassandra/02-temporal-cluster.yaml b/examples/cluster-cassandra/02-temporal-cluster.yaml index e4333207..5eff7c76 100644 --- a/examples/cluster-cassandra/02-temporal-cluster.yaml +++ b/examples/cluster-cassandra/02-temporal-cluster.yaml @@ -13,7 +13,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 jobTtlSecondsAfterFinished: 300 persistence: diff --git a/examples/cluster-mtls-istio/02-temporal-cluster.yaml b/examples/cluster-mtls-istio/02-temporal-cluster.yaml index 898b7811..11fa3a13 100644 --- a/examples/cluster-mtls-istio/02-temporal-cluster.yaml +++ b/examples/cluster-mtls-istio/02-temporal-cluster.yaml @@ -4,7 +4,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 jobTtlSecondsAfterFinished: 300 persistence: @@ -35,4 +35,4 @@ spec: metrics: enabled: true prometheusConfig: - listenPort: 9090 \ No newline at end of file + listenPort: 9090 diff --git a/examples/cluster-mtls-linkerd/02-temporal-cluster.yaml b/examples/cluster-mtls-linkerd/02-temporal-cluster.yaml index b9d749e9..d810d229 100644 --- a/examples/cluster-mtls-linkerd/02-temporal-cluster.yaml +++ b/examples/cluster-mtls-linkerd/02-temporal-cluster.yaml @@ -4,7 +4,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 jobTtlSecondsAfterFinished: 300 persistence: @@ -35,4 +35,4 @@ spec: metrics: enabled: true prometheusConfig: - listenPort: 9090 \ No newline at end of file + listenPort: 9090 diff --git a/examples/cluster-mtls/02-temporal-cluster.yaml b/examples/cluster-mtls/02-temporal-cluster.yaml index e4c46e81..79325b58 100644 --- a/examples/cluster-mtls/02-temporal-cluster.yaml +++ b/examples/cluster-mtls/02-temporal-cluster.yaml @@ -4,7 +4,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 jobTtlSecondsAfterFinished: 300 persistence: @@ -49,4 +49,4 @@ spec: metrics: enabled: true prometheus: - listenPort: 9090 \ No newline at end of file + listenPort: 9090 diff --git a/examples/cluster-mysql/02-temporal-cluster.yaml b/examples/cluster-mysql/02-temporal-cluster.yaml index fccd560d..97c1a840 100644 --- a/examples/cluster-mysql/02-temporal-cluster.yaml +++ b/examples/cluster-mysql/02-temporal-cluster.yaml @@ -4,7 +4,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 persistence: defaultStore: @@ -32,4 +32,4 @@ spec: admintools: enabled: true metrics: - enabled: false \ No newline at end of file + enabled: false diff --git a/examples/cluster-postgres-archival/02-temporal-cluster.yaml b/examples/cluster-postgres-archival/02-temporal-cluster.yaml index 40d8570f..318ebd0a 100644 --- a/examples/cluster-postgres-archival/02-temporal-cluster.yaml +++ b/examples/cluster-postgres-archival/02-temporal-cluster.yaml @@ -4,7 +4,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 persistence: defaultStore: @@ -49,4 +49,4 @@ spec: visibility: enabled: true enableRead: true - path: "dev-temporal-archival-visibility" \ No newline at end of file + path: "dev-temporal-archival-visibility" diff --git a/examples/cluster-postgres-es/03-temporal-cluster.yaml b/examples/cluster-postgres-es/03-temporal-cluster.yaml index d7fd5fc1..dd90b68b 100644 --- a/examples/cluster-postgres-es/03-temporal-cluster.yaml +++ b/examples/cluster-postgres-es/03-temporal-cluster.yaml @@ -4,7 +4,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 jobTtlSecondsAfterFinished: 300 persistence: @@ -43,4 +43,4 @@ spec: metrics: enabled: true prometheus: - listenPort: 9090 \ No newline at end of file + listenPort: 9090 diff --git a/examples/cluster-postgres/02-temporal-cluster.yaml b/examples/cluster-postgres/02-temporal-cluster.yaml index bd0ef696..27ec33a9 100644 --- a/examples/cluster-postgres/02-temporal-cluster.yaml +++ b/examples/cluster-postgres/02-temporal-cluster.yaml @@ -4,7 +4,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 persistence: defaultStore: @@ -54,4 +54,4 @@ spec: constraints: {} matching.numTaskqueueWritePartitions: - value: 5 - constraints: {} \ No newline at end of file + constraints: {} diff --git a/examples/cluster-sidecar/02-temporal-cluster.yaml b/examples/cluster-sidecar/02-temporal-cluster.yaml index 8debda4c..bb7e5bfc 100644 --- a/examples/cluster-sidecar/02-temporal-cluster.yaml +++ b/examples/cluster-sidecar/02-temporal-cluster.yaml @@ -4,7 +4,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 persistence: defaultStore: @@ -68,4 +68,4 @@ spec: constraints: {} matching.numTaskqueueWritePartitions: - value: 5 - constraints: {} \ No newline at end of file + constraints: {} diff --git a/examples/schedule/02-temporal-cluster.yaml b/examples/schedule/02-temporal-cluster.yaml index 96b968d9..e96ab513 100644 --- a/examples/schedule/02-temporal-cluster.yaml +++ b/examples/schedule/02-temporal-cluster.yaml @@ -4,7 +4,7 @@ metadata: name: prod namespace: demo spec: - version: 1.24.2 + version: 1.24.3 numHistoryShards: 1 persistence: defaultStore: @@ -36,4 +36,4 @@ spec: admintools: enabled: true metrics: - enabled: false \ No newline at end of file + enabled: false diff --git a/go.mod b/go.mod index 9236519f..ea7636c7 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/stretchr/testify v1.9.0 go.temporal.io/api v1.32.1 go.temporal.io/sdk v1.26.1 - go.temporal.io/server v1.24.2 + go.temporal.io/server v1.24.3 golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 google.golang.org/protobuf v1.35.1 gopkg.in/yaml.v3 v3.0.1 diff --git a/go.sum b/go.sum index bbde6e39..2215e380 100644 --- a/go.sum +++ b/go.sum @@ -302,8 +302,8 @@ go.temporal.io/api v1.32.1 h1:jivpWVuxUya9XkmJTcLLcb2kFqkwrknXpx13HlaQR0Y= go.temporal.io/api v1.32.1/go.mod h1:DATVgu+KiAYVjFvOSXB9AVoYZT1yjGt6IPbb7bDw8Qs= go.temporal.io/sdk v1.26.1 h1:ggmFBythnuuW3yQRp0VzOTrmbOf+Ddbe00TZl+CQ+6U= go.temporal.io/sdk v1.26.1/go.mod h1:ph3K/74cry+JuSV9nJH+Q+Zeir2ddzoX2LjWL/e5yCo= -go.temporal.io/server v1.24.2 h1:z8KaFxpAtTI6gG2XQX5h+2tCXI6cYpT1tseMhefBKKI= -go.temporal.io/server v1.24.2/go.mod h1:bZuNDtqvTDh96D5+7DG1kfoJtWw7MJJDTy4GV9yRRdc= +go.temporal.io/server v1.24.3 h1:WzegMbcG5ARQ66vS5j5H6YqgcQlkbdq7HDnHdvxWeYE= +go.temporal.io/server v1.24.3/go.mod h1:bZuNDtqvTDh96D5+7DG1kfoJtWw7MJJDTy4GV9yRRdc= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= diff --git a/internal/resource/persistence/template.go b/internal/resource/persistence/template.go index 525cbd98..beec0652 100644 --- a/internal/resource/persistence/template.go +++ b/internal/resource/persistence/template.go @@ -48,232 +48,286 @@ var ( templatesContent = map[string]string{ noOpTemplate: dedent.Dedent(` - #!/bin/bash - echo "No-op" - {{ template "scripts" . }} - `), + #!/bin/bash + echo "No-op" + {{ template "scripts" . }} + `), createCassandraTemplate: dedent.Dedent(` - #!/bin/bash - {{ .Tool }} {{ .ConnectionArgs }} create-Keyspace -k {{ .KeyspaceName }} - {{ template "scripts" . }} - `), + #!/bin/bash + {{ .Tool }} {{ .ConnectionArgs }} create-Keyspace -k {{ .KeyspaceName }} + {{ template "scripts" . }} + `), createDatabaseTemplate: dedent.Dedent(` - #!/bin/bash - {{ .Tool }} {{ .ConnectionArgs }} create-database -database {{ .DatabaseName }} - {{ template "scripts" . }} - `), + #!/bin/bash + {{ .Tool }} {{ .ConnectionArgs }} create-database -database {{ .DatabaseName }} + {{ template "scripts" . }} + `), createDatabaseTemplateV1_18: dedent.Dedent(` - #!/bin/bash - {{ .Tool }} {{ .ConnectionArgs }} create - {{ template "scripts" . }} - `), + #!/bin/bash + {{ .Tool }} {{ .ConnectionArgs }} create + {{ template "scripts" . }} + `), setupSchemaTemplate: dedent.Dedent(` - #!/bin/bash - {{ .Tool }} {{ .ConnectionArgs }} setup-schema -v {{ .InitialVersion }} - {{ template "scripts" . }} - `), + #!/bin/bash + {{ .Tool }} {{ .ConnectionArgs }} setup-schema -v {{ .InitialVersion }} + {{ template "scripts" . }} + `), updateSchemaTemplate: dedent.Dedent(` - #!/bin/bash - {{ .Tool }} {{ .ConnectionArgs }} update-schema -d {{ .SchemaDir }} - {{ template "scripts" . }} - `), + #!/bin/bash + {{ .Tool }} {{ .ConnectionArgs }} update-schema -d {{ .SchemaDir }} + {{ template "scripts" . }} + `), setupESVisibility: dedent.Dedent(` - #!/bin/bash - # Change index_patterns from temporal_visibility_v1* to {{ .Indices.Visibility }}* at index_template_{{ .Version }}.json before apply - sed 's/temporal_visibility_v1./{{ .Indices.Visibility }}*/g' /etc/temporal/schema/elasticsearch/visibility/index_template_{{ .Version }}.json > /tmp/index_template_{{ .Version }}.json - - curl --fail --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/_cluster/settings" -H "Content-Type: application/json" --data-binary @/etc/temporal/schema/elasticsearch/visibility/cluster_settings_{{ .Version }}.json --write-out "\n" - curl --fail --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/_template/{{ .Indices.Visibility }}_template" -H "Content-Type: application/json" --data-binary @/tmp/index_template_{{ .Version }}.json --write-out "\n" - # No --fail here because create index is not idempotent operaton. - curl --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/{{ .Indices.Visibility }}" --write-out "\n" - {{ if .Indices.SecondaryVisibility }} - curl --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/{{ .Indices.SecondaryVisibility }}" --write-out "\n" - {{ end }} - {{ template "scripts" . }} - `), + #!/bin/bash + # Change index_patterns from temporal_visibility_v1* to {{ .Indices.Visibility }}* at index_template_{{ .Version }}.json before apply + sed 's/temporal_visibility_v1./{{ .Indices.Visibility }}*/g' /etc/temporal/schema/elasticsearch/visibility/index_template_{{ .Version }}.json > /tmp/index_template_{{ .Version }}.json + + curl --fail --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/_cluster/settings" -H "Content-Type: application/json" --data-binary @/etc/temporal/schema/elasticsearch/visibility/cluster_settings_{{ .Version }}.json --write-out "\n" + curl --fail --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/_template/{{ .Indices.Visibility }}_template" -H "Content-Type: application/json" --data-binary @/tmp/index_template_{{ .Version }}.json --write-out "\n" + # No --fail here because create index is not idempotent operaton. + curl --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/{{ .Indices.Visibility }}" --write-out "\n" + {{ if .Indices.SecondaryVisibility }} + curl --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/{{ .Indices.SecondaryVisibility }}" --write-out "\n" + {{ end }} + {{ template "scripts" . }} + `), updateESVisibility: dedent.Dedent(` - #!/bin/bash - - do_upgrade() { - desired_version=$1 - es_version="{{ .Version }}" - - case $desired_version in - v2) - echo "Upgrading to schema v2" - - # Extracted from: - # https://github.com/temporalio/temporal/blob/v1.17.5/schema/elasticsearch/visibility/versioned/v2/upgrade.sh - - case $es_version in - v6) date_type='date' ; doc_type='/_doc' ;; - *) date_type='date_nanos' ; doc_type='' ;; - esac - - new_mapping=' - { - "properties": { - "TemporalScheduledStartTime": { - "type": "'$date_type'" - }, - "TemporalScheduledById": { - "type": "keyword" - }, - "TemporalSchedulePaused": { - "type": "boolean" - } - } - } - ' - - curl --silent --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/{{ .Indices.Visibility }}${doc_type}/_mapping" -H "Content-Type: application/json" --data-binary "$new_mapping" | jq - ;; - v3) - echo "Upgrading to schema v3" - - new_mapping=' - { - "properties": { - "TemporalNamespaceDivision": { - "type": "keyword" - } - } - } - ' - - curl --silent --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/{{ .Indices.Visibility }}/_mapping" -H "Content-Type: application/json" --data-binary "$new_mapping" | jq - ;; - v4) - echo "Upgrading to schema v4" - - new_mapping=' - { - "properties": { - "HistorySizeBytes": { - "type": "long" - } - } - } - ' - - curl --silent --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/{{ .Indices.Visibility }}/_mapping" -H "Content-Type: application/json" --data-binary "$new_mapping" | jq - ;; - v5) - echo "Upgrading to schema v5" - - new_mapping=' - { - "properties": { - "BuildIds": { - "type": "keyword" - } - } - } - ' - - curl --silent --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/{{ .Indices.Visibility }}/_mapping" -H "Content-Type: application/json" --data-binary "$new_mapping" | jq - ;; - esac - } - - # Get the expected schema version from the current simlink pointing to the versionned. - expected_version=$(realpath /etc/temporal/schema/elasticsearch/visibility/index_template_v7.json | sed -e 's/.*versioned\/\(.*\)\/index_template_v7.json.*/\1/') - current_version="" - current_version_found=false - - # Get the current_mapping value in elasticsearch. - current_mapping=$(curl --silent --user "{{ .Username }}":"${{ .PasswordEnvVar }}" {{ .URL }}/{{ .Indices.Visibility }}) - - # Guess current mapping version - # v0 does not have the "ExecutionDuration" property - is_v0=$(echo $current_mapping | jq -r '.{{ .Indices.Visibility }}.mappings.properties | has("ExecutionDuration") | not') - if [ $is_v0 == "true" ]; then - echo "Can't do upgrade from v0 schema, version needing advanced visibility schema v1 are not supported by the operator" - exit 1; - fi - - # v1 does not have the "TemporalScheduledById" property - is_v1=$(echo $current_mapping | jq -r '.{{ .Indices.Visibility }}.mappings.properties | has("TemporalScheduledById") | not') - if [ $is_v1 == "true" ]; then - if [ $current_version_found = false ]; then - current_version_found=true - current_version="v1" - fi - fi - - # v2 does not have the "TemporalNamespaceDivision" property - is_v2=$(echo $current_mapping | jq -r '.{{ .Indices.Visibility }}.mappings.properties | has("TemporalNamespaceDivision") | not') - if [ $is_v2 == "true" ]; then - if [ $current_version_found = false ]; then - current_version_found=true - current_version="v2" - fi - fi - - # v3 does not have the "HistorySizeBytes" property - is_v3=$(echo $current_mapping | jq -r '.{{ .Indices.Visibility }}.mappings.properties | has("HistorySizeBytes") | not') - if [ $is_v3 == "true" ]; then - if [ $current_version_found = false ]; then - current_version_found=true - current_version="v3" - fi - fi - - # v4 does not have the "BuildIds" property - is_v4=$(echo $current_mapping | jq -r '.{{ .Indices.Visibility }}.mappings.properties | has("BuildIds") | not') - if [ $is_v4 == "true" ]; then - if [ $current_version_found = false ]; then - current_version_found=true - current_version="v4" - fi - fi - - # v5 has the "BuildIds" key - is_v5=$(echo $current_mapping | jq -r '.{{ .Indices.Visibility }}.mappings.properties | has("BuildIds")') - if [ $is_v5 == "true" ]; then - if [ $current_version_found = false ]; then - current_version_found=true - current_version="v5" - fi - fi - - echo "Expected schema version: $expected_version" - echo "Current schema version: $current_version" - - current_version_int=$(echo $current_version | sed 's/^.//') - expected_version_int=$(echo $expected_version | sed 's/^.//') - - if [ $current_version_int -eq $expected_version_int ]; then - echo "Current schema version is already at the expected version" - {{ template "scripts" . }} - exit 0 - fi - - if [ $current_version_int -gt $expected_version_int ]; then - echo "Current schema version is already to a newer version" - {{ template "scripts" . }} - exit 0 - fi - - echo "Schema version upgrade is needed" - - # If the current version is v1, the script only supports to update to v2. - expected_next_version=$(( current_version_int + 1)) - - if [ $expected_next_version -ne $expected_version_int ]; then - echo "Can't do Elasticsearch schema upgrade for no-following version numbers. (eg. from v1 to v2, but not from v1 to v3)" - {{ template "scripts" . }} - exit 1 - fi - - do_upgrade $expected_version - - until curl --silent --user "{{ .Username }}":"${{ .PasswordEnvVar }}" "{{ .URL }}/_cluster/health/{{ .Indices.Visibility }}" | jq --exit-status '.status=="green" | .'; do - echo "Waiting for Elasticsearch index {{ .Indices.Visibility }} become green." - sleep 1 - done - {{ template "scripts" . }} - `), + #!/bin/bash + + do_upgrade() { + desired_version=$1 + es_version="{{ .Version }}" + + case $desired_version in + v2) + echo "Upgrading to schema v2" + + # Extracted from: + # https://github.com/temporalio/temporal/blob/v1.17.5/schema/elasticsearch/visibility/versioned/v2/upgrade.sh + + case $es_version in + v6) date_type='date' ; doc_type='/_doc' ;; + *) date_type='date_nanos' ; doc_type='' ;; + esac + + new_mapping=' + { + "properties": { + "TemporalScheduledStartTime": { + "type": "'$date_type'" + }, + "TemporalScheduledById": { + "type": "keyword" + }, + "TemporalSchedulePaused": { + "type": "boolean" + } + } + } + ' + + curl --silent --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/{{ .Indices.Visibility }}${doc_type}/_mapping" -H "Content-Type: application/json" --data-binary "$new_mapping" | jq + ;; + v3) + echo "Upgrading to schema v3" + + new_mapping=' + { + "properties": { + "TemporalNamespaceDivision": { + "type": "keyword" + } + } + } + ' + + curl --silent --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/{{ .Indices.Visibility }}/_mapping" -H "Content-Type: application/json" --data-binary "$new_mapping" | jq + ;; + v4) + echo "Upgrading to schema v4" + + new_mapping=' + { + "properties": { + "HistorySizeBytes": { + "type": "long" + } + } + } + ' + + curl --silent --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/{{ .Indices.Visibility }}/_mapping" -H "Content-Type: application/json" --data-binary "$new_mapping" | jq + ;; + v5) + echo "Upgrading to schema v5" + + new_mapping=' + { + "properties": { + "BuildIds": { + "type": "keyword" + } + } + } + ' + + curl --silent --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/{{ .Indices.Visibility }}/_mapping" -H "Content-Type: application/json" --data-binary "$new_mapping" | jq + ;; + v6) + echo "Upgrading to schema v6" + + new_mapping=' + { + "properties": { + "ParentWorkflowId": { + "type": "keyword" + }, + "ParentRunId": { + "type": "keyword" + } + } + } + ' + + curl --silent --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/{{ .Indices.Visibility }}/_mapping" -H "Content-Type: application/json" --data-binary "$new_mapping" | jq + ;; + v7) + echo "Upgrading to schema v7" + + new_mapping=' + { + "properties": { + "RootWorkflowId": { + "type": "keyword" + }, + "RootRunId": { + "type": "keyword" + } + } + } + ' + + curl --silent --user "{{ .Username }}":"${{ .PasswordEnvVar }}" -X PUT "{{ .URL }}/{{ .Indices.Visibility }}/_mapping" -H "Content-Type: application/json" --data-binary "$new_mapping" | jq + ;; + esac + } + + # Get the expected schema version from the current simlink pointing to the versionned. + expected_version=$(realpath /etc/temporal/schema/elasticsearch/visibility/index_template_v7.json | sed -e 's/.*versioned\/\(.*\)\/index_template_v7.json.*/\1/') + current_version="" + current_version_found=false + + # Get the current_mapping value in elasticsearch. + current_mapping=$(curl --silent --user "{{ .Username }}":"${{ .PasswordEnvVar }}" {{ .URL }}/{{ .Indices.Visibility }}) + + # Guess current mapping version + # v0 does not have the "ExecutionDuration" property + is_v0=$(echo $current_mapping | jq -r '.{{ .Indices.Visibility }}.mappings.properties | has("ExecutionDuration") | not') + if [ $is_v0 == "true" ]; then + echo "Can't do upgrade from v0 schema, version needing advanced visibility schema v1 are not supported by the operator" + exit 1; + fi + + # v1 does not have the "TemporalScheduledById" property + is_v1=$(echo $current_mapping | jq -r '.{{ .Indices.Visibility }}.mappings.properties | has("TemporalScheduledById") | not') + if [ $is_v1 == "true" ]; then + if [ $current_version_found = false ]; then + current_version_found=true + current_version="v1" + fi + fi + + # v2 does not have the "TemporalNamespaceDivision" property + is_v2=$(echo $current_mapping | jq -r '.{{ .Indices.Visibility }}.mappings.properties | has("TemporalNamespaceDivision") | not') + if [ $is_v2 == "true" ]; then + if [ $current_version_found = false ]; then + current_version_found=true + current_version="v2" + fi + fi + + # v3 does not have the "HistorySizeBytes" property + is_v3=$(echo $current_mapping | jq -r '.{{ .Indices.Visibility }}.mappings.properties | has("HistorySizeBytes") | not') + if [ $is_v3 == "true" ]; then + if [ $current_version_found = false ]; then + current_version_found=true + current_version="v3" + fi + fi + + # v4 does not have the "BuildIds" property + is_v4=$(echo $current_mapping | jq -r '.{{ .Indices.Visibility }}.mappings.properties | has("BuildIds") | not') + if [ $is_v4 == "true" ]; then + if [ $current_version_found = false ]; then + current_version_found=true + current_version="v4" + fi + fi + + # v5 does not have the "ParentRunId" key + is_v5=$(echo $current_mapping | jq -r '.{{ .Indices.Visibility }}.mappings.properties | has("ParentRunId") | not') + if [ $is_v5 == "true" ]; then + if [ $current_version_found = false ]; then + current_version_found=true + current_version="v5" + fi + fi + + # v6 does not have the "RootRunId" key + is_v6=$(echo $current_mapping | jq -r '.{{ .Indices.Visibility }}.mappings.properties | has("RootRunId") | not') + if [ $is_v6 == "true" ]; then + if [ $current_version_found = false ]; then + current_version_found=true + current_version="v6" + fi + fi + + # v7 has the "RootRunId" key + is_v7=$(echo $current_mapping | jq -r '.{{ .Indices.Visibility }}.mappings.properties | has("RootRunId")') + if [ $is_v7 == "true" ]; then + if [ $current_version_found = false ]; then + current_version_found=true + current_version="v7" + fi + fi + + echo "Expected schema version: $expected_version" + echo "Current schema version: $current_version" + + current_version_int=$(echo $current_version | sed 's/^.//') + expected_version_int=$(echo $expected_version | sed 's/^.//') + + if [ $current_version_int -eq $expected_version_int ]; then + echo "Current schema version is already at the expected version" + {{ template "scripts" . }} + exit 0 + fi + + if [ $current_version_int -gt $expected_version_int ]; then + echo "Current schema version is already to a newer version" + {{ template "scripts" . }} + exit 0 + fi + + echo "Schema version upgrade is needed" + + # If the current version is v1, the script only supports to update to v2. + expected_next_version=$(( current_version_int + 1)) + + if [ $expected_next_version -ne $expected_version_int ]; then + echo "Can't do Elasticsearch schema upgrade for no-following version numbers. (eg. from v1 to v2, but not from v1 to v3)" + {{ template "scripts" . }} + exit 1 + fi + + do_upgrade $expected_version + + until curl --silent --user "{{ .Username }}":"${{ .PasswordEnvVar }}" "{{ .URL }}/_cluster/health/{{ .Indices.Visibility }}" | jq --exit-status '.status=="green" | .'; do + echo "Waiting for Elasticsearch index {{ .Indices.Visibility }} become green." + sleep 1 + done + {{ template "scripts" . }} + `), } ) @@ -321,19 +375,19 @@ type ( ) var proxyShutdownScriptsContent = dedent.Dedent(` - {{- define "scripts" -}} - {{- if eq .MTLSProvider "linkerd" -}} - x=$? - curl -X POST http://localhost:4191/shutdown - exit $x - {{- end -}} - {{- if eq .MTLSProvider "istio" -}} - x=$? - curl -sf -XPOST http://127.0.0.1:15020/quitquitquit - exit $x - {{- end -}} - {{- end -}} - `) + {{- define "scripts" -}} + {{- if eq .MTLSProvider "linkerd" -}} + x=$? + curl -X POST http://localhost:4191/shutdown + exit $x + {{- end -}} + {{- if eq .MTLSProvider "istio" -}} + x=$? + curl -sf -XPOST http://127.0.0.1:15020/quitquitquit + exit $x + {{- end -}} + {{- end -}} + `) func init() { for name, content := range templatesContent { diff --git a/pkg/version/admintools.go b/pkg/version/admintools.go index 2311dbbe..6c87ef41 100644 --- a/pkg/version/admintools.go +++ b/pkg/version/admintools.go @@ -7,7 +7,7 @@ import "fmt" func DefaultAdminToolTag(version *Version) string { // Particular case for >= 1.24.0 but < 1.25.0 if version.GreaterOrEqual(V1_24_0) && version.LessThan(V1_25_0) { - return "1.24.2-tctl-1.18.1-cli-0.13.2" + return "1.24.2-tctl-1.18.1-cli-1.0.0" } // Particular case for >= 1.25 because the admin tools image tag doesn't diff --git a/pkg/version/admintools_test.go b/pkg/version/admintools_test.go index 7841c642..c56f77a6 100644 --- a/pkg/version/admintools_test.go +++ b/pkg/version/admintools_test.go @@ -16,12 +16,12 @@ func TestDefaultAdminToolTag(t *testing.T) { { name: "Version 1.24.1", version: version.MustNewVersionFromString("1.24.1"), - expected: "1.24.2-tctl-1.18.1-cli-0.13.2", + expected: "1.24.2-tctl-1.18.1-cli-1.0.0", }, { name: "Version 1.24.9", version: version.MustNewVersionFromString("1.24.9"), - expected: "1.24.2-tctl-1.18.1-cli-0.13.2", + expected: "1.24.2-tctl-1.18.1-cli-1.0.0", }, { name: "Version 1.25.0", diff --git a/tests/e2e/persistence_test.go b/tests/e2e/persistence_test.go index 5b765f60..aa6fcccc 100644 --- a/tests/e2e/persistence_test.go +++ b/tests/e2e/persistence_test.go @@ -33,7 +33,7 @@ var ( initialClusterVersion = "1.19.1" newDatastoreVersion = "1.20.4" oldPersistenceUpgradePath = []string{"1.20.4", "1.21.2", "1.22.6", "1.23.0"} - defaultUpgradePath = []string{"1.21.2", "1.22.6", "1.23.0", "1.24.2"} + defaultUpgradePath = []string{"1.21.2", "1.22.6", "1.23.0", "1.24.3"} ) type ( diff --git a/tests/e2e/utils_test.go b/tests/e2e/utils_test.go index 43d81663..f5269d8f 100644 --- a/tests/e2e/utils_test.go +++ b/tests/e2e/utils_test.go @@ -48,7 +48,7 @@ import ( const doesNotExistName = "does-not-exist" -var defaultVersion = version.MustNewVersionFromString("1.24.2") +var defaultVersion = version.MustNewVersionFromString("1.24.3") func deployAndWaitForTemporalWithPostgres(ctx context.Context, cfg *envconf.Config, namespace string) (*v1beta1.TemporalCluster, error) { // create the postgres diff --git a/webhooks/temporalcluster_webhook_test.go b/webhooks/temporalcluster_webhook_test.go index 4ccfec85..66fe3cfa 100644 --- a/webhooks/temporalcluster_webhook_test.go +++ b/webhooks/temporalcluster_webhook_test.go @@ -257,7 +257,7 @@ func TestValidateCreate(t *testing.T) { Name: "fake", }, Spec: v1beta1.TemporalClusterSpec{ - Version: version.MustNewVersionFromString("1.24.2"), + Version: version.MustNewVersionFromString("1.24.3"), Persistence: v1beta1.TemporalPersistenceSpec{ AdvancedVisibilityStore: &v1beta1.DatastoreSpec{ Elasticsearch: &v1beta1.ElasticsearchSpec{ @@ -283,7 +283,7 @@ func TestValidateCreate(t *testing.T) { Name: "fake", }, Spec: v1beta1.TemporalClusterSpec{ - Version: version.MustNewVersionFromString("1.24.2"), + Version: version.MustNewVersionFromString("1.24.3"), Persistence: v1beta1.TemporalPersistenceSpec{ VisibilityStore: &v1beta1.DatastoreSpec{ Cassandra: &v1beta1.CassandraSpec{