feat: ✨ add metrics and serviceMontior (#39)
This commit is contained in:
1 parent
0e94b4235a
commit
df62da4478
5 files changed
+101
-2
No files matched your search
@@ -1,4 +1,12 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/*
|
||||
Fail if command and metrics are set
|
||||
*/}}
|
||||
{{- if and .Values.image.command .Values.metrics.enabled }}
|
||||
{{- fail "Can't use custom command and metrics in combination. They are exclusive features" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
|
||||
@@ -39,10 +39,14 @@ spec:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{ if .Values.image.command }}
|
||||
{{ if and .Values.image.command (not .Values.metrics.enabled) }}
|
||||
command:
|
||||
{{- toYaml .Values.image.command | nindent 12 }}
|
||||
{{- end }}
|
||||
{{ if .Values.metrics.enabled }}
|
||||
command:
|
||||
{{- toYaml .Values.metrics.command | nindent 12 }}
|
||||
{{- end }}
|
||||
{{ if .Values.image.args }}
|
||||
args:
|
||||
{{- toYaml .Values.image.args | nindent 12 }}
|
||||
|
||||
@@ -40,7 +40,7 @@ spec:
|
||||
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: http
|
||||
- name: {{ .Values.service.name }}
|
||||
port: {{ .Values.service.port }}
|
||||
protocol: TCP
|
||||
targetPort: http
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
{{- if and .Values.metrics.serviceMonitor.enabled .Values.metrics.enabled }}
|
||||
---
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ include "jellyfin.fullname" . }}
|
||||
{{- if .Values.metrics.serviceMonitor.namespace }}
|
||||
namespace: {{ tpl .Values.metrics.serviceMonitor.namespace . }}
|
||||
{{- else }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "jellyfin.name" . }}
|
||||
helm.sh/chart: {{ include "jellyfin.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- with .Values.metrics.serviceMonitor.labels }}
|
||||
{{- tpl (toYaml . | nindent 4) $ }}
|
||||
{{- end }}
|
||||
spec:
|
||||
endpoints:
|
||||
- port: {{ .Values.service.name }}
|
||||
{{- with .Values.metrics.serviceMonitor.interval }}
|
||||
interval: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.metrics.serviceMonitor.scrapeTimeout }}
|
||||
scrapeTimeout: {{ . }}
|
||||
{{- end }}
|
||||
honorLabels: true
|
||||
path: {{ .Values.metrics.serviceMonitor.path }}
|
||||
scheme: {{ .Values.metrics.serviceMonitor.scheme }}
|
||||
{{- with .Values.metrics.serviceMonitor.tlsConfig }}
|
||||
tlsConfig:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- with .Values.metrics.serviceMonitor.relabelings }}
|
||||
relabelings:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- with .Values.metrics.serviceMonitor.metricRelabelings }}
|
||||
metricRelabelings:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
jobLabel: "{{ .Release.Name }}"
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "jellyfin.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- with .Values.metrics.serviceMonitor.targetLabels }}
|
||||
targetLabels:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in new issue
Block a user