From 6e12f993e38e76aac6e0efe5e2c1118778dd6cc6 Mon Sep 17 00:00:00 2001 From: Nick Kou Date: Mon, 21 Nov 2022 14:17:37 +1300 Subject: [PATCH] add servicemonitor labels --- charts/graphprotocol-node/Chart.yaml | 2 +- charts/graphprotocol-node/templates/_helpers.tpl | 13 +++++++++++++ .../templates/servicemonitor.yaml | 2 +- charts/graphprotocol-node/values.schema.json | 7 ++++++- charts/graphprotocol-node/values.yaml | 1 + 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/charts/graphprotocol-node/Chart.yaml b/charts/graphprotocol-node/Chart.yaml index 463752f..fe33b64 100644 --- a/charts/graphprotocol-node/Chart.yaml +++ b/charts/graphprotocol-node/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: graphprotocol-node description: A Helm chart for Graph Protocol Nodes type: application -version: 0.1.11 +version: 0.1.12 keywords: - graphprotocol - ethereum diff --git a/charts/graphprotocol-node/templates/_helpers.tpl b/charts/graphprotocol-node/templates/_helpers.tpl index 1fb12f3..e17be3b 100644 --- a/charts/graphprotocol-node/templates/_helpers.tpl +++ b/charts/graphprotocol-node/templates/_helpers.tpl @@ -50,3 +50,16 @@ Selector labels app.kubernetes.io/name: {{ include "graphprotocol-node.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} + +{{/* +ServiceMonitor labels +*/}} +{{- define "graphprotocol-node.serviceMonitorLabels" -}} +service.monitor: {{ .Values.monitoring.labels }} +helm.sh/chart: {{ include "graphprotocol-node.chart" . }} +{{ include "graphprotocol-node.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} diff --git a/charts/graphprotocol-node/templates/servicemonitor.yaml b/charts/graphprotocol-node/templates/servicemonitor.yaml index 83c8d6c..777b1ee 100644 --- a/charts/graphprotocol-node/templates/servicemonitor.yaml +++ b/charts/graphprotocol-node/templates/servicemonitor.yaml @@ -4,7 +4,7 @@ kind: ServiceMonitor metadata: name: {{ include "graphprotocol-node.fullname" . }} labels: - {{- include "graphprotocol-node.labels" . | nindent 4 }} + {{- include "graphprotocol-node.serviceMonitorLabels" . | nindent 4 }} spec: selector: matchLabels: diff --git a/charts/graphprotocol-node/values.schema.json b/charts/graphprotocol-node/values.schema.json index 6d61cf9..f25798d 100644 --- a/charts/graphprotocol-node/values.schema.json +++ b/charts/graphprotocol-node/values.schema.json @@ -208,11 +208,16 @@ "monitoring": { "type": "object", "required": [ - "enabled" + "enabled", + "labels" ], "enabled": { "type": "boolean", "description": "enabled ServiceMonitor object creation" + }, + "labels": { + "type": "string", + "description": "specify the service.monitor label value." } } }, diff --git a/charts/graphprotocol-node/values.yaml b/charts/graphprotocol-node/values.yaml index f84ae00..40f6f3c 100644 --- a/charts/graphprotocol-node/values.yaml +++ b/charts/graphprotocol-node/values.yaml @@ -84,6 +84,7 @@ role: "query-node" monitoring: enabled: false + labels: "prometheus" ingress: enabled: false