Skip to content

Commit

Permalink
feat: add prometheus credentials to helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
holzgeist committed Feb 19, 2024
1 parent 7c0ffb2 commit 24ef91f
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
7 changes: 7 additions & 0 deletions livekit-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,10 @@ Create the name of the service monitor to use
{{- default "default" .Values.serviceMonitor.name }}
{{- end }}
{{- end }}

{{/*
Create the name of the service monitor secret to use
*/}}
{{- define "livekit-server.serviceMonitorSecretName" -}}
{{- print .Values.serviceMonitor.name "Secret" }}
{{- end }}
6 changes: 3 additions & 3 deletions livekit-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ spec:
hostPort: {{ .Values.livekit.rtc.tcp_port }}
protocol: TCP
{{- end }}
{{- if .Values.livekit.prometheus_port }}
{{- if and .Values.livekit.prometheus .Values.livekit.prometheus.port }}
- name: metrics
containerPort: {{ .Values.livekit.prometheus_port }}
hostPort: {{ .Values.livekit.prometheus_port }}
containerPort: {{ .Values.livekit.prometheus.port }}
hostPort: {{ .Values.livekit.prometheus.port }}
protocol: TCP
{{- end }}
{{- if .Values.livekit.turn.enabled }}
Expand Down
12 changes: 12 additions & 0 deletions livekit-server/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,15 @@ metadata:
data:
{{ .Values.livekit.key_file }}: {{ toYaml .Values.storeKeysInSecret.keys | b64enc }}
{{- end }}

{{- if and .Values.livekit.prometheus .Values.livekit.prometheus.username .Values.livekit.prometheus.password }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "livekit-server.serviceMonitorSecretName" . }}
labels:
{{- include "livekit-server.labels" . | nindent 4 }}
data:
username: {{ .Values.livekit.prometheus.username | b64enc }}
password: {{ .Values.livekit.prometheus.password | b64enc }}
{{- end }}
4 changes: 2 additions & 2 deletions livekit-server/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ spec:
protocol: UDP
targetPort: rtc-udp
{{- end }}
{{- if .Values.livekit.prometheus_port }}
- port: {{ .Values.livekit.prometheus_port }}
{{- if and .Values.livekit.prometheus .Values.livekit.prometheus.port }}
- port: {{ .Values.livekit.prometheus.port }}
targetPort: metrics
protocol: TCP
name: metrics
Expand Down
11 changes: 10 additions & 1 deletion livekit-server/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.serviceMonitor.create .Values.livekit.prometheus_port -}}
{{- if and .Values.serviceMonitor.create .Values.livekit.prometheus.port -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
Expand All @@ -14,6 +14,15 @@ spec:
- port: metrics
path: /
interval: {{ .Values.serviceMonitor.interval }}
{{- if and (not .Values.storeKeysInSecret.existingSecret) .Values.storeKeysInSecret.enabled }}
basicAuth:
password:
name: {{ include "livekit-server.serviceMonitorSecretName" . }}
key: password
username:
name: {{ include "livekit-server.serviceMonitorSecretName" . }}
key: username
{{- end}}
selector:
matchLabels:
{{- include "livekit-server.selectorLabels" . | nindent 6 }}
Expand Down

0 comments on commit 24ef91f

Please sign in to comment.