From d994ede38a79c7473c74e6d4ad2bcc979a2ebb22 Mon Sep 17 00:00:00 2001 From: Marcel Date: Mon, 20 Mar 2023 17:02:04 +0000 Subject: [PATCH 1/6] matrix-media-repo: Add a Podmonitor file --- .../templates/podmonitor.yaml | 20 +++++++++++++++++++ charts/matrix-media-repo/values.yaml | 9 +++++++++ 2 files changed, 29 insertions(+) create mode 100644 charts/matrix-media-repo/templates/podmonitor.yaml diff --git a/charts/matrix-media-repo/templates/podmonitor.yaml b/charts/matrix-media-repo/templates/podmonitor.yaml new file mode 100644 index 0000000..31a55e4 --- /dev/null +++ b/charts/matrix-media-repo/templates/podmonitor.yaml @@ -0,0 +1,20 @@ +{{- if .Values.podmonitor.enabled }} +--- +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: {{ include "matrix-media-repo.fullname" . }} + labels: + {{- include "matrix-media-repo.labels" . | nindent 4 }} +spec: + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + podMetricsEndpoints: + - {{- if .Values.serviceAccount.create }}interval: {{ Values.podmonitor.interval | default "30s"}}{{- end }} + path: /metrics + port: metrics + selector: + matchLabels: + {{- include "matrix-media-repo.selectorLabels" . | nindent 6 }} +{{- end }} \ No newline at end of file diff --git a/charts/matrix-media-repo/values.yaml b/charts/matrix-media-repo/values.yaml index da96af8..0f7f355 100644 --- a/charts/matrix-media-repo/values.yaml +++ b/charts/matrix-media-repo/values.yaml @@ -214,6 +214,15 @@ autoscaling: targetCPUUtilizationPercentage: 80 # targetMemoryUtilizationPercentage: 80 +## Configure a PodMonitor definition for the application. +## Requires the Prometheus Operator +## +podmonitor: + enabled: false + ## Set the crawl interval (optional) + ## Otherwise uses the default setting set in prometheus + # interval: 30s + ## Node selectors to use when deploying the application. ## nodeSelector: {} From 397d007af62de8dfd1f0cbb36555019b52988f84 Mon Sep 17 00:00:00 2001 From: Marcel Date: Mon, 20 Mar 2023 17:04:40 +0000 Subject: [PATCH 2/6] matrix-media-repo: Fix typo in podmonitor.yaml --- charts/matrix-media-repo/templates/podmonitor.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/matrix-media-repo/templates/podmonitor.yaml b/charts/matrix-media-repo/templates/podmonitor.yaml index 31a55e4..ccbc7ac 100644 --- a/charts/matrix-media-repo/templates/podmonitor.yaml +++ b/charts/matrix-media-repo/templates/podmonitor.yaml @@ -11,7 +11,7 @@ spec: matchNames: - {{ .Release.Namespace }} podMetricsEndpoints: - - {{- if .Values.serviceAccount.create }}interval: {{ Values.podmonitor.interval | default "30s"}}{{- end }} + - {{- if .Values.serviceAccount.create }}interval: {{ .Values.podmonitor.interval | default "30s"}}{{- end }} path: /metrics port: metrics selector: From f721c1c8e4215547e00a77beb5d8919acf6c3b90 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 21 Mar 2023 14:05:48 +0000 Subject: [PATCH 3/6] matrix-media-repo: Add metrics port to port list --- charts/matrix-media-repo/templates/deployment.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/charts/matrix-media-repo/templates/deployment.yaml b/charts/matrix-media-repo/templates/deployment.yaml index cde272b..e183681 100644 --- a/charts/matrix-media-repo/templates/deployment.yaml +++ b/charts/matrix-media-repo/templates/deployment.yaml @@ -61,6 +61,9 @@ spec: - name: http containerPort: 8000 protocol: TCP + - name: metrics + containerPort: 9000 + protocol: TCP livenessProbe: httpGet: path: /healthz From 0456b8594d179d8317e3dae377705a22f7c6e424 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 21 Mar 2023 17:30:42 +0000 Subject: [PATCH 4/6] matrix-media-repo: Fix incorrect if case for the podmonitor interval setting --- charts/matrix-media-repo/templates/podmonitor.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/matrix-media-repo/templates/podmonitor.yaml b/charts/matrix-media-repo/templates/podmonitor.yaml index ccbc7ac..04a48d0 100644 --- a/charts/matrix-media-repo/templates/podmonitor.yaml +++ b/charts/matrix-media-repo/templates/podmonitor.yaml @@ -11,7 +11,7 @@ spec: matchNames: - {{ .Release.Namespace }} podMetricsEndpoints: - - {{- if .Values.serviceAccount.create }}interval: {{ .Values.podmonitor.interval | default "30s"}}{{- end }} + - {{- if .Values.podmonitor.interval }}interval: {{ .Values.podmonitor.interval | default "30s"}}{{- end }} path: /metrics port: metrics selector: From 6b0d9c0fd449ec2ea1250b8755b961aecf0cf8dd Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 21 Mar 2023 18:50:38 +0000 Subject: [PATCH 5/6] matrix-media-repo: Remove unused default and reposition interval key --- charts/matrix-media-repo/templates/podmonitor.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/matrix-media-repo/templates/podmonitor.yaml b/charts/matrix-media-repo/templates/podmonitor.yaml index 04a48d0..eb50c30 100644 --- a/charts/matrix-media-repo/templates/podmonitor.yaml +++ b/charts/matrix-media-repo/templates/podmonitor.yaml @@ -11,9 +11,9 @@ spec: matchNames: - {{ .Release.Namespace }} podMetricsEndpoints: - - {{- if .Values.podmonitor.interval }}interval: {{ .Values.podmonitor.interval | default "30s"}}{{- end }} - path: /metrics + - path: /metrics port: metrics + {{- if .Values.podmonitor.interval }}interval: {{ .Values.podmonitor.interval }}{{- end }} selector: matchLabels: {{- include "matrix-media-repo.selectorLabels" . | nindent 6 }} From cd78a3b4230483ae971e0223b6788f0ebbe5afb2 Mon Sep 17 00:00:00 2001 From: Marcel Date: Fri, 7 Apr 2023 15:32:38 +0000 Subject: [PATCH 6/6] matrix-media-repo: Fix rendered indentation in matrix-media-repo --- charts/matrix-media-repo/templates/podmonitor.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/matrix-media-repo/templates/podmonitor.yaml b/charts/matrix-media-repo/templates/podmonitor.yaml index eb50c30..d7267d1 100644 --- a/charts/matrix-media-repo/templates/podmonitor.yaml +++ b/charts/matrix-media-repo/templates/podmonitor.yaml @@ -13,7 +13,7 @@ spec: podMetricsEndpoints: - path: /metrics port: metrics - {{- if .Values.podmonitor.interval }}interval: {{ .Values.podmonitor.interval }}{{- end }} + {{ if .Values.podmonitor.interval }}interval: {{ .Values.podmonitor.interval }}{{ end }} selector: matchLabels: {{- include "matrix-media-repo.selectorLabels" . | nindent 6 }}