Skip to content

Commit b3a8e5f

Browse files
committed
feat: Add Prometheus monitoring for ingress and egress
1 parent a9d295a commit b3a8e5f

File tree

8 files changed

+92
-2
lines changed

8 files changed

+92
-2
lines changed

egress/templates/_helpers.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,14 @@ Create the name of the service account to use
6060
{{- default "default" .Values.serviceAccount.name }}
6161
{{- end }}
6262
{{- end }}
63+
64+
{{/*
65+
Create the name of the pod monitor to use
66+
*/}}
67+
{{- define "egress.podMonitorName" -}}
68+
{{- if .Values.podMonitor.create }}
69+
{{- default (include "egress.fullname" .) .Values.podMonitor.name }}
70+
{{- else }}
71+
{{- default "default" .Values.podMonitor.name }}
72+
{{- end }}
73+
{{- end }}

egress/templates/podmonitor.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{{- if and .Values.podMonitor.create .Values.egress.prometheus_port -}}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: PodMonitor
4+
metadata:
5+
name: {{ include "egress.podMonitorName" . }}
6+
labels:
7+
{{- include "egress.labels" . | nindent 4 }}
8+
{{- with .Values.podMonitor.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
spec:
13+
endpoints:
14+
- port: metrics
15+
path: /
16+
interval: {{ .Values.podMonitor.interval }}
17+
selector:
18+
matchLabels:
19+
{{- include "egress.selectorLabels" . | nindent 6 }}
20+
{{- end }}

egress/values.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,14 @@ securityContext: {}
4141
tolerations: []
4242

4343
affinity: {}
44+
45+
podMonitor:
46+
# Specifies whether a service monitor should be created
47+
create: false
48+
# Annotations to add to the service monitor
49+
annotations: {}
50+
# The name of the service monitor to use.
51+
# If not set and create is true, a name is generated using the fullname template
52+
name: ""
53+
# The scrape interval
54+
interval: 30s

ingress/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: ingress
33
description: Ingress is used by LiveKit to ingest streams produced by external workflows
44
type: application
5-
version: 1.4.4
5+
version: 1.4.3
66
appVersion: "v1.4.3"
77

88
sources:

ingress/templates/_helpers.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,14 @@ Create the name of the service account to use
6060
{{- default "default" .Values.serviceAccount.name }}
6161
{{- end }}
6262
{{- end }}
63+
64+
{{/*
65+
Create the name of the service monitor to use
66+
*/}}
67+
{{- define "ingress.serviceMonitorName" -}}
68+
{{- if .Values.serviceMonitor.create }}
69+
{{- default (include "ingress.fullname" .) .Values.serviceMonitor.name }}
70+
{{- else }}
71+
{{- default "default" .Values.serviceMonitor.name }}
72+
{{- end }}
73+
{{- end }}

ingress/templates/service.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ spec:
2222
- port: {{ .Values.ingress.whipPort }}
2323
protocol: TCP
2424
name: whip
25-
25+
{{- end }}
26+
{{- if .Values.ingress.prometheus_port }}
27+
- port: {{ .Values.ingress.prometheus_port }}
28+
targetPort: metrics
29+
protocol: TCP
30+
name: metrics
31+
{{- end }}
2632
selector:
2733
{{- include "ingress.selectorLabels" . | nindent 4 }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{{- if and .Values.serviceMonitor.create .Values.ingress.prometheus_port -}}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: ServiceMonitor
4+
metadata:
5+
name: {{ include "ingress.serviceMonitorName" . }}
6+
labels:
7+
{{- include "ingress.labels" . | nindent 4 }}
8+
{{- with .Values.serviceMonitor.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
spec:
13+
endpoints:
14+
- port: metrics
15+
path: /
16+
interval: {{ .Values.serviceMonitor.interval }}
17+
selector:
18+
matchLabels:
19+
{{- include "ingress.selectorLabels" . | nindent 6 }}
20+
{{- end }}

ingress/values.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,14 @@ securityContext: {}
6161
tolerations: []
6262

6363
affinity: {}
64+
65+
serviceMonitor:
66+
# Specifies whether a service monitor should be created
67+
create: false
68+
# Annotations to add to the service monitor
69+
annotations: {}
70+
# The name of the service monitor to use.
71+
# If not set and create is true, a name is generated using the fullname template
72+
name: ""
73+
# The scrape interval
74+
interval: 30s

0 commit comments

Comments
 (0)