Skip to content

Commit

Permalink
feat(jvb): add option to enable prometheus metrics sidecar for jvb (#6)
Browse files Browse the repository at this point in the history
* add option to enable metrics sidecar for jvb

* bump chart version

* remove targetPort for metrics-service

* enable service for metrics only when metrics enabled

* add readinessProbe to metrics container
  • Loading branch information
0x46616c6b authored May 5, 2021
1 parent fc288f9 commit f3f6208
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 0.1.2
version: 0.1.3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ Parameter | Description | Default
`jvb.xmpp.password` | Password used by jvb to authenticate on the XMPP service | 10 random chars
`jvb.livenessProbe` | Map that holds the liveness probe, you can add parameters such as timeout or retries following the Kubernetes spec | A livenessProbe map
`jvb.readinessProbe` | Map that holds the liveness probe, you can add parameters such as timeout or retries following the Kubernetes spec | A readinessProbe map
`jvb.metrics.enabled` | Boolean that control the metrics exporter for jvb. If true the `ServiceMonitor` will also created | `false`
`jvb.metrics.image.repository` | Default image repository for metrics exporter | `docker.io/systemli/prometheus-jitsi-meet-exporter`
`jvb.metrics.image.tag` | Default tag for metrics exporter | `1.1.5`
`jvb.metrics.image.pullPolicy` | ImagePullPolicy for metrics exporter | `IfNotPresent`
`jvb.metrics.serviceMonitor.enabled` | `ServiceMonitor` for Prometheus | `true`
`jvb.metrics.serviceMonitor.selector` | Selector for `ServiceMonitor` | `{ release: prometheus-operator }`
`jvb.metrics.serviceMonitor.interval` | Interval for `ServiceMonitor` | `10s`
`jvb.metrics.resources` | Resources for the metrics container | `{ requests: { cpu: 10m, memory: 16Mi }, limits: { cpu: 20m, memory: 32Mi } }`
`web.httpsEnabled` | Boolean that enabled tls-termination on the web pods. Useful if you expose the UI via a `Loadbalancer` IP instead of an ingress | `false`
`web.httpRedirect` | Boolean that enabled http-to-https redirection. Useful for ingress that don't support this feature (ex: GKE ingress) | `false`
`web.extraEnvs` | Map containing additional environment variable to web pods | '{}'
Expand Down
3 changes: 3 additions & 0 deletions templates/jvb/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ data:
{{ $key }}: {{ tpl $value $ | quote }}
{{- end }}
{{- end }}
{{- if .Values.jvb.metrics.enabled }}
JVB_ENABLE_APIS: 'rest,colibri'
{{- end }}
24 changes: 24 additions & 0 deletions templates/jvb/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,30 @@ spec:
resources:
{{- toYaml .Values.jvb.resources | nindent 12 }}

{{- if .Values.jvb.metrics.enabled }}
- name: metrics
image: {{ .Values.jvb.metrics.image.repository }}:{{ .Values.jvb.metrics.image.tag }}
imagePullPolicy: {{ .Values.jvb.metrics.image.pullPolicy }}
securityContext:
runAsUser: 10001
command:
- /prometheus-jitsi-meet-exporter
- -videobridge-url
- http://localhost:8080/colibri/stats
ports:
- containerPort: 9888
name: metrics
protocol: TCP
readinessProbe:
httpGet:
path: /health
port: 9888
initialDelaySeconds: 3
periodSeconds: 5
resources:
{{- toYaml .Values.jvb.metrics.resources | nindent 12 }}
{{- end }}

{{- with .Values.jvb.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
23 changes: 23 additions & 0 deletions templates/jvb/metrics-prometheus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if and (.Values.jvb.metrics.enabled) (.Values.jvb.metrics.serviceMonitor.enabled) }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "jitsi-meet.jvb.fullname" . }}
labels:
{{- include "jitsi-meet.jvb.labels" . | nindent 4 }}
{{- range $key, $value := .Values.jvb.metrics.serviceMonitor.selector }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
endpoints:
- port: metrics
{{- if .Values.jvb.metrics.serviceMonitor.interval }}
interval: {{ .Values.jvb.metrics.serviceMonitor.interval }}
{{- end }}
selector:
matchLabels:
{{- include "jitsi-meet.jvb.labels" . | nindent 6 }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
{{- end -}}
16 changes: 16 additions & 0 deletions templates/jvb/metrics-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.jvb.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "jitsi-meet.jvb.fullname" . }}-metrics
labels:
{{- include "jitsi-meet.jvb.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- port: 9888
protocol: TCP
name: metrics
selector:
{{- include "jitsi-meet.jvb.selectorLabels" . | nindent 4 }}
{{- end }}
19 changes: 19 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,25 @@ jvb:
affinity: {}
extraEnvs: {}

metrics:
enabled: false
image:
repository: docker.io/systemli/prometheus-jitsi-meet-exporter
tag: 1.1.6
pullPolicy: IfNotPresent
serviceMonitor:
enabled: true
selector:
release: prometheus-operator
interval: 10s
resources:
requests:
cpu: 10m
memory: 16Mi
limits:
cpu: 20m
memory: 32Mi

serviceAccount:
# Specifies whether a service account should be created
create: true
Expand Down

0 comments on commit f3f6208

Please sign in to comment.