Skip to content

Commit

Permalink
Create a job per chart version so that schema upgrades can run. (#564)
Browse files Browse the repository at this point in the history
* Include release revision in the schema job name.

This allows upgrades to create a new job even if the original job is still
present for some reason.

Also set a TTL on the job so that it will be cleared up 1 day after completion
(successful or otherwise). This gives an admin some time to see logs and so on
if required. Unfortunately it isn't possible to only set a TTL on successful
completions.
  • Loading branch information
robholland authored Oct 7, 2024
1 parent f6e1903 commit 55b492a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions charts/temporal/templates/_admintools-env.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{{- define "temporal.admintools-env" -}}
{{- $global := index . 0 -}}
{{- $store := index . 1 -}}
{{- $storeConfig := index $global.Values.server.config.persistence $store }}
{{- $storeConfig := index $global.Values.server.config.persistence $store -}}
{{- $driver := include "temporal.persistence.driver" (list $global $store) -}}
{{- $driverConfig := index $storeConfig $driver }}
{{- if eq $driver "elasticsearch" -}}
{{- $driverConfig = $global.Values.elasticsearch -}}
{{- end -}}
{{- if eq $driver "cassandra" }}
{{- if eq $driver "cassandra" -}}
- name: CASSANDRA_HOST
value: {{ first (splitList "," (include "temporal.persistence.cassandra.hosts" (list $global $store))) }}
- name: CASSANDRA_PORT
Expand All @@ -21,7 +21,7 @@
secretKeyRef:
name: {{ include "temporal.persistence.secretName" (list $global $store) }}
key: {{ include "temporal.persistence.secretKey" (list $global $store) }}
{{- else if eq $driver "sql" }}
{{- else if eq $driver "sql" -}}
- name: SQL_PLUGIN
value: {{ include "temporal.persistence.sql.driver" (list $global $store) }}
- name: SQL_HOST
Expand Down Expand Up @@ -59,7 +59,7 @@
value: {{ not .enableHostVerification | quote }}
{{- end }}
{{- end }}
{{- else if eq $driver "elasticsearch" }}
{{- else if eq $driver "elasticsearch" -}}
- name: ES_SCHEME
value: {{ $driverConfig.scheme }}
- name: ES_HOST
Expand Down
5 changes: 3 additions & 2 deletions charts/temporal/templates/server-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "temporal.componentname" (list $ "schema") }}
name: {{ include "temporal.componentname" (list $ (printf "schema-%d" .Release.Revision | replace "." "-")) }}
labels:
{{- include "temporal.resourceLabels" (list $ "database" "") | nindent 4 }}
spec:
backoffLimit: {{ $.Values.schema.setup.backoffLimit }}
ttlSecondsAfterFinished: 86400
template:
metadata:
name: {{ include "temporal.componentname" (list $ "schema") }}
name: {{ include "temporal.componentname" (list $ (printf "schema-%d" .Release.Revision | replace "." "-")) }}
labels:
{{- include "temporal.resourceLabels" (list $ "database" "") | nindent 8 }}
{{- with $.Values.schema.podLabels }}
Expand Down

0 comments on commit 55b492a

Please sign in to comment.