From ca00d92861c28284f5f019907fd09475309291db Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Wed, 24 Apr 2024 15:04:46 +0530 Subject: [PATCH] feat: Add ServiceMonitor object to opensearch chore: use name Signed-off-by: Shubham Gupta --- charts/opensearch/templates/serviceMonitor.yaml | 17 +++++++++++++++++ charts/opensearch/values.yaml | 6 ++++++ 2 files changed, 23 insertions(+) create mode 100644 charts/opensearch/templates/serviceMonitor.yaml diff --git a/charts/opensearch/templates/serviceMonitor.yaml b/charts/opensearch/templates/serviceMonitor.yaml new file mode 100644 index 00000000..04c67b70 --- /dev/null +++ b/charts/opensearch/templates/serviceMonitor.yaml @@ -0,0 +1,17 @@ +{{- if .Values.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "opensearch.name" . }}-service-monitor + namespace: {{ .Release.Namespace }} + labels: + {{- include "opensearch.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "opensearch.labels" . | nindent 4 }} + endpoints: + - port: {{ .Values.metricsPort }} + interval: {{ .Values.serviceMonitor.interval }} + path: {{ .Values.serviceMonitor.path }} +{{- end }} diff --git a/charts/opensearch/values.yaml b/charts/opensearch/values.yaml index 33737661..9685cb10 100644 --- a/charts/opensearch/values.yaml +++ b/charts/opensearch/values.yaml @@ -529,3 +529,9 @@ extraObjects: [] # selector: # matchLabels: # {{- include "opensearch.selectorLabels" . | nindent 6 }} + + +serviceMonitor: + enabled: false + path: /metrics + interval: 10s