This is an automated email from the ASF dual-hosted git repository.
jinsongzhou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git
The following commit(s) were added to refs/heads/master by this push:
new 109b9a026 [AMORO-2932] fix prometheus exporter issues in helm chart
(#2933)
109b9a026 is described below
commit 109b9a026ec1d00f6ec5997e97b9e32f2f33e789
Author: Xavier Bai <[email protected]>
AuthorDate: Mon Jun 24 11:36:53 2024 +0800
[AMORO-2932] fix prometheus exporter issues in helm chart (#2933)
* [WAP] fix prometheus exporter issues in helm chart
* fix
---------
Co-authored-by: ZhouJinsong <[email protected]>
---
charts/amoro/templates/_pod.tpl | 17 +++++++++++++
charts/amoro/templates/amoro-configmap.yaml | 8 +++---
charts/amoro/templates/amoro-deployment.yaml | 7 +-----
charts/amoro/tests/amoro-configmap_test.yaml | 9 ++++---
charts/amoro/values.yaml | 37 +++++++++++-----------------
5 files changed, 40 insertions(+), 38 deletions(-)
diff --git a/charts/amoro/templates/_pod.tpl b/charts/amoro/templates/_pod.tpl
index b65cbcde1..7fe844be3 100644
--- a/charts/amoro/templates/_pod.tpl
+++ b/charts/amoro/templates/_pod.tpl
@@ -108,3 +108,20 @@ spark distribution package will be installed to here*/ -}}
{{- end -}}
{{- end -}}
{{- /* define "amoro.pod.volumes" end */ -}}
+
+{{- /* define ports for each pod */ -}}
+{{- define "amoro.pod.container.ports" -}}
+- name: rest
+ containerPort: {{ .Values.server.rest.port }}
+- name: table
+ containerPort: {{ .Values.server.table.port }}
+- name: optimizing
+ containerPort: {{ .Values.server.optimizing.port }}
+{{- if .Values.plugin.metricReporters }}
+{{- if .Values.plugin.metricReporters.prometheusExporter.enabled }}
+- name: prometheus
+ containerPort: {{ .Values.plugin.metricReporters.prometheusExporter.port }}
+{{- end -}}
+{{- end -}}
+{{- end -}}
+{{- /* define amoro.pod.container.ports end */ -}}
\ No newline at end of file
diff --git a/charts/amoro/templates/amoro-configmap.yaml
b/charts/amoro/templates/amoro-configmap.yaml
index 7330b980a..1ffb9710d 100644
--- a/charts/amoro/templates/amoro-configmap.yaml
+++ b/charts/amoro/templates/amoro-configmap.yaml
@@ -30,12 +30,10 @@ data:
## Helm chart provided metric reporters configurations
metric-reporters.yaml: |
metric-reporters:
- {{- range . }}
- - name: {{ .name }}
- enabled: {{ .enabled }}
+ - name: {{ .prometheusExporter.name }}
+ enabled: {{ .prometheusExporter.enabled }}
properties:
- {{ .properties | toYaml | nindent 10 | trim}}
- {{- end }}
+ {{ .prometheusExporter.properties | toYaml | nindent 10 | trim }}
{{- end }}
## Helm chart provided Amoro configurations
config.yaml: |
diff --git a/charts/amoro/templates/amoro-deployment.yaml
b/charts/amoro/templates/amoro-deployment.yaml
index ee46076ec..da9397b71 100644
--- a/charts/amoro/templates/amoro-deployment.yaml
+++ b/charts/amoro/templates/amoro-deployment.yaml
@@ -79,12 +79,7 @@ spec: {{/* TODO If Support Replica can be use more than 1
*/}}
{{- tpl (toYaml .) $ | nindent 12 }}
{{- end }}
ports:
- - name: rest
- containerPort: {{ .Values.server.rest.port }}
- - name: table
- containerPort: {{ .Values.server.table.port }}
- - name: optimizing
- containerPort: {{ .Values.server.optimizing.port }}
+ {{- include "amoro.pod.container.ports" . | nindent 12 }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
diff --git a/charts/amoro/tests/amoro-configmap_test.yaml
b/charts/amoro/tests/amoro-configmap_test.yaml
index d4fb8c265..73a5fe97c 100644
--- a/charts/amoro/tests/amoro-configmap_test.yaml
+++ b/charts/amoro/tests/amoro-configmap_test.yaml
@@ -113,13 +113,14 @@ tests:
set:
plugin:
metricReporters:
- - name: prometheus-exporter
+ prometheusExporter:
+ name: prometheus-exporter
enabled: true
- properties:
- port: 7001
+ port: 7001
+ properties: ~
asserts:
- matchRegex:
path: data["metric-reporters.yaml"]
pattern:
|
- - name: prometheus-exporter
\ No newline at end of file
+ name: prometheus-exporter
\ No newline at end of file
diff --git a/charts/amoro/values.yaml b/charts/amoro/values.yaml
index ae085dbee..c906887b8 100644
--- a/charts/amoro/values.yaml
+++ b/charts/amoro/values.yaml
@@ -274,29 +274,20 @@ plugin:
##
metricReporters: ~
## e.g:
-## metricReporters:
-## ## @param Configure Prometheus exporter
-## ##
-## - name: prometheus-exporter
-## ## @param Enable or disable the Prometheus exporter
-## ##
-## enabled: true
-## ## @param Properties for the Prometheus exporter
-## ##
-## properties:
-## port: 7001
-## ## @param Kubernetes service configuration for the Prometheus exporter
-## ## ref:
https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/
-## ##
-## service:
-## type: ClusterIP
-## port: "7001"
-## nodePort: ~
-## annotations: {
-## "prometheus.io/scrape": "true",
-## "prometheus.io/path": "/metrics",
-## "prometheus.io/port": "7001"
-## }
+# metricReporters:
+# ## @param Configure Prometheus exporter
+# ##
+# prometheusExporter:
+# name: prometheus-exporter
+# ## @param Enable or disable the Prometheus exporter
+# ##
+# enabled: true
+# ## @param Prometheus port
+# ##
+# port: 7001
+# ## @param Properties for the Prometheus exporter
+# ##
+# properties: ~
## Configure the ingress resource that allows you to access the
## Amoro installation. Set up the URL