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): create the CA bundle before the migration that mounts it

Petr Bauchc38f605f8d7d
diff --git a/deploy/remote/helm/switch/templates/common/db-ca-configmap.yaml b/deploy/remote/helm/switch/templates/common/db-ca-configmap.yaml
index 12e0af311..7ba785d93 100644
--- a/deploy/remote/helm/switch/templates/common/db-ca-configmap.yaml
+++ b/deploy/remote/helm/switch/templates/common/db-ca-configmap.yaml
@@ -1,11 +1,23 @@
{{- if and .Values.postgresql.caBundle.contents (not .Values.postgresql.caBundle.existingConfigMap) }}
# Certificate authorities, not a secret: a CA bundle is public by construction.
+#
+# A hook, because the pre-upgrade migration Job mounts it, and an ordinary
+# resource is not created until after the pre-upgrade hooks have run — the Job
+# would wait for a ConfigMap that only appears once the Job it is blocking has
+# finished. A negative weight puts it before the migration; before-hook-creation
+# without hook-succeeded leaves it in place afterwards, which it has to be,
+# since switch-core, Mattermost and the backup release mount it for the life of
+# the release.
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "switch.fullname" . }}-db-ca
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
data:
{{ .Values.postgresql.caBundle.key }}: |
{{ .Values.postgresql.caBundle.contents | indent 4 }}