From b999bb36af59de899c2426c0ad35e4e04abc317d Mon Sep 17 00:00:00 2001 From: Patrick Jahns Date: Thu, 17 Nov 2022 23:33:00 +0100 Subject: feat(helm): ability to monitor garage via prometheus --- script/helm/garage/templates/service.yaml | 21 +++++++++++ script/helm/garage/templates/servicemonitor.yaml | 44 ++++++++++++++++++++++++ script/helm/garage/templates/workload.yaml | 2 ++ 3 files changed, 67 insertions(+) create mode 100644 script/helm/garage/templates/servicemonitor.yaml (limited to 'script/helm/garage/templates') diff --git a/script/helm/garage/templates/service.yaml b/script/helm/garage/templates/service.yaml index 2bfff99d..37218872 100644 --- a/script/helm/garage/templates/service.yaml +++ b/script/helm/garage/templates/service.yaml @@ -17,3 +17,24 @@ spec: name: s3-web selector: {{- include "garage.selectorLabels" . | nindent 4 }} +{{- if .Values.monitoring.metrics.enabled }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "garage.fullname" . }}-metrics + labels: + {{- include "garage.labels" . | nindent 4 }} + annotations: + prometheus.io/scrape: "true" +spec: + type: ClusterIP + clusterIP: None + ports: + - port: 3903 + targetPort: 3903 + protocol: TCP + name: metrics + selector: + {{- include "garage.selectorLabels" . | nindent 4 }} +{{- end }} \ No newline at end of file diff --git a/script/helm/garage/templates/servicemonitor.yaml b/script/helm/garage/templates/servicemonitor.yaml new file mode 100644 index 00000000..6838d09f --- /dev/null +++ b/script/helm/garage/templates/servicemonitor.yaml @@ -0,0 +1,44 @@ +{{- if .Values.monitoring.metrics.serviceMonitor.enabled }} +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "garage.fullname" . }} + {{- if .Values.monitoring.metrics.serviceMonitor.namespace }} + namespace: {{ tpl .Values.monitoring.metrics.serviceMonitor.namespace . }} + {{- else }} + namespace: {{ .Release.Namespace }} + {{- end }} + labels: + {{- include "garage.labels" . | nindent 4 }} + {{- with .Values.monitoring.metrics.serviceMonitor.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + endpoints: + - port: metrics + {{- with .Values.monitoring.metrics.serviceMonitor.interval }} + interval: {{ . }} + {{- end }} + {{- with .Values.monitoring.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ . }} + {{- end }} + honorLabels: true + path: {{ .Values.monitoring.metrics.serviceMonitor.path }} + scheme: {{ .Values.monitoring.metrics.serviceMonitor.scheme }} + {{- with .Values.monitoring.metrics.serviceMonitor.tlsConfig }} + tlsConfig: + {{- toYaml . | nindent 6 }} + {{- end }} + {{- with .Values.monitoring.metrics.serviceMonitor.relabelings }} + relabelings: + {{- toYaml . | nindent 6 }} + {{- end }} + jobLabel: "{{ .Release.Name }}" + selector: + matchLabels: + {{- include "garage.selectorLabels" . | nindent 6 }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} +{{- end }} \ No newline at end of file diff --git a/script/helm/garage/templates/workload.yaml b/script/helm/garage/templates/workload.yaml index b0303869..340c0054 100644 --- a/script/helm/garage/templates/workload.yaml +++ b/script/helm/garage/templates/workload.yaml @@ -61,6 +61,8 @@ spec: name: s3-api - containerPort: 3902 name: web-api + - containerPort: 3903 + name: admin volumeMounts: - name: meta mountPath: /mnt/meta -- cgit v1.2.3