From 3877145e4acb75d511a2ccf87f13babdd2bb8e47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Goinvic?= Date: Tue, 19 May 2026 14:34:07 +0200 Subject: [PATCH] Hookshot: Fix mounting its appservice registration file into Synapse --- .../templates/hookshot/_helpers.tpl | 7 +++++- .../templates/hookshot/hookshot_secret.yaml | 2 +- .../hookshot/hookshot_secret_hook.yaml | 24 +++++++++++++++++++ .../templates/synapse/_synapse_details.tpl | 12 ++++++++++ newsfragments/1329.fixed.md | 1 + 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 charts/matrix-stack/templates/hookshot/hookshot_secret_hook.yaml create mode 100644 newsfragments/1329.fixed.md diff --git a/charts/matrix-stack/templates/hookshot/_helpers.tpl b/charts/matrix-stack/templates/hookshot/_helpers.tpl index 4c1eb25f..19c646a5 100644 --- a/charts/matrix-stack/templates/hookshot/_helpers.tpl +++ b/charts/matrix-stack/templates/hookshot/_helpers.tpl @@ -55,8 +55,13 @@ app.kubernetes.io/version: {{ include "element-io.ess-library.labels.makeSafe" . {{- define "element-io.hookshot.secret-name" -}} {{- $root := .root -}} {{- with required "element-io.hookshot.secret-name requires context" .context -}} +{{- $isHook := .isHook }} +{{- if $isHook -}} +{{ $root.Release.Name }}-hookshot-pre +{{- else -}} {{ $root.Release.Name }}-hookshot -{{- end -}} +{{- end }} +{{- end }} {{- end }} diff --git a/charts/matrix-stack/templates/hookshot/hookshot_secret.yaml b/charts/matrix-stack/templates/hookshot/hookshot_secret.yaml index 382610aa..b8f6b3d4 100644 --- a/charts/matrix-stack/templates/hookshot/hookshot_secret.yaml +++ b/charts/matrix-stack/templates/hookshot/hookshot_secret.yaml @@ -9,7 +9,7 @@ SPDX-License-Identifier: AGPL-3.0-only apiVersion: v1 kind: Secret metadata: - name: {{ $.Release.Name }}-hookshot + name: {{ include "element-io.hookshot.secret-name" (dict "root" $ "context" (dict "isHook" false)) }} namespace: {{ $.Release.Namespace }} labels: {{- include "element-io.hookshot.labels" (dict "root" $ "context" .) | nindent 4 }} diff --git a/charts/matrix-stack/templates/hookshot/hookshot_secret_hook.yaml b/charts/matrix-stack/templates/hookshot/hookshot_secret_hook.yaml new file mode 100644 index 00000000..e5edcdd0 --- /dev/null +++ b/charts/matrix-stack/templates/hookshot/hookshot_secret_hook.yaml @@ -0,0 +1,24 @@ +{{- /* +Copyright 2026 Element Creations Ltd + +SPDX-License-Identifier: AGPL-3.0-only +*/ -}} + +{{- with $.Values.hookshot -}} +{{- if .enabled -}} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "element-io.hookshot.secret-name" (dict "root" $ "context" (dict "isHook" true)) }} + namespace: {{ $.Release.Namespace }} + labels: + {{- include "element-io.hookshot.labels" (dict "root" $ "context" .) | nindent 4 }} + "k8s.element.io/hook-for": "synapse-check-config" + annotations: + "helm.sh/hook": pre-install,pre-upgrade + "helm.sh/hook-weight": "-1" +type: Opaque +data: +{{- include "element-io.hookshot.secret-data" (dict "root" $ "context" .) | nindent 2 }} +{{- end -}} +{{- end -}} diff --git a/charts/matrix-stack/templates/synapse/_synapse_details.tpl b/charts/matrix-stack/templates/synapse/_synapse_details.tpl index 3e1066ca..2941e2f8 100644 --- a/charts/matrix-stack/templates/synapse/_synapse_details.tpl +++ b/charts/matrix-stack/templates/synapse/_synapse_details.tpl @@ -182,6 +182,18 @@ responsibleForMedia {{- end }} {{- end }} {{- end }} +{{- with $root.Values.hookshot -}} + {{- if .enabled }} + {{- with .appserviceRegistration }} + {{- with .value }} + {{- $configSecrets = append $configSecrets (include "element-io.hookshot.secret-name" (dict "root" $root "context" (dict "isHook" $isHook))) -}} + {{- end }} + {{- with .secret }} + {{- $configSecrets = append $configSecrets (tpl . $root) -}} + {{- end }} + {{- end }} + {{- end }} +{{- end }} {{ $configSecrets | uniq | toJson }} {{- end }} {{- end }} diff --git a/newsfragments/1329.fixed.md b/newsfragments/1329.fixed.md new file mode 100644 index 00000000..327c98f4 --- /dev/null +++ b/newsfragments/1329.fixed.md @@ -0,0 +1 @@ +Fix an issue where a custom appservice registration file configured for Hookshot would not be mounted properly into Synapse pods.