From 9fcb3dc2e080308ffb3186562279f41a136f48ce Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Thu, 31 Jul 2025 19:50:25 +0100 Subject: [PATCH] feat: update cluster key handling for KEDA compatibility in authorization middleware and Helm chart --- Common/Server/Middleware/ClusterKeyAuthorization.ts | 3 +++ HelmChart/Public/oneuptime/templates/_helpers.tpl | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Common/Server/Middleware/ClusterKeyAuthorization.ts b/Common/Server/Middleware/ClusterKeyAuthorization.ts index 9ffd7ad6a9..bd79a00464 100644 --- a/Common/Server/Middleware/ClusterKeyAuthorization.ts +++ b/Common/Server/Middleware/ClusterKeyAuthorization.ts @@ -38,6 +38,9 @@ export default class ClusterKeyAuthorization { } else if (req.headers && req.headers["clusterkey"]) { // Header keys are automatically transformed to lowercase clusterKey = req.headers["clusterkey"] as string; + } else if (req.headers && req.headers["x-clusterkey"]) { + // KEDA TriggerAuthentication sends headers with X- prefix + clusterKey = req.headers["x-clusterkey"] as string; } else if (req.body && req.body.clusterKey) { clusterKey = req.body.clusterKey; } else { diff --git a/HelmChart/Public/oneuptime/templates/_helpers.tpl b/HelmChart/Public/oneuptime/templates/_helpers.tpl index ba103704a0..b6285ded2b 100644 --- a/HelmChart/Public/oneuptime/templates/_helpers.tpl +++ b/HelmChart/Public/oneuptime/templates/_helpers.tpl @@ -750,14 +750,14 @@ metadata: appname: oneuptime spec: secretTargetRef: - {{- if .Values.oneuptimeSecret }} - - parameter: clusterkey - name: {{ printf "%s-%s" .Release.Name "secrets" }} - key: oneuptime-secret - {{- else if .Values.externalSecrets.oneuptimeSecret.existingSecret.name }} - - parameter: clusterkey + {{- if .Values.externalSecrets.oneuptimeSecret.existingSecret.name }} + - parameter: X-clusterkey name: {{ .Values.externalSecrets.oneuptimeSecret.existingSecret.name }} key: {{ .Values.externalSecrets.oneuptimeSecret.existingSecret.passwordKey }} + {{- else }} + - parameter: X-clusterkey + name: {{ printf "%s-%s" .Release.Name "secrets" }} + key: oneuptime-secret {{- end }} {{- end }} {{- end }}