From 5c3fc7678a29788d92e56d5979693ef91fac5b24 Mon Sep 17 00:00:00 2001 From: mpw Date: Fri, 6 Oct 2023 14:56:18 -0300 Subject: [PATCH] add serviceMonitor to uploads chart --- charts/hub-uploads/Chart.yaml | 2 +- charts/hub-uploads/templates/service.yaml | 26 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/charts/hub-uploads/Chart.yaml b/charts/hub-uploads/Chart.yaml index 985e2c7..c2f05ed 100644 --- a/charts/hub-uploads/Chart.yaml +++ b/charts/hub-uploads/Chart.yaml @@ -18,7 +18,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. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.1 +version: 0.1.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/hub-uploads/templates/service.yaml b/charts/hub-uploads/templates/service.yaml index ab6f8ed..db0afac 100644 --- a/charts/hub-uploads/templates/service.yaml +++ b/charts/hub-uploads/templates/service.yaml @@ -13,3 +13,29 @@ spec: name: http selector: {{- include "hub-uploads.selectorLabels" . | nindent 4 }} +{{- if and (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") (.Values.serviceMonitor.enabled) }} +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "hub-uploads.fullname" . }} + {{- if .Release.Namespace }} + namespace: {{ .Release.Namespace }} + {{- end }} + labels: + {{- include "hub-uploads.labels" . | nindent 4 }} +{{- with .Values.serviceMonitor.labels }} + {{- toYaml . | nindent 4 }} +{{- end }} +spec: + endpoints: + - path: /metrics + port: http + scheme: {{ .Values.serviceMonitor.scheme }} + interval: {{ .Values.serviceMonitor.scrapeInterval }} + scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "hub-uploads.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}}