mirror of
https://github.com/nikdoof/helm-charts.git
synced 2025-12-13 05:32:14 +00:00
Add PrometheusRule and ServiceMonitor to common (#47)
* Add PrometheusRule and ServiceMonitor to common * Bump Kind version
This commit is contained in:
2
.github/workflows/lint-test.yaml
vendored
2
.github/workflows/lint-test.yaml
vendored
@@ -37,7 +37,7 @@ jobs:
|
||||
- name: Create k3d cluster
|
||||
uses: nolar/setup-k3d-k3s@v1
|
||||
with:
|
||||
version: v1.19
|
||||
version: v1.23
|
||||
if: steps.list-changed.outputs.changed == 'true'
|
||||
|
||||
- name: Remove node taints
|
||||
|
||||
@@ -2,7 +2,7 @@ apiVersion: v2
|
||||
name: common
|
||||
description: Common chart library, based off KaH's common
|
||||
type: library
|
||||
version: 4.5.2
|
||||
version: 4.5.3
|
||||
kubeVersion: ">=1.16.0-0"
|
||||
keywords:
|
||||
- common
|
||||
|
||||
@@ -55,4 +55,12 @@ Main entrypoint for the common library chart. It will render all underlying temp
|
||||
{{- if .Values.secret -}}
|
||||
{{ include "common.secret" . | nindent 0 }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .Values.metrics.enabled -}}
|
||||
{{ include "common.serviceMonitor" . | nindent 0 }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled -}}
|
||||
{{ include "common.prometheusRule" . | nindent 0 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
19
charts/common/templates/_prometheusrule.tpl
Normal file
19
charts/common/templates/_prometheusrule.tpl
Normal file
@@ -0,0 +1,19 @@
|
||||
{{- define "common.prometheusRule" }}
|
||||
---
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- with .Values.metrics.prometheusRule.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
groups:
|
||||
- name: {{ include "common.names.fullname" . }}
|
||||
rules:
|
||||
{{- with .Values.metrics.prometheusRule.rules }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
25
charts/common/templates/_servicemonitor.tpl
Normal file
25
charts/common/templates/_servicemonitor.tpl
Normal file
@@ -0,0 +1,25 @@
|
||||
{{- define "common.serviceMonitor" }}
|
||||
---
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- with .Values.metrics.serviceMonitor.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "common.labels.selectorLabels" . | nindent 6 }}
|
||||
endpoints:
|
||||
- port: metrics
|
||||
{{- with .Values.metrics.serviceMonitor.interval }}
|
||||
interval: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.metrics.serviceMonitor.scrapeTimeout }}
|
||||
scrapeTimeout: {{ . }}
|
||||
{{- end }}
|
||||
path: /metrics
|
||||
{{- end }}
|
||||
@@ -472,6 +472,32 @@ resources: {}
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
|
||||
metrics:
|
||||
# -- Enable metrics collections with serviceMonitor
|
||||
# @default -- See values.yaml
|
||||
enabled: false
|
||||
serviceMonitor:
|
||||
interval: 3m
|
||||
scrapeTimeout: 1m
|
||||
labels: {}
|
||||
# -- Enable and configure Prometheus Rules for the chart under this key.
|
||||
# @default -- See values.yaml
|
||||
prometheusRule:
|
||||
enabled: false
|
||||
labels: {}
|
||||
# -- Configure additionial rules for the chart under this key.
|
||||
# @default -- See prometheusrules.yaml
|
||||
rules: []
|
||||
# - alert: SonarrDown
|
||||
# annotations:
|
||||
# description: Sonarr service is down.
|
||||
# summary: Sonarr is down.
|
||||
# expr: |
|
||||
# sonarr_system_status == 0
|
||||
# for: 5m
|
||||
# labels:
|
||||
# severity: critical
|
||||
|
||||
# -- The common chart supports several add-ons. These can be configured under this key.
|
||||
# @default -- See below
|
||||
addons:
|
||||
|
||||
Reference in New Issue
Block a user