Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

fix(helm): apply the secret before the migration that authenticates with it

Petr Bauch5ab74d7010d2
diff --git a/deploy/remote/helm/switch/templates/common/secret.yaml b/deploy/remote/helm/switch/templates/common/secret.yaml
index 71ae3bf85..65c3558c5 100644
--- a/deploy/remote/helm/switch/templates/common/secret.yaml
+++ b/deploy/remote/helm/switch/templates/common/secret.yaml
@@ -1,10 +1,21 @@
{{- if not .Values.secrets.existingSecret }}
+# A hook, for the same reason as the database CA bundle: the pre-upgrade
+# migration Job reads POSTGRES_PASSWORD from here, and an ordinary resource is
+# not applied until the pre-upgrade hooks have already run. The migration would
+# authenticate with the password from the previous release — so an upgrade that
+# repoints the deployment at a different server could never succeed, because
+# the credentials for that server only land once the migration it blocks has
+# passed. It is left in place after the hook, not deleted with it.
apiVersion: v1
kind: Secret
metadata:
name: {{ include "switch.secretName" . }}
labels:
{{- include "switch.labels" . | nindent 4 }}
+ annotations:
+ "helm.sh/hook": pre-install,pre-upgrade
+ "helm.sh/hook-weight": "-5"
+ "helm.sh/hook-delete-policy": before-hook-creation
type: Opaque
data:
{{- if not .Values.postgresql.existingSecret }}