From b9eba17f1564c19bfab7c73657540c16c6a19724 Mon Sep 17 00:00:00 2001 From: Andreas Gruhler Date: Fri, 13 Sep 2024 09:56:38 +0200 Subject: [PATCH] only create service with serviceMonitor * feat: only create service with serviceMonitor Only create the service when `serviceMonitor.create` is set. The service is useless otherwise. I have a project where I can only use the `prometheusRules.enabled=true` but only want to use the prometheus rules, not the service monitor. Also, it creates a conflict in our deployment because we already have a similar service with that name `vault-monitoring`. --- charts/vault-monitoring/Chart.yaml | 6 +++--- charts/vault-monitoring/README.md | 2 +- charts/vault-monitoring/templates/service.yaml | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/charts/vault-monitoring/Chart.yaml b/charts/vault-monitoring/Chart.yaml index b227ef9c8..081f7076b 100644 --- a/charts/vault-monitoring/Chart.yaml +++ b/charts/vault-monitoring/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: vault-monitoring description: monitor your vault server from within Kubernetes' prometheus type: application -version: 0.4.2 +version: 0.5.0 home: https://github.com/adfinis/helm-charts/tree/main/charts/vault-monitoring sources: - https://github.com/adfinis/helm-charts/tree/main/charts/vault-monitoring @@ -12,5 +12,5 @@ maintainers: url: https://adfinis.com annotations: artifacthub.io/changes: | - - kind: fixed - description: "fix metric for vault" + - kind: changed + description: "Only create service vault-monitoring when serviceMonitor.create=true" diff --git a/charts/vault-monitoring/README.md b/charts/vault-monitoring/README.md index d9e3f3477..8020d3ce8 100644 --- a/charts/vault-monitoring/README.md +++ b/charts/vault-monitoring/README.md @@ -1,6 +1,6 @@ # vault-monitoring -![Version: 0.4.2](https://img.shields.io/badge/Version-0.4.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +![Version: 0.5.0](https://img.shields.io/badge/Version-0.5.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) monitor your vault server from within Kubernetes' prometheus diff --git a/charts/vault-monitoring/templates/service.yaml b/charts/vault-monitoring/templates/service.yaml index be12e9d40..d62d5ecdb 100644 --- a/charts/vault-monitoring/templates/service.yaml +++ b/charts/vault-monitoring/templates/service.yaml @@ -1,3 +1,4 @@ +{{- if .Values.vault.serviceMonitor.create }} apiVersion: v1 kind: Service metadata: @@ -17,3 +18,4 @@ spec: targetPort: {{ .Values.vault.port }} sessionAffinity: None type: {{ .Values.vault.service.type }} +{{- end }}