Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotate Pods for Prometheus Metrics Collection #1098

Merged
merged 6 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions deployment/helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,12 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Common annotations
*/}}
{{- define "common.annotations" -}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, but I'm not going to block submit: This is probably "pod annotations" or the like. We probably don't want these for other objects, like Services or Ingresses.

prometheus.io/scrape: "true"
prometheus.io/port: "9090"
prometheus.io/path: "/metrics"
{{- end }}
3 changes: 3 additions & 0 deletions deployment/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ spec:
metadata:
labels:
app: '{{ include "common.names.name" . }}'
annotations:
# This includes a newline, so ko sees this as valid yaml
# {{ include "common.annotations" (dict "customAnnotations" .Values.commonAnnotations "context" $ ) | nindent 8 }}
spec:
serviceAccountName: mediator
containers:
Expand Down