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: */}}
|
{{/* 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.
|
Expand the name of the chart.
|
||||||
*/}}
|
*/}}
|
||||||
|
|||||||
@@ -39,10 +39,14 @@ spec:
|
|||||||
- name: {{ .Chart.Name }}
|
- name: {{ .Chart.Name }}
|
||||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
{{ if .Values.image.command }}
|
{{ if and .Values.image.command (not .Values.metrics.enabled) }}
|
||||||
command:
|
command:
|
||||||
{{- toYaml .Values.image.command | nindent 12 }}
|
{{- toYaml .Values.image.command | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{ if .Values.metrics.enabled }}
|
||||||
|
command:
|
||||||
|
{{- toYaml .Values.metrics.command | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
{{ if .Values.image.args }}
|
{{ if .Values.image.args }}
|
||||||
args:
|
args:
|
||||||
{{- toYaml .Values.image.args | nindent 12 }}
|
{{- toYaml .Values.image.args | nindent 12 }}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ spec:
|
|||||||
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
|
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: {{ .Values.service.name }}
|
||||||
port: {{ .Values.service.port }}
|
port: {{ .Values.service.port }}
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: http
|
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 }}
|
||||||
@@ -18,6 +18,7 @@ fullnameOverride: ""
|
|||||||
enableDLNA: false
|
enableDLNA: false
|
||||||
|
|
||||||
service:
|
service:
|
||||||
|
name: http
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
port: 8096
|
port: 8096
|
||||||
## Specify the nodePort value for the LoadBalancer and NodePort service types.
|
## Specify the nodePort value for the LoadBalancer and NodePort service types.
|
||||||
@@ -38,6 +39,41 @@ service:
|
|||||||
## Set the externalTrafficPolicy in the Service to either Cluster or Local
|
## Set the externalTrafficPolicy in the Service to either Cluster or Local
|
||||||
# externalTrafficPolicy: Cluster
|
# externalTrafficPolicy: Cluster
|
||||||
|
|
||||||
|
# -- Configuration for metrics collection and monitoring
|
||||||
|
metrics:
|
||||||
|
# -- Enable or disable metrics collection
|
||||||
|
enabled: false
|
||||||
|
command:
|
||||||
|
- bash
|
||||||
|
- '-c'
|
||||||
|
- >-
|
||||||
|
sed 's,<EnableMetrics>false</EnableMetrics>,<EnableMetrics>true</EnableMetrics>,' -i /config/config/system.xml &&
|
||||||
|
/jellyfin/jellyfin
|
||||||
|
# -- Configuration for the Prometheus ServiceMonitor
|
||||||
|
serviceMonitor:
|
||||||
|
# -- Enable or disable the creation of a ServiceMonitor resource
|
||||||
|
enabled: false
|
||||||
|
# -- Namespace where the ServiceMonitor resource should be created. Defaults to Release.Namespace
|
||||||
|
namespace: ''
|
||||||
|
# -- Labels to add to the ServiceMonitor resource
|
||||||
|
labels: {}
|
||||||
|
# -- Interval at which metrics should be scraped
|
||||||
|
interval: 30s
|
||||||
|
# -- Timeout for scraping metrics
|
||||||
|
scrapeTimeout: 30s
|
||||||
|
# -- Path to scrape for metrics
|
||||||
|
path: /metrics
|
||||||
|
# -- Scheme to use for scraping metrics (http or https)
|
||||||
|
scheme: http
|
||||||
|
# -- TLS configuration for scraping metrics
|
||||||
|
tlsConfig: {}
|
||||||
|
# -- Relabeling rules for the scraped metrics
|
||||||
|
relabelings: []
|
||||||
|
# -- Relabeling rules for the metrics before ingestion
|
||||||
|
metricRelabelings: []
|
||||||
|
# -- Target labels to add to the scraped metrics
|
||||||
|
targetLabels: []
|
||||||
|
|
||||||
ingress:
|
ingress:
|
||||||
enabled: false
|
enabled: false
|
||||||
labels: {}
|
labels: {}
|
||||||
|
|||||||
Reference in new issue
Block a user