Skip to content

Commit

Permalink
[prometheus-elasticsearch-exporter] add support for podmonitor (prome…
Browse files Browse the repository at this point in the history
…theus-community#4264)

* [prometheus-elasticsearch-exporter] Add PodMonitor support

Signed-off-by: ShlomiTubul <[email protected]>

* [prometheus-elasticsearch-exporter] revert deafult values,bump version

Signed-off-by: ShlomiTubul <[email protected]>

* add support for podmomitor

Signed-off-by: drfaust92 <[email protected]>

* add support for podmomitor

Signed-off-by: drfaust92 <[email protected]>

* add support for podmomitor

Signed-off-by: drfaust92 <[email protected]>

* Update charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml

Co-authored-by: zeritti <[email protected]>
Signed-off-by: Ilia Lazebnik <[email protected]>

* Update charts/prometheus-elasticsearch-exporter/values.yaml

Co-authored-by: zeritti <[email protected]>
Signed-off-by: Ilia Lazebnik <[email protected]>

* Update charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml

Co-authored-by: zeritti <[email protected]>
Signed-off-by: Ilia Lazebnik <[email protected]>

* Update charts/prometheus-elasticsearch-exporter/values.yaml

Co-authored-by: zeritti <[email protected]>
Signed-off-by: Ilia Lazebnik <[email protected]>

* Update charts/prometheus-elasticsearch-exporter/values.yaml

Co-authored-by: zeritti <[email protected]>
Signed-off-by: Ilia Lazebnik <[email protected]>

* CR comments

Signed-off-by: drfaust92 <[email protected]>

* remove job label

Signed-off-by: drfaust92 <[email protected]>

* Update charts/prometheus-elasticsearch-exporter/values.yaml

Co-authored-by: zeritti <[email protected]>
Signed-off-by: Ilia Lazebnik <[email protected]>

---------

Signed-off-by: ShlomiTubul <[email protected]>
Signed-off-by: drfaust92 <[email protected]>
Signed-off-by: Ilia Lazebnik <[email protected]>
Co-authored-by: ShlomiTubul <[email protected]>
Co-authored-by: zeritti <[email protected]>
  • Loading branch information
3 people authored and Matiasmct committed Mar 20, 2024
1 parent 851d9af commit 77ea1ad
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 1 deletion.
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
50 changes: 50 additions & 0 deletions charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml
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 }}
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 }}
{{- 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
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

0 comments on commit 77ea1ad

Please sign in to comment.