Updated template chart

This commit is contained in:
Jim Martens
2023-11-02 11:48:58 +01:00
parent 6881cacaf2
commit 991517ae0e
6 changed files with 28 additions and 9 deletions
+1 -1
View File
@@ -25,4 +25,4 @@ kube-prometheus-stack:
- 10.0.0.2 - 10.0.0.2
kubeScheduler: kubeScheduler:
endpoints: endpoints:
- 10.0.0.2 - 10.0.0.2
+3 -3
View File
@@ -2,7 +2,7 @@ apiVersion: v2
name: template name: template
description: A Helm library chart containing common templates, keeping application templates short description: A Helm library chart containing common templates, keeping application templates short
type: library type: library
version: 0.1.19 version: 0.1.20
maintainers: maintainers:
- name: Jim Martens - name: Jim Martens
url: https://2martens.de url: https://2martens.de
@@ -10,8 +10,8 @@ sources:
- https://git.2martens.de/2martens/cloud-configuration - https://git.2martens.de/2martens/cloud-configuration
annotations: annotations:
artifacthub.io/changes: | artifacthub.io/changes: |
- kind: fixed - kind: changed
description: Fixed annotations description: Added support for Prometheus operator with pod monitor
artifacthub.io/signKey: | artifacthub.io/signKey: |
fingerprint: F0F153B65BAD467201D7544E47393ABD1F96B7C8 fingerprint: F0F153B65BAD467201D7544E47393ABD1F96B7C8
url: https://mafiasi.de/pks/key/47393ABD1F96B7C8.asc url: https://mafiasi.de/pks/key/47393ABD1F96B7C8.asc
+1
View File
@@ -0,0 +1 @@
{{- include "template.podmonitor" . -}}
+5
View File
@@ -56,6 +56,11 @@ application:
prometheus: prometheus:
enabled: true enabled: true
# only enable if you have the Prometheus operator installed, otherwise it will fail due to missing CRDs
useCRDs: false
# namespace: the namespace of the Prometheus installation
# the value is templated
namespace:
# Overwrite with application specific environment variables # Overwrite with application specific environment variables
# Each item has key and value, where the value is parsed as a template # Each item has key and value, where the value is parsed as a template
+1 -5
View File
@@ -16,13 +16,9 @@ spec:
template: template:
metadata: metadata:
annotations: annotations:
{{- if $.Values.prometheus.enabled }} {{- if and $.Values.prometheus.enabled (not $.Values.prometheus.useCRDs) $.Values.application.isSpring }}
prometheus.io/scrape: "true" prometheus.io/scrape: "true"
{{- if $.Values.application.isSpring }}
prometheus.io/path: /actuator/prometheus prometheus.io/path: /actuator/prometheus
{{- else }}
prometheus.io/path: /metrics
{{- end }}
prometheus.io/port: "{{ $.Values.application.actuatorPort }}" prometheus.io/port: "{{ $.Values.application.actuatorPort }}"
{{- end }} {{- end }}
{{- with .Values.podAnnotations }} {{- with .Values.podAnnotations }}
+17
View File
@@ -0,0 +1,17 @@
{{- define "template.podmonitor" -}}
{{- if and .Values.prometheus.enabled .Values.prometheus.useCRDs .Values.application.isSpring }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ include "template.fullname" . }}
namespace: {{ tpl .Values.prometheus.namespace . | default "observability" }}
labels:
{{- include "template.labels" . | nindent 4 }}
spec:
podMetricsEndpoints:
- port: {{ .Values.application.actuatorPort }}
path: /actuator/prometheus
selector:
{{- include "template.selectorLabels" . | nindent 4 }}
{{- end }}
{{- end }}