From 244c109f86b21dfbef16217dea0d1d3b22edae03 Mon Sep 17 00:00:00 2001 From: ShlomiTubul Date: Sat, 4 Nov 2023 16:35:26 +0200 Subject: [PATCH 01/13] [prometheus-elasticsearch-exporter] Add PodMonitor support Signed-off-by: ShlomiTubul --- .../templates/deployment.yaml | 10 ++-- .../templates/podmonitor.yaml | 48 +++++++++++++++++++ .../templates/service.yaml | 3 ++ .../values.yaml | 17 +++++++ 4 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml diff --git a/charts/prometheus-elasticsearch-exporter/templates/deployment.yaml b/charts/prometheus-elasticsearch-exporter/templates/deployment.yaml index 589176ef624e..5bd8d636e983 100644 --- a/charts/prometheus-elasticsearch-exporter/templates/deployment.yaml +++ b/charts/prometheus-elasticsearch-exporter/templates/deployment.yaml @@ -134,7 +134,7 @@ spec: {{- range .Values.extraArgs }} {{ . | quote }}, {{- end }} - "--web.listen-address=:{{ .Values.service.httpPort }}", + "--web.listen-address=:{{ .Values.deployment.httpPort }}", "--web.telemetry-path={{ .Values.web.path }}"] {{- with .Values.securityContext }} securityContext: @@ -145,19 +145,19 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} ports: - - containerPort: {{ .Values.service.httpPort }} - name: {{ .Values.service.metricsPort.name }} + - containerPort: {{ .Values.deployment.httpPort }} + name: {{ .Values.deployment.metricsPort.name }} livenessProbe: httpGet: path: /healthz - port: {{ .Values.service.metricsPort.name }} + port: {{ .Values.deployment.metricsPort.name }} initialDelaySeconds: 5 timeoutSeconds: 5 periodSeconds: 5 readinessProbe: httpGet: path: /healthz - port: {{ .Values.service.metricsPort.name }} + port: {{ .Values.deployment.metricsPort.name }} initialDelaySeconds: 1 timeoutSeconds: 5 periodSeconds: 5 diff --git a/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml b/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml new file mode 100644 index 000000000000..b7785611d108 --- /dev/null +++ b/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml @@ -0,0 +1,48 @@ +{{- 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: + jobLabel: {{ default .Release.Name .Values.podMonitor.jobLabel }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + podMetricsEndpoints: + - path: {{ .Values.web.path }} + port: {{ .Values.deployment.metricsPort.name }} + {{- 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 8 }} + {{- end }} + {{- if .Values.podMonitor.relabelings }} + relabelings: + {{- toYaml .Values.podMonitor.relabelings | nindent 8 }} + {{- end }} + selector: + matchLabels: + app: {{ template "elasticsearch-exporter.name" . }} + release: "{{ .Release.Name }}" +{{- end }} \ No newline at end of file diff --git a/charts/prometheus-elasticsearch-exporter/templates/service.yaml b/charts/prometheus-elasticsearch-exporter/templates/service.yaml index d268ca5748d9..47995f8f6139 100644 --- a/charts/prometheus-elasticsearch-exporter/templates/service.yaml +++ b/charts/prometheus-elasticsearch-exporter/templates/service.yaml @@ -1,3 +1,4 @@ +{{- if .Values.serviceMonitor.enabled }} kind: Service apiVersion: v1 metadata: @@ -19,7 +20,9 @@ spec: ports: - name: {{ .Values.service.metricsPort.name }} port: {{ .Values.service.httpPort }} + targetPort: {{ .Values.deployment.metricsPort.name }} protocol: TCP selector: app: {{ template "elasticsearch-exporter.name" . }} release: "{{ .Release.Name }}" +{{- end }} diff --git a/charts/prometheus-elasticsearch-exporter/values.yaml b/charts/prometheus-elasticsearch-exporter/values.yaml index f70dd9079180..6b7f3c27ba9f 100644 --- a/charts/prometheus-elasticsearch-exporter/values.yaml +++ b/charts/prometheus-elasticsearch-exporter/values.yaml @@ -81,6 +81,9 @@ service: deployment: annotations: {} labels: {} + httpPort: 9108 + metricsPort: + name: http ## Extra environment variables that will be passed into the exporter pod ## example: @@ -250,6 +253,20 @@ serviceMonitor: metricRelabelings: [] sampleLimit: 0 +podMonitor: + ## If true, a PodMonitor CRD is created for a prometheus operator + ## https://github.com/coreos/prometheus-operator + ## + enabled: true + labels: {} + interval: 10s + jobLabel: "" + 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 From bd078d6d0c057785f3c699b6563ece09125e9824 Mon Sep 17 00:00:00 2001 From: ShlomiTubul Date: Sat, 4 Nov 2023 16:37:48 +0200 Subject: [PATCH 02/13] [prometheus-elasticsearch-exporter] revert deafult values,bump version Signed-off-by: ShlomiTubul --- charts/prometheus-elasticsearch-exporter/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/prometheus-elasticsearch-exporter/values.yaml b/charts/prometheus-elasticsearch-exporter/values.yaml index 6b7f3c27ba9f..80c5b42a15a0 100644 --- a/charts/prometheus-elasticsearch-exporter/values.yaml +++ b/charts/prometheus-elasticsearch-exporter/values.yaml @@ -257,7 +257,7 @@ podMonitor: ## If true, a PodMonitor CRD is created for a prometheus operator ## https://github.com/coreos/prometheus-operator ## - enabled: true + enabled: false labels: {} interval: 10s jobLabel: "" From 8acbf4327502f6e1fddc8cdddf63c3012829ac87 Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Sat, 17 Feb 2024 20:47:44 +0200 Subject: [PATCH 03/13] add support for podmomitor Signed-off-by: drfaust92 --- .../templates/deployment.yaml | 10 +++++----- .../templates/service.yaml | 3 +-- charts/prometheus-elasticsearch-exporter/values.yaml | 3 ++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/charts/prometheus-elasticsearch-exporter/templates/deployment.yaml b/charts/prometheus-elasticsearch-exporter/templates/deployment.yaml index 5bd8d636e983..fd2a9095736b 100644 --- a/charts/prometheus-elasticsearch-exporter/templates/deployment.yaml +++ b/charts/prometheus-elasticsearch-exporter/templates/deployment.yaml @@ -134,7 +134,7 @@ spec: {{- range .Values.extraArgs }} {{ . | quote }}, {{- end }} - "--web.listen-address=:{{ .Values.deployment.httpPort }}", + "--web.listen-address=:{{ .Values.servicehttpPort }}", "--web.telemetry-path={{ .Values.web.path }}"] {{- with .Values.securityContext }} securityContext: @@ -145,19 +145,19 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} ports: - - containerPort: {{ .Values.deployment.httpPort }} - name: {{ .Values.deployment.metricsPort.name }} + - containerPort: {{ .Values.service.httpPort }} + name: {{ .Values.service.metricsPort.name }} livenessProbe: httpGet: path: /healthz - port: {{ .Values.deployment.metricsPort.name }} + port: {{ .Values.service.metricsPort.name }} initialDelaySeconds: 5 timeoutSeconds: 5 periodSeconds: 5 readinessProbe: httpGet: path: /healthz - port: {{ .Values.deployment.metricsPort.name }} + port: {{ .Values.service.metricsPort.name }} initialDelaySeconds: 1 timeoutSeconds: 5 periodSeconds: 5 diff --git a/charts/prometheus-elasticsearch-exporter/templates/service.yaml b/charts/prometheus-elasticsearch-exporter/templates/service.yaml index 47995f8f6139..a3420a999392 100644 --- a/charts/prometheus-elasticsearch-exporter/templates/service.yaml +++ b/charts/prometheus-elasticsearch-exporter/templates/service.yaml @@ -1,4 +1,4 @@ -{{- if .Values.serviceMonitor.enabled }} +{{- if .Values.service.enabled }} kind: Service apiVersion: v1 metadata: @@ -20,7 +20,6 @@ spec: ports: - name: {{ .Values.service.metricsPort.name }} port: {{ .Values.service.httpPort }} - targetPort: {{ .Values.deployment.metricsPort.name }} protocol: TCP selector: app: {{ template "elasticsearch-exporter.name" . }} diff --git a/charts/prometheus-elasticsearch-exporter/values.yaml b/charts/prometheus-elasticsearch-exporter/values.yaml index 80c5b42a15a0..d9d6677c04a6 100644 --- a/charts/prometheus-elasticsearch-exporter/values.yaml +++ b/charts/prometheus-elasticsearch-exporter/values.yaml @@ -71,6 +71,7 @@ affinity: {} initContainers: [] service: + enabled: true type: ClusterIP httpPort: 9108 metricsPort: @@ -254,7 +255,7 @@ serviceMonitor: sampleLimit: 0 podMonitor: - ## If true, a PodMonitor CRD is created for a prometheus operator + ## If true, a PodMonitor CRD is created for a Prometheus Operator ## https://github.com/coreos/prometheus-operator ## enabled: false From 7e90655ddba752025b8aaac7ad809892323bc0e3 Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Sat, 17 Feb 2024 20:51:41 +0200 Subject: [PATCH 04/13] add support for podmomitor Signed-off-by: drfaust92 --- .../prometheus-elasticsearch-exporter/templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/prometheus-elasticsearch-exporter/templates/deployment.yaml b/charts/prometheus-elasticsearch-exporter/templates/deployment.yaml index fd2a9095736b..589176ef624e 100644 --- a/charts/prometheus-elasticsearch-exporter/templates/deployment.yaml +++ b/charts/prometheus-elasticsearch-exporter/templates/deployment.yaml @@ -134,7 +134,7 @@ spec: {{- range .Values.extraArgs }} {{ . | quote }}, {{- end }} - "--web.listen-address=:{{ .Values.servicehttpPort }}", + "--web.listen-address=:{{ .Values.service.httpPort }}", "--web.telemetry-path={{ .Values.web.path }}"] {{- with .Values.securityContext }} securityContext: From 879600295e8498c1f0d7cb148bd944df61af7fd3 Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Sat, 17 Feb 2024 20:52:41 +0200 Subject: [PATCH 05/13] add support for podmomitor Signed-off-by: drfaust92 --- charts/prometheus-elasticsearch-exporter/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/prometheus-elasticsearch-exporter/Chart.yaml b/charts/prometheus-elasticsearch-exporter/Chart.yaml index ab28150b3b9a..daf6a25fb784 100644 --- a/charts/prometheus-elasticsearch-exporter/Chart.yaml +++ b/charts/prometheus-elasticsearch-exporter/Chart.yaml @@ -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 From 3b957bbd3c7e41d7181a000e62e3f45aee07f2c5 Mon Sep 17 00:00:00 2001 From: Ilia Lazebnik Date: Sun, 18 Feb 2024 03:06:49 +0200 Subject: [PATCH 06/13] Update charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml Co-authored-by: zeritti <47476160+zeritti@users.noreply.github.com> Signed-off-by: Ilia Lazebnik --- .../prometheus-elasticsearch-exporter/templates/podmonitor.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml b/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml index b7785611d108..ff607a8b7df7 100644 --- a/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml +++ b/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml @@ -39,7 +39,7 @@ spec: {{- end }} {{- if .Values.podMonitor.relabelings }} relabelings: - {{- toYaml .Values.podMonitor.relabelings | nindent 8 }} + {{- toYaml .Values.podMonitor.relabelings | nindent 6 }} {{- end }} selector: matchLabels: From faaca1bf6efe10aeda131e1021e721426d4e51e1 Mon Sep 17 00:00:00 2001 From: Ilia Lazebnik Date: Sun, 18 Feb 2024 03:06:57 +0200 Subject: [PATCH 07/13] Update charts/prometheus-elasticsearch-exporter/values.yaml Co-authored-by: zeritti <47476160+zeritti@users.noreply.github.com> Signed-off-by: Ilia Lazebnik --- charts/prometheus-elasticsearch-exporter/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/prometheus-elasticsearch-exporter/values.yaml b/charts/prometheus-elasticsearch-exporter/values.yaml index d9d6677c04a6..770160a803a8 100644 --- a/charts/prometheus-elasticsearch-exporter/values.yaml +++ b/charts/prometheus-elasticsearch-exporter/values.yaml @@ -260,7 +260,7 @@ podMonitor: ## enabled: false labels: {} - interval: 10s + interval: 60s jobLabel: "" scrapeTimeout: 10s honorLabels: true From 5783c445f44dc15741d10c2ed5a66502e3ab2a09 Mon Sep 17 00:00:00 2001 From: Ilia Lazebnik Date: Sun, 18 Feb 2024 03:07:02 +0200 Subject: [PATCH 08/13] Update charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml Co-authored-by: zeritti <47476160+zeritti@users.noreply.github.com> Signed-off-by: Ilia Lazebnik --- .../prometheus-elasticsearch-exporter/templates/podmonitor.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml b/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml index ff607a8b7df7..fa9a89be7793 100644 --- a/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml +++ b/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml @@ -35,7 +35,7 @@ spec: {{- end }} {{- if .Values.podMonitor.metricRelabelings }} metricRelabelings: - {{- toYaml .Values.podMonitor.metricRelabelings | nindent 8 }} + {{- toYaml .Values.podMonitor.metricRelabelings | nindent 6 }} {{- end }} {{- if .Values.podMonitor.relabelings }} relabelings: From 13cd913496c2fc134d0dfe8f9e99638b4c49775c Mon Sep 17 00:00:00 2001 From: Ilia Lazebnik Date: Sun, 18 Feb 2024 03:07:09 +0200 Subject: [PATCH 09/13] Update charts/prometheus-elasticsearch-exporter/values.yaml Co-authored-by: zeritti <47476160+zeritti@users.noreply.github.com> Signed-off-by: Ilia Lazebnik --- charts/prometheus-elasticsearch-exporter/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/prometheus-elasticsearch-exporter/values.yaml b/charts/prometheus-elasticsearch-exporter/values.yaml index 770160a803a8..17f36eedaa5a 100644 --- a/charts/prometheus-elasticsearch-exporter/values.yaml +++ b/charts/prometheus-elasticsearch-exporter/values.yaml @@ -256,7 +256,7 @@ serviceMonitor: podMonitor: ## If true, a PodMonitor CRD is created for a Prometheus Operator - ## https://github.com/coreos/prometheus-operator + ## https://prometheus-operator.dev/docs/operator/api/#monitoring.coreos.com/v1.PodMonitor ## enabled: false labels: {} From 2a9ba4494f19094ba9eefefeb1e88558d66e6444 Mon Sep 17 00:00:00 2001 From: Ilia Lazebnik Date: Sun, 18 Feb 2024 03:07:17 +0200 Subject: [PATCH 10/13] Update charts/prometheus-elasticsearch-exporter/values.yaml Co-authored-by: zeritti <47476160+zeritti@users.noreply.github.com> Signed-off-by: Ilia Lazebnik --- charts/prometheus-elasticsearch-exporter/values.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/charts/prometheus-elasticsearch-exporter/values.yaml b/charts/prometheus-elasticsearch-exporter/values.yaml index 17f36eedaa5a..acb06b94d127 100644 --- a/charts/prometheus-elasticsearch-exporter/values.yaml +++ b/charts/prometheus-elasticsearch-exporter/values.yaml @@ -82,7 +82,6 @@ service: deployment: annotations: {} labels: {} - httpPort: 9108 metricsPort: name: http From 5b324ae6e0cbc9c9927cdaa242c4f10bfcad5d45 Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Sun, 18 Feb 2024 03:26:12 +0200 Subject: [PATCH 11/13] CR comments Signed-off-by: drfaust92 --- .../templates/podmonitor.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml b/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml index fa9a89be7793..68af1cde4788 100644 --- a/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml +++ b/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml @@ -24,6 +24,9 @@ spec: 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 }} @@ -45,4 +48,4 @@ spec: matchLabels: app: {{ template "elasticsearch-exporter.name" . }} release: "{{ .Release.Name }}" -{{- end }} \ No newline at end of file +{{- end }} From d505185a240719a76acfcde68d0c8b1a97687f2b Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Sun, 18 Feb 2024 14:16:40 +0200 Subject: [PATCH 12/13] remove job label Signed-off-by: drfaust92 --- .../prometheus-elasticsearch-exporter/templates/podmonitor.yaml | 1 - charts/prometheus-elasticsearch-exporter/values.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml b/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml index 68af1cde4788..fe4fb30cc615 100644 --- a/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml +++ b/charts/prometheus-elasticsearch-exporter/templates/podmonitor.yaml @@ -17,7 +17,6 @@ metadata: {{- toYaml .Values.podMonitor.labels | nindent 4 }} {{- end }} spec: - jobLabel: {{ default .Release.Name .Values.podMonitor.jobLabel }} namespaceSelector: matchNames: - {{ .Release.Namespace }} diff --git a/charts/prometheus-elasticsearch-exporter/values.yaml b/charts/prometheus-elasticsearch-exporter/values.yaml index acb06b94d127..84595dbd02ac 100644 --- a/charts/prometheus-elasticsearch-exporter/values.yaml +++ b/charts/prometheus-elasticsearch-exporter/values.yaml @@ -260,7 +260,6 @@ podMonitor: enabled: false labels: {} interval: 60s - jobLabel: "" scrapeTimeout: 10s honorLabels: true scheme: http From 45282c494afe256dce0c21bf69c064cb55ba6c5b Mon Sep 17 00:00:00 2001 From: Ilia Lazebnik Date: Tue, 20 Feb 2024 23:06:06 +0200 Subject: [PATCH 13/13] Update charts/prometheus-elasticsearch-exporter/values.yaml Co-authored-by: zeritti <47476160+zeritti@users.noreply.github.com> Signed-off-by: Ilia Lazebnik --- charts/prometheus-elasticsearch-exporter/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/prometheus-elasticsearch-exporter/values.yaml b/charts/prometheus-elasticsearch-exporter/values.yaml index 84595dbd02ac..456731379f4e 100644 --- a/charts/prometheus-elasticsearch-exporter/values.yaml +++ b/charts/prometheus-elasticsearch-exporter/values.yaml @@ -258,6 +258,7 @@ podMonitor: ## https://prometheus-operator.dev/docs/operator/api/#monitoring.coreos.com/v1.PodMonitor ## enabled: false + namespace: "" labels: {} interval: 60s scrapeTimeout: 10s