Skip to content

Commit

Permalink
Add Template for Prometheus URL (#38)
Browse files Browse the repository at this point in the history
* Add template for prometheus URL

Signed-off-by: Ian Stanton <ian@tembo.io>

* Fix template

Signed-off-by: Ian Stanton <ian@tembo.io>

---------

Signed-off-by: Ian Stanton <ian@tembo.io>
  • Loading branch information
ianstanton authored May 22, 2024
1 parent 516269b commit d681143
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions charts/tembo/templates/dataplane-webserver/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 2 additions & 0 deletions charts/tembo/templates/dataplane-webserver/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down

0 comments on commit d681143

Please sign in to comment.