Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
52 changes: 52 additions & 0 deletions charts/prometheus-kafka-exporter/templates/podmonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{- if and .Values.prometheus.podMonitor.enabled .Values.prometheus.serviceMonitor.enabled }}
{{- fail "Either .Values.prometheus.podMonitor.enabled or .Values.serviceMonitor.enabled can be enabled at a time, but not both." }}
{{- else if .Values.prometheus.podMonitor.enabled }}
apiVersion: {{ .Values.prometheus.podMonitor.apiVersion }}
kind: PodMonitor
metadata:
name: {{ template "prometheus-kafka-exporter.fullname" . }}
{{- if .Values.prometheus.podMonitor.namespace }}
namespace: {{ .Values.prometheus.podMonitor.namespace }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "prometheus-kafka-exporter.name" . }}
helm.sh/chart: {{ include "prometheus-kafka-exporter.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.prometheus.podMonitor.additionalLabels }}
{{ toYaml .Values.prometheus.podMonitor.additionalLabels | indent 4 -}}
{{- end }}
spec:

jobLabel: jobLabel
{{- if .Values.prometheus.podMonitor.podTargetLabels }}
podTargetLabels:
{{- range .Values.prometheus.podMonitor.podTargetLabels }}
- {{ . }}
{{- end }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
podMetricsEndpoints:
- port: exporter-port
path: {{ .Values.prometheus.podMonitor.path }}
{{- if .Values.prometheus.podMonitor.interval }}
interval: {{ .Values.prometheus.podMonitor.interval }}
{{- end }}
{{- if .Values.prometheus.podMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.prometheus.podMonitor.scrapeTimeout }}
{{- end }}
{{- with .Values.prometheus.podMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 6 }}
{{- end }}

{{- with .Values.prometheus.podMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 6 }}
{{- end }}
selector:
matchLabels:
app: {{ template "prometheus-kafka-exporter.name" . }}
release: {{ .Release.Name }}
{{- end }}
23 changes: 22 additions & 1 deletion charts/prometheus-kafka-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,27 @@ prometheus:
# targetLabel: nodename
# replacement: $1
# action: replace
podMonitor:
## If true, a PodMonitor CRD is created for a Prometheus Operator
## https://prometheus-operator.dev/docs/operator/api/#monitoring.coreos.com/v1.PodMonitor
##
enabled: false
apiVersion: "monitoring.coreos.com/v1"
path: /metrics
namespace: ""
labels: {}
interval: 60s
scrapeTimeout: 10s
scheme: http
podTargetLabels: []
relabelings: []
metricRelabelings: []
# - sourceLabels: [__meta_kubernetes_pod_node_name]
# separator: ;
# regex: ^(.*)$
# targetLabel: nodename
# replacement: $1
# action: replace

# Additional labels for pod
podLabels: {}
Expand Down Expand Up @@ -250,6 +271,6 @@ containerSecurityContext: {}
# readOnlyRootFilesystem: true
# runAsGroup: 10002
# runAsNonRoot: true
# runAsUser: 10001
# runAsUser: 10001, for OpenShift, use 1000710000 instead
# seccompProfile:
# type: RuntimeDefault
Loading