Skip to content

Commit 466849f

Browse files
Helm: add Grafana annotations (#519)
1 parent 96d104d commit 466849f

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# This job gets installed only if Grafana, Loki and Promtail are enabled.
3+
#
4+
# It's an ephemeral container running at the start and end of each Helm
5+
# deploy and it's used to log at stdout the Helm revision we are
6+
# installing / we finished installing.
7+
#
8+
# This datapoint is useful and can be very helpful as annotation
9+
# in Grafana dashboard.
10+
#
11+
{{- if and .Values.grafana.enabled (and .Values.loki.enabled .Values.promtail.enabled) -}}
12+
apiVersion: batch/v1
13+
kind: Job
14+
metadata:
15+
name: {{ printf "%s-grafana-annotation-job-post" .Release.Name }}
16+
annotations:
17+
"helm.sh/hook": "post-install,post-upgrade,post-rollback"
18+
spec:
19+
template:
20+
spec:
21+
containers:
22+
- name: grafana-annotation-job-post
23+
image: {{ .Values.busybox.image }}
24+
imagePullPolicy: {{ .Values.busybox.pullPolicy }}
25+
command:
26+
- /bin/sh
27+
- -c
28+
- |
29+
echo '{"operation_stage": "end", "helm_revision": "{{ .Release.Revision }}"}'
30+
{{- end }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# This job gets installed only if Grafana, Loki and Promtail are enabled.
3+
#
4+
# It's an ephemeral container running at the start and end of each Helm
5+
# deploy and it's used to log at stdout the Helm revision we are
6+
# installing / we finished installing.
7+
#
8+
# This datapoint is useful and can be very helpful as annotation
9+
# in Grafana dashboard.
10+
#
11+
{{- if and .Values.grafana.enabled (and .Values.loki.enabled .Values.promtail.enabled) -}}
12+
apiVersion: batch/v1
13+
kind: Job
14+
metadata:
15+
name: {{ printf "%s-grafana-annotation-job-pre" .Release.Name }}
16+
annotations:
17+
"helm.sh/hook": "pre-install,pre-upgrade,pre-rollback"
18+
spec:
19+
template:
20+
spec:
21+
containers:
22+
- name: grafana-annotation-job-pre
23+
image: {{ .Values.busybox.image }}
24+
imagePullPolicy: {{ .Values.busybox.pullPolicy }}
25+
command:
26+
- /bin/sh
27+
- -c
28+
- |
29+
echo '{"operation_stage": "start", "helm_revision": "{{ .Release.Revision }}"}'
30+
{{- end }}

0 commit comments

Comments
 (0)