Skip to content

Commit 82b61d6

Browse files
authored
Merge pull request #399 from int128/pod-monitor
Add PodMonitor template to flagger chart
2 parents 968d67a + 8243913 commit 82b61d6

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

charts/flagger/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ Parameter | Description | Default
8484
`slack.channel` | Slack channel | None
8585
`slack.user` | Slack username | `flagger`
8686
`msteams.url` | Microsoft Teams incoming webhook | None
87+
`podMonitor.enabled` | if `true`, create a PodMonitor for [monitoring the metrics](https://docs.flagger.app/usage/monitoring#metrics) | `false`
88+
`podMonitor.namespace` | the namespace where the PodMonitor is created | the same namespace
89+
`podMonitor.interval` | interval at which metrics should be scraped | `15s`
90+
`podMonitor.podMonitor` | additional labels to add to the PodMonitor | `{}`
8791
`leaderElection.enabled` | leader election must be enabled when running more than one replica | `false`
8892
`leaderElection.replicaCount` | number of replicas | `1`
8993
`ingressAnnotationsPrefix` | annotations prefix for ingresses | `custom.ingress.kubernetes.io`
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{{- if .Values.podMonitor.enabled }}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: PodMonitor
4+
metadata:
5+
labels:
6+
helm.sh/chart: {{ template "flagger.chart" . }}
7+
app.kubernetes.io/name: {{ template "flagger.name" . }}
8+
app.kubernetes.io/managed-by: {{ .Release.Service }}
9+
app.kubernetes.io/instance: {{ .Release.Name }}
10+
{{- range $k, $v := .Values.podMonitor.additionalLabels }}
11+
{{ $k }}: {{ $v | quote }}
12+
{{- end }}
13+
name: {{ include "flagger.fullname" . }}
14+
namespace: {{ .Values.podMonitor.namespace | default .Release.Namespace }}
15+
spec:
16+
podMetricsEndpoints:
17+
- interval: {{ .Values.podMonitor.interval }}
18+
path: /metrics
19+
port: http
20+
namespaceSelector:
21+
matchNames:
22+
- {{ .Release.Namespace }}
23+
selector:
24+
matchLabels:
25+
app.kubernetes.io/name: {{ template "flagger.name" . }}
26+
app.kubernetes.io/instance: {{ .Release.Name }}
27+
{{- end }}

charts/flagger/values.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ msteams:
3333
# MS Teams incoming webhook URL
3434
url:
3535

36+
podMonitor:
37+
enabled: false
38+
namespace:
39+
interval: 15s
40+
additionalLabels: {}
41+
3642
#env:
3743
#- name: SLACK_URL
3844
# valueFrom:

0 commit comments

Comments
 (0)