From b9f4c41f0f2cc1a8b8e0f84db420e5195f975b3e Mon Sep 17 00:00:00 2001 From: Aron Kaufmann Date: Thu, 6 Jun 2024 14:15:25 +0200 Subject: [PATCH] added servicemonitor only including 1 service --- apigateway/helm/templates/_helper.tpl | 7 +++++++ apigateway/helm/templates/servicemonitor.yaml | 1 + apigateway/helm/values.yaml | 1 + 3 files changed, 9 insertions(+) diff --git a/apigateway/helm/templates/_helper.tpl b/apigateway/helm/templates/_helper.tpl index 9ab8056..bf26715 100644 --- a/apigateway/helm/templates/_helper.tpl +++ b/apigateway/helm/templates/_helper.tpl @@ -119,4 +119,11 @@ Renders the license config name or secret. If not specified, it will be the defa */}} {{- define "apigateway.licenseconfigname" -}} {{- default ( printf "%s-%s" (include "common.names.fullname" . ) "license") .Values.licenseConfigName }} +{{- end }} + +{{/* +Renders the service name for service monitoring. If not specified, it will be the default name. +*/}} +{{- define "apigateway.monitorServiceName" -}} + {{- default ( printf "%s-%s" (include "common.names.fullname" . ) "-rt") .Values.serviceMonitor.serviceName }} {{- end }} \ No newline at end of file diff --git a/apigateway/helm/templates/servicemonitor.yaml b/apigateway/helm/templates/servicemonitor.yaml index 04ac32f..7dacbe9 100644 --- a/apigateway/helm/templates/servicemonitor.yaml +++ b/apigateway/helm/templates/servicemonitor.yaml @@ -42,4 +42,5 @@ spec: selector: matchLabels: app.kubernetes.io/instance: {{ .Release.Name }} + name: {{ include "apigateway.monitorServiceName" . }} {{- end }} \ No newline at end of file diff --git a/apigateway/helm/values.yaml b/apigateway/helm/values.yaml index 52ce027..3921109 100644 --- a/apigateway/helm/values.yaml +++ b/apigateway/helm/values.yaml @@ -442,6 +442,7 @@ prometheus: # -- Create and enable ServiceMonitor. The default is `false`. serviceMonitor: enabled: false + serviceName: "" metering: