From a05fd5ea8c2385b3798f7cc94d79ee804ec7b75d Mon Sep 17 00:00:00 2001 From: Eugene Kainara Date: Tue, 31 Oct 2023 10:24:50 +0200 Subject: [PATCH] Adding possibility to add annotations to Service resource --- helm/ci/postgresql-values.yaml | 4 +++- helm/templates/service.yaml | 4 ++++ helm/values.yaml | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/helm/ci/postgresql-values.yaml b/helm/ci/postgresql-values.yaml index 5650ce41..3780b934 100644 --- a/helm/ci/postgresql-values.yaml +++ b/helm/ci/postgresql-values.yaml @@ -6,7 +6,9 @@ tests: namespace: monitoring metricsEndpoint: enabled: true - +service: + annotations: + prometheus.io/scrape: "true" config: target: data_source_name: 'postgresql://postgres:123123!!@postgres-instance-postgresql.postgres.svc.cluster.local:5432?sslmode=disable' diff --git a/helm/templates/service.yaml b/helm/templates/service.yaml index 353b5cf6..587a10e2 100644 --- a/helm/templates/service.yaml +++ b/helm/templates/service.yaml @@ -4,6 +4,10 @@ metadata: name: {{ include "sql-exporter.fullname" . }} labels: {{- include "sql-exporter.labels" . | nindent 4 }} + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} spec: type: {{ .Values.service.type }} ports: diff --git a/helm/values.yaml b/helm/values.yaml index b43b84bf..39157e7d 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -11,6 +11,10 @@ fullnameOverride: "" service: type: ClusterIP port: 80 + annotations: {} + # example of prometheus usage + # prometheus.io/scrape: "true" + # prometheus.io/path: "/metrics" resources: {} # limits: