From 039b300d974e36a5064c30a23014f017bb14db94 Mon Sep 17 00:00:00 2001 From: yeka Date: Wed, 19 Jul 2023 14:00:28 +0800 Subject: [PATCH] enhance ServiceMonitor (#63) --- charts/horizon/Chart.yaml | 2 +- .../templates/core/core-servicemonitor.yaml | 17 +++++++++++++---- charts/horizon/values.yaml | 9 +++++++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/charts/horizon/Chart.yaml b/charts/horizon/Chart.yaml index f3b6156..aa5ddfa 100644 --- a/charts/horizon/Chart.yaml +++ b/charts/horizon/Chart.yaml @@ -4,7 +4,7 @@ description: A CICD DevOps Platform type: application -version: 2.2.6 +version: 2.2.7 appVersion: v2.4.2 dependencies: - name: common diff --git a/charts/horizon/templates/core/core-servicemonitor.yaml b/charts/horizon/templates/core/core-servicemonitor.yaml index 18db211..185b6c1 100644 --- a/charts/horizon/templates/core/core-servicemonitor.yaml +++ b/charts/horizon/templates/core/core-servicemonitor.yaml @@ -1,4 +1,4 @@ -{{- if .Values.core.monitor.enabled }} +{{- if .Values.core.serviceMonitor.enabled }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: @@ -8,9 +8,18 @@ metadata: component: core spec: endpoints: - - interval: 30s - path: /metrics - port: http + - port: http + path: {{ .Values.core.serviceMonitor.path }} + {{- with .Values.core.serviceMonitor.interval }} + interval: {{ . }} + {{- end }} + {{- with .Values.core.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ . }} + {{- end }} + {{- if .Values.core.serviceMonitor.relabelings }} + relabelings: + {{- toYaml .Values.core.serviceMonitor.relabelings | nindent 4 }} + {{- end }} selector: matchLabels: {{ include "horizon.labels" . | indent 6 }} diff --git a/charts/horizon/values.yaml b/charts/horizon/values.yaml index b10536b..3b8e2aa 100644 --- a/charts/horizon/values.yaml +++ b/charts/horizon/values.yaml @@ -119,7 +119,7 @@ core: additionalLabels: {} image: repository: horizoncd/horizon-core - tag: + tag: args: loglevel: securityContext: @@ -142,8 +142,13 @@ core: envs: {} extraVolumeMounts: [] extraVolumes: [] - monitor: + serviceMonitor: enabled: false + path: /metrics + interval: 1m + scrapeTimeout: 30s + relabelings: [] + grafanaDashboards: - name: pod value: |