diff --git a/charts/posthog/templates/grafana-annotation-post.job.yaml b/charts/posthog/templates/grafana-annotation-post.job.yaml new file mode 100644 index 000000000..748d706d6 --- /dev/null +++ b/charts/posthog/templates/grafana-annotation-post.job.yaml @@ -0,0 +1,34 @@ +# +# This job gets installed only if Grafana, Loki and Promtail are enabled. +# +# It's an ephemeral container running at the start and end of each Helm +# deploy and it's used to log at stdout the Helm revision we are +# installing / we finished installing. +# +# This datapoint is useful and can be very helpful as annotation +# in Grafana dashboard. +# +{{- if and .Values.grafana.enabled (and .Values.loki.enabled .Values.promtail.enabled) }} +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ printf "%s-grafana-annotation-job-post-%s" .Release.Name (now | date "2006-01-02-15-04-05") }} + labels: {{- include "_snippet-metadata-labels-common" . | nindent 4 }} + annotations: {{- include "_snippet-metadata-annotations-common" . | nindent 4 }} + "helm.sh/hook": "post-install,post-upgrade,post-rollback" +spec: + template: + metadata: + name: {{ printf "%s-grafana-annotation-job-post-%s" .Release.Name (now | date "2006-01-02-15-04-05") }} + spec: + restartPolicy: Never + containers: + - name: grafana-annotation-job-post + image: {{ .Values.busybox.image }} + imagePullPolicy: {{ .Values.busybox.pullPolicy }} + command: + - /bin/sh + - -c + - | + echo '{"operation": "helm_release", "operation_stage": "end", "helm_revision": "{{ .Release.Revision }}"}' +{{- end }} diff --git a/charts/posthog/templates/grafana-annotation-pre.job.yaml b/charts/posthog/templates/grafana-annotation-pre.job.yaml new file mode 100644 index 000000000..2a6e1d724 --- /dev/null +++ b/charts/posthog/templates/grafana-annotation-pre.job.yaml @@ -0,0 +1,34 @@ +# +# This job gets installed only if Grafana, Loki and Promtail are enabled. +# +# It's an ephemeral container running at the start and end of each Helm +# deploy and it's used to log at stdout the Helm revision we are +# installing / we finished installing. +# +# This datapoint is useful and can be very helpful as annotation +# in Grafana dashboard. +# +{{- if and .Values.grafana.enabled (and .Values.loki.enabled .Values.promtail.enabled) }} +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ printf "%s-grafana-annotation-job-pre-%s" .Release.Name (now | date "2006-01-02-15-04-05") }} + labels: {{- include "_snippet-metadata-labels-common" . | nindent 4 }} + annotations: {{- include "_snippet-metadata-annotations-common" . | nindent 4 }} + "helm.sh/hook": "pre-install,pre-upgrade,pre-rollback" +spec: + template: + metadata: + name: {{ printf "%s-grafana-annotation-job-pre-%s" .Release.Name (now | date "2006-01-02-15-04-05") }} + spec: + restartPolicy: Never + containers: + - name: grafana-annotation-job-pre + image: {{ .Values.busybox.image }} + imagePullPolicy: {{ .Values.busybox.pullPolicy }} + command: + - /bin/sh + - -c + - | + echo '{"operation": "helm_release", "operation_stage": "start", "helm_revision": "{{ .Release.Revision }}"}' +{{- end }} diff --git a/charts/posthog/values.yaml b/charts/posthog/values.yaml index 9666afe60..0b70d164a 100644 --- a/charts/posthog/values.yaml +++ b/charts/posthog/values.yaml @@ -1183,7 +1183,7 @@ promtail: config: lokiAddress: http://posthog-loki:3100/loki/api/v1/push ## -- Pod annotations. - podAnnotations: + podAnnotations: {} # Uncomment those lines if you want Prometheus server to scrape metrics. # prometheus.io/scrape: "true" # prometheus.io/path: /metrics @@ -1201,7 +1201,7 @@ prometheus: alertmanager: # -- Whether to install Prometheus AlertManager or not. enabled: false - podAnnotations: + podAnnotations: {} # Uncomment those lines if you want Prometheus server to scrape metrics. # prometheus.io/scrape: "true" # prometheus.io/path: /metrics