temporalio / helm-charts

Temporal Helm charts
MIT License
305 stars 335 forks source link

[Bug] Postgres/MySQL databases are not provisioned on fresh install #523

Closed ogusak closed 3 months ago

ogusak commented 3 months ago

What are you really trying to do?

Install temporal with helm chart configured with sql/Postgres persistent storage

Describe the bug

Configured helm values file using example for Postgres. After running helm deploy noticed that container for temporal-schema-setup is in a crash loop. Logs say cannot connect to database <>. Database does not exist

Looking at the helm chart, noticed that in server-job.yaml a create-default-store and create-visibility-store init containers should be created.

Generated complete manifest with helm template -f my_values.yaml . and noticed that initContainers section is empty (contains [] only)

Minimal Reproduction

Using example values file for Postgres, generate deployment manifests with:

helm template . -f values/values.postgresql.yaml --debug > test.yaml

Inspect section # Source: temporal/templates/server-job.yaml which shows no initContainers were generated

# Source: temporal/templates/server-job.yaml
apiVersion: batch/v1
kind: Job
metadata:
  name: release-name-temporal-schema-setup
  labels:
    app.kubernetes.io/name: temporal
    helm.sh/chart: temporal-0.43.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: 1.24.2
    app.kubernetes.io/component: database
    app.kubernetes.io/part-of: temporal
  annotations:
    "helm.sh/hook": pre-install
    "helm.sh/hook-weight": "0"
    "helm.sh/hook-delete-policy": hook-succeeded,hook-failed
spec:
  backoffLimit: 100
  template:
    metadata:
      name: release-name-temporal-schema-setup
      labels:
        app.kubernetes.io/name: temporal
        helm.sh/chart: temporal-0.43.0
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/instance: release-name
        app.kubernetes.io/version: 1.24.2
        app.kubernetes.io/component: database
        app.kubernetes.io/part-of: temporal
    spec:

      restartPolicy: "OnFailure"
      initContainers:
          []
      containers:
        - name: default-schema
      ....

Environment/Versions

Additional context

This bug was introduced with new Helm release when Values.schema.createDatabase.enabled variable was added: https://github.com/temporalio/helm-charts/commit/f6e0e3aae1b4df067526d989d2e2e86e8c4e1490