From 41ceac6d579de7ca5a8555d42ddc4548c41c5232 Mon Sep 17 00:00:00 2001 From: Jim Martens Date: Thu, 2 Nov 2023 00:02:27 +0100 Subject: [PATCH] Added prometheus support to template --- helm/template/Chart.yaml | 4 ++-- helm/template/_values.yaml | 3 +++ helm/template/templates/_deployment.yaml | 10 ++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/helm/template/Chart.yaml b/helm/template/Chart.yaml index eb141cf..e67e364 100644 --- a/helm/template/Chart.yaml +++ b/helm/template/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: template description: A Helm library chart containing common templates, keeping application templates short type: library -version: 0.1.16 +version: 0.1.17 maintainers: - name: Jim Martens url: https://2martens.de @@ -11,7 +11,7 @@ sources: annotations: artifacthub.io/changes: | - kind: added - description: Added revisionHistoryLimit config + description: Added prometheus support artifacthub.io/signKey: | fingerprint: F0F153B65BAD467201D7544E47393ABD1F96B7C8 url: https://mafiasi.de/pks/key/47393ABD1F96B7C8.asc diff --git a/helm/template/_values.yaml b/helm/template/_values.yaml index 5244b31..27f9195 100644 --- a/helm/template/_values.yaml +++ b/helm/template/_values.yaml @@ -54,6 +54,9 @@ application: profile: prod isSpring: true +prometheus: + enabled: true + # Overwrite with application specific environment variables # Each item has key and value, where the value is parsed as a template environment: [] diff --git a/helm/template/templates/_deployment.yaml b/helm/template/templates/_deployment.yaml index bd456e2..2102984 100644 --- a/helm/template/templates/_deployment.yaml +++ b/helm/template/templates/_deployment.yaml @@ -3,6 +3,16 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "template.fullname" . }} + annotations: + {{- if .Values.prometheus.enabled }} + prometheus.io/scrape: "true" + {{- if .Values.application.isSpring }} + prometheus.io/path: /actuator/prometheus + {{- else }} + prometheus.io/path: /metrics + {{- end }} + prometheus.io/port: "{{ .Values.application.actuatorPort }}" + {{- end }} labels: {{- include "template.labels" . | nindent 4 }} spec: