From 2963ce58991d4e40631a96dbeae3af884834d28c Mon Sep 17 00:00:00 2001 From: Alvaro Iradier Date: Mon, 3 Jul 2023 18:35:39 +0200 Subject: [PATCH] Use sysdig.apiEndpoint to compute the NATS Url --- charts/admission-controller/templates/_helpers.tpl | 11 +++++++++++ .../templates/webhook/configmap.yaml | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/charts/admission-controller/templates/_helpers.tpl b/charts/admission-controller/templates/_helpers.tpl index 7c9b5de4e..70a6f2bc2 100644 --- a/charts/admission-controller/templates/_helpers.tpl +++ b/charts/admission-controller/templates/_helpers.tpl @@ -131,6 +131,17 @@ Determine Secure endpoint based on provided region or .Values.sysdig.apiEndpoint {{- end -}} {{- end -}} +{{/* +Sysdig NATS service URL +*/}} +{{- define "admissionController.natsUrl" -}} +{{- if .Values.webhook.v2.nats.url -}} + {{- .Values.webhook.v2.nats.url -}} +{{- else -}} + wss://{{ include "admissionController.apiEndpoint" . }}:443 +{{- end -}} +{{- end -}} + {{/* Common labels diff --git a/charts/admission-controller/templates/webhook/configmap.yaml b/charts/admission-controller/templates/webhook/configmap.yaml index 376e14521..d00ea452c 100644 --- a/charts/admission-controller/templates/webhook/configmap.yaml +++ b/charts/admission-controller/templates/webhook/configmap.yaml @@ -22,6 +22,6 @@ data: {{- if .Values.features.kspmAdmissionController}} SERVICE_PORT: "{{.Values.webhook.v2.container.port}}" CERT_LOCATION: /cert - EXTERNAL_NATS_URL: "wss://{{required "Nats URL is missing" .Values.webhook.v2.nats.url }}:443" + EXTERNAL_NATS_URL: {{ include "admissionController.natsUrl" . }} NATS_INSECURE: "{{.Values.webhook.v2.nats.insecure}}" {{- end}}