Files
postiz-helmchart/charts/postiz/templates/temporal-init-job.yaml
T
billisdead fc931e4707 feat(helm): add Temporal support and expand env coverage for v2.21.8
- Chart.yaml: bump to version 1.1.0, appVersion v2.21.8
- values.yaml: add temporal section (enabled/address/namespace/tls/apiKey/postgresql),
  expand env (~40 non-sensitive vars) and secrets (~60 sensitive vars) to match
  current Postiz documentation — covers all social providers, email SMTP,
  OAuth OIDC, AI/generation, analytics, MCP, payments, short-link services
- postiz-config.yaml: inject TEMPORAL_ADDRESS (auto-computed or override),
  TEMPORAL_NAMESPACE and TEMPORAL_TLS when temporal.enabled or address is set
- temporal-deployment.yaml: temporalio/auto-setup:1.28.1, postgres12 backend,
  ES disabled, dynamicconfig volume mount, liveness/readiness probes
- temporal-service.yaml: ClusterIP on port 7233 (gRPC)
- temporal-dynamicconfig.yaml: ConfigMap with development-sql.yaml content
- temporal-init-job.yaml: post-install/upgrade Job that creates the temporal
  PostgreSQL user via the postgres superuser before Temporal starts
- temporal-secret.yaml: Secret for temporal PostgreSQL credentials
- NOTES.txt: post-install guidance, search-attribute creation reminder,
  multi-replica/local-storage warning, backup reminder

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 17:53:18 +02:00

74 lines
2.4 KiB
YAML

{{- if .Values.temporal.enabled }}
{{- if .Values.postgresql.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "postiz.fullname" . }}-temporal-init
labels:
{{- include "postiz.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
spec:
backoffLimit: 6
template:
metadata:
labels:
app.kubernetes.io/component: temporal-init
{{- include "postiz.selectorLabels" . | nindent 8 }}
spec:
restartPolicy: OnFailure
initContainers:
- name: wait-for-postgres
image: postgres:16-alpine
command:
- sh
- -c
- |
until pg_isready -h $PGHOST -p 5432 -U postgres; do
echo "Waiting for PostgreSQL..."; sleep 3
done
env:
- name: PGHOST
value: {{ printf "%s-postgresql" .Release.Name | quote }}
containers:
- name: create-temporal-user
image: postgres:16-alpine
command:
- sh
- -c
- |
export PGPASSWORD="$POSTGRES_PASSWORD"
psql -h "$PGHOST" -U postgres <<-SQL
DO \$\$ BEGIN
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = '$TEMPORAL_USER') THEN
EXECUTE format(
'CREATE ROLE %I WITH LOGIN PASSWORD %L CREATEDB',
'$TEMPORAL_USER',
'$TEMPORAL_PWD'
);
RAISE NOTICE 'Role $TEMPORAL_USER created.';
ELSE
RAISE NOTICE 'Role $TEMPORAL_USER already exists, skipping.';
END IF;
END \$\$;
SQL
env:
- name: PGHOST
value: {{ printf "%s-postgresql" .Release.Name | quote }}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ printf "%s-postgresql" .Release.Name | quote }}
key: postgres-password
- name: TEMPORAL_USER
value: {{ .Values.temporal.postgresql.user | quote }}
- name: TEMPORAL_PWD
valueFrom:
secretKeyRef:
name: {{ include "postiz.fullname" . }}-temporal-secret
key: POSTGRES_PWD
{{- end }}
{{- end }}