From a27cd9050a47a5345e797b2810681ed5907aee75 Mon Sep 17 00:00:00 2001 From: mpw Date: Wed, 13 Sep 2023 00:27:39 -0300 Subject: [PATCH] add service monitor to hub-nfts --- charts/hub-nfts/Chart.yaml | 2 +- charts/hub-nfts/templates/service.yaml | 26 ++++++++++++++++++++++++++ charts/hub-nfts/values.yaml | 9 ++++++++- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/charts/hub-nfts/Chart.yaml b/charts/hub-nfts/Chart.yaml index c4acd5b..ec09625 100644 --- a/charts/hub-nfts/Chart.yaml +++ b/charts/hub-nfts/Chart.yaml @@ -18,7 +18,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.7.0 +version: 0.8.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/hub-nfts/templates/service.yaml b/charts/hub-nfts/templates/service.yaml index c3ca2a6..e3d5209 100644 --- a/charts/hub-nfts/templates/service.yaml +++ b/charts/hub-nfts/templates/service.yaml @@ -13,3 +13,29 @@ spec: name: http selector: {{- include "hub-nfts.selectorLabels" . | nindent 4 }} +{{- if and (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") (.Values.serviceMonitor.enabled) }} +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "hub-nfts.fullname" . }} + {{- if .Release.Namespace }} + namespace: {{ .Release.Namespace }} + {{- end }} + labels: + {{- include "hub-nfts.labels" . | nindent 4 }} +{{- with .Values.serviceMonitor.labels }} + {{- toYaml . | nindent 4 }} +{{- end }} +spec: + endpoints: + - path: /metrics + port: http + scheme: {{ .Values.serviceMonitor.scheme }} + interval: {{ .Values.serviceMonitor.scrapeInterval }} + scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "hub-nfts.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} diff --git a/charts/hub-nfts/values.yaml b/charts/hub-nfts/values.yaml index 17df580..b830379 100644 --- a/charts/hub-nfts/values.yaml +++ b/charts/hub-nfts/values.yaml @@ -46,6 +46,13 @@ service: type: ClusterIP port: 80 +serviceMonitor: + enabled: true + scheme: http + scrapeInterval: 60s + scrapeTimeout: 30s + labels: {} + resources: {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little @@ -86,7 +93,7 @@ tolerations: [] affinity: {} -creditSheetName: +creditSheetName: "" secrets: enabled: true