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

[prometheus-elasticsearch-exporter] add support for podmonitor #4264

Merged
merged 13 commits into from
Feb 20, 2024
Merged
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
2 changes: 1 addition & 1 deletion charts/prometheus-elasticsearch-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: Elasticsearch stats exporter for Prometheus
name: prometheus-elasticsearch-exporter
version: 5.5.0
version: 5.6.0
kubeVersion: ">=1.10.0-0"
appVersion: "v1.7.0"
home: https://github.com/prometheus-community/elasticsearch_exporter
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{{- if and .Values.podMonitor.enabled .Values.serviceMonitor.enabled }}
{{- fail "Either .Values.podMonitor.enabled or .Values.serviceMonitor.enabled can be enabled at a time, but not both." }}
{{- else if .Values.podMonitor.enabled }}
zeritti marked this conversation as resolved.
Show resolved Hide resolved
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ template "elasticsearch-exporter.fullname" . }}
{{- if .Values.podMonitor.namespace }}
namespace: {{ .Values.podMonitor.namespace }}
{{- end }}
labels:
chart: {{ template "elasticsearch-exporter.chart" . }}
app: {{ template "elasticsearch-exporter.name" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.podMonitor.labels }}
{{- toYaml .Values.podMonitor.labels | nindent 4 }}
{{- end }}
spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
podMetricsEndpoints:
- path: {{ .Values.web.path }}
port: {{ .Values.deployment.metricsPort.name }}
DrFaust92 marked this conversation as resolved.
Show resolved Hide resolved
{{- if .Values.podMonitor.scheme }}
scheme: {{ .Values.podMonitor.scheme }}
{{- end }}
{{- if .Values.podMonitor.interval }}
interval: {{ .Values.podMonitor.interval }}
{{- end }}
{{- if .Values.podMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.podMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.podMonitor.honorLabels }}
honorLabels: true
{{- end }}
{{- if .Values.podMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml .Values.podMonitor.metricRelabelings | nindent 6 }}
{{- end }}
{{- if .Values.podMonitor.relabelings }}
relabelings:
{{- toYaml .Values.podMonitor.relabelings | nindent 6 }}
{{- end }}
selector:
matchLabels:
app: {{ template "elasticsearch-exporter.name" . }}
release: "{{ .Release.Name }}"
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.service.enabled }}
kind: Service
apiVersion: v1
metadata:
Expand All @@ -23,3 +24,4 @@ spec:
selector:
app: {{ template "elasticsearch-exporter.name" . }}
release: "{{ .Release.Name }}"
{{- end }}
17 changes: 17 additions & 0 deletions charts/prometheus-elasticsearch-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ affinity: {}
initContainers: []

service:
enabled: true
type: ClusterIP
httpPort: 9108
metricsPort:
Expand All @@ -81,6 +82,8 @@ service:
deployment:
annotations: {}
labels: {}
metricsPort:
name: http

## Extra environment variables that will be passed into the exporter pod
## example:
Expand Down Expand Up @@ -250,6 +253,20 @@ serviceMonitor:
metricRelabelings: []
sampleLimit: 0

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
DrFaust92 marked this conversation as resolved.
Show resolved Hide resolved
namespace: ""
labels: {}
interval: 60s
scrapeTimeout: 10s
honorLabels: true
scheme: http
relabelings: []
metricRelabelings: []

prometheusRule:
## If true, a PrometheusRule CRD is created for a prometheus operator
## https://github.com/coreos/prometheus-operator
Expand Down
Loading