From d6811430383044eb3342b2a0a67b40f4f3735b6e Mon Sep 17 00:00:00 2001 From: Ian Stanton Date: Wed, 22 May 2024 12:46:46 -0400 Subject: [PATCH] Add Template for Prometheus URL (#38) * Add template for prometheus URL Signed-off-by: Ian Stanton * Fix template Signed-off-by: Ian Stanton --------- Signed-off-by: Ian Stanton --- .../templates/dataplane-webserver/_helpers.tpl | 14 ++++++++++++++ .../templates/dataplane-webserver/deployment.yaml | 2 ++ 2 files changed, 16 insertions(+) diff --git a/charts/tembo/templates/dataplane-webserver/_helpers.tpl b/charts/tembo/templates/dataplane-webserver/_helpers.tpl index 9eea0ff..2d4945d 100644 --- a/charts/tembo/templates/dataplane-webserver/_helpers.tpl +++ b/charts/tembo/templates/dataplane-webserver/_helpers.tpl @@ -60,3 +60,17 @@ Create the name of the service account to use {{- default "default" .Values.dataplaneWebserver.serviceAccount.name }} {{- end }} {{- end }} + +{{/* +Prometheus Service Prefix +*/}} +{{- define "dataplaneWebserver.prometheusServicePrefix" -}} +{{- printf "%s-kube-prometheus-stack" .Release.Name | trunc 26 | trimSuffix "-" }} +{{- end }} + +{{/* +Prometheus URL +*/}} +{{- define "dataplaneWebserver.prometheusUrl" -}} +{{- printf "http://%s-prometheus.%s.svc.cluster.local:9090" (include "dataplaneWebserver.prometheusServicePrefix" .) .Release.Namespace }} +{{- end }} diff --git a/charts/tembo/templates/dataplane-webserver/deployment.yaml b/charts/tembo/templates/dataplane-webserver/deployment.yaml index fd0d37b..d6293cc 100644 --- a/charts/tembo/templates/dataplane-webserver/deployment.yaml +++ b/charts/tembo/templates/dataplane-webserver/deployment.yaml @@ -41,6 +41,8 @@ spec: env: - name: RUST_LOG value: {{ .Values.dataplaneWebserver.logLevel }} + - name: PROMETHEUS_URL + value: {{ include "dataplaneWebserver.prometheusUrl" . }} {{- if .Values.dataplaneWebserver.env }}{{ .Values.dataplaneWebserver.env | default list | toYaml | nindent 10 }}{{- end }} securityContext: {{- toYaml .Values.dataplaneWebserver.securityContext | nindent 12 }}