You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by ab...@apache.org on 2023/02/14 10:10:21 UTC

[druid] branch master updated: Support prometheus emitter (#13531)

This is an automated email from the ASF dual-hosted git repository.

abhishek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new f3e19f69bb Support prometheus emitter (#13531)
f3e19f69bb is described below

commit f3e19f69bbf14a978afc8cd347fbe04df92e6ef8
Author: 서재권(Data Platform) <90...@users.noreply.github.com>
AuthorDate: Tue Feb 14 19:10:07 2023 +0900

    Support prometheus emitter (#13531)
    
    modify helm chart to support scraping from prometheus automatically
---
 helm/druid/README.md                                |  3 +++
 helm/druid/templates/broker/deployment.yaml         | 12 +++++++++++-
 helm/druid/templates/coordinator/deployment.yaml    | 12 +++++++++++-
 helm/druid/templates/historical/statefulset.yaml    | 14 ++++++++++++--
 helm/druid/templates/middleManager/statefulset.yaml | 16 +++++++++++++---
 helm/druid/templates/overlord/deployment.yaml       | 12 +++++++++++-
 helm/druid/templates/router/deployment.yaml         | 12 +++++++++++-
 helm/druid/values.yaml                              |  7 +++++++
 8 files changed, 79 insertions(+), 9 deletions(-)

diff --git a/helm/druid/README.md b/helm/druid/README.md
index 1d985f9226..64274a71d7 100644
--- a/helm/druid/README.md
+++ b/helm/druid/README.md
@@ -210,5 +210,8 @@ The following table lists the configurable parameters of the Druid chart and the
 | `router.ingress.path`                    | path of the router api                                  | `/`                                        |
 | `router.ingress.annotations`             | annotations for the router api ingress                  | `{}`                                       |
 | `router.ingress.tls`                     | TLS configuration for the ingress                        | `[]`                                       |
+| `prometheus.enabled`                     | Support scraping from prometheus                     | `false`                                                       |
+| `prometheus.port`                        | expose prometheus port                               | `9090`                                                        |
+| `prometheus.annotation`                  | pods annotation to notify prometheus scraping        | `{prometheus.io/scrape: "true", prometheus.io/port: "9090"}`  |
 
 Full and up-to-date documentation can be found in the comments of the `values.yaml` file.
diff --git a/helm/druid/templates/broker/deployment.yaml b/helm/druid/templates/broker/deployment.yaml
index d320cf1cbf..fa87515e90 100644
--- a/helm/druid/templates/broker/deployment.yaml
+++ b/helm/druid/templates/broker/deployment.yaml
@@ -41,10 +41,15 @@ spec:
         app: {{ include "druid.name" . }}
         release: {{ .Release.Name }}
         component: {{ .Values.broker.name }}
-      {{- with .Values.broker.podAnnotations }}
       annotations:
+      {{- with .Values.broker.podAnnotations }}
+{{ toYaml . | indent 8 }}
+      {{- end }}
+      {{- if .Values.prometheus.enabled }}
+      {{- with .Values.prometheus.annotation }}
 {{ toYaml . | indent 8 }}
       {{- end }}
+      {{- end }}
     spec:
       containers:
         - name: {{ .Chart.Name }}
@@ -67,6 +72,11 @@ spec:
             - name: http
               containerPort: {{ .Values.broker.port }}
               protocol: TCP
+            {{- if .Values.prometheus.enabled }}
+            - name: prometheus
+              containerPort: {{ .Values.prometheus.port }}
+              protocol: TCP
+            {{- end }}
           livenessProbe:
             initialDelaySeconds: 60
             httpGet:
diff --git a/helm/druid/templates/coordinator/deployment.yaml b/helm/druid/templates/coordinator/deployment.yaml
index fc26757ef2..affc0ff522 100644
--- a/helm/druid/templates/coordinator/deployment.yaml
+++ b/helm/druid/templates/coordinator/deployment.yaml
@@ -41,10 +41,15 @@ spec:
         app: {{ include "druid.name" . }}
         release: {{ .Release.Name }}
         component: {{ .Values.coordinator.name }}
-      {{- with .Values.coordinator.podAnnotations }}
       annotations:
+      {{- with .Values.coordinator.podAnnotations }}
+{{ toYaml . | indent 8 }}
+      {{- end }}
+      {{- if .Values.prometheus.enabled }}
+      {{- with .Values.prometheus.annotation }}
 {{ toYaml . | indent 8 }}
       {{- end }}
+      {{- end }}
     spec:
       containers:
         - name: {{ .Chart.Name }}
@@ -67,6 +72,11 @@ spec:
             - name: http
               containerPort: {{ .Values.coordinator.port }}
               protocol: TCP
+            {{- if .Values.prometheus.enabled }}
+            - name: prometheus
+              containerPort: {{ .Values.prometheus.port }}
+              protocol: TCP
+            {{- end }}
           livenessProbe:
             initialDelaySeconds: 60
             httpGet:
diff --git a/helm/druid/templates/historical/statefulset.yaml b/helm/druid/templates/historical/statefulset.yaml
index 1a575ac720..8f56f9039e 100644
--- a/helm/druid/templates/historical/statefulset.yaml
+++ b/helm/druid/templates/historical/statefulset.yaml
@@ -42,10 +42,15 @@ spec:
         app: {{ template "druid.name" . }}
         component: {{ .Values.historical.name }}
         release: {{ .Release.Name }}
-        {{- with .Values.historical.podAnnotations }}
       annotations:
+      {{- with .Values.historical.podAnnotations }}
 {{ toYaml . | indent 8 }}
-        {{- end }}
+      {{- end }}
+      {{- if .Values.prometheus.enabled }}
+      {{- with .Values.prometheus.annotation }}
+{{ toYaml . | indent 8 }}
+      {{- end }}
+      {{- end }}
     spec:
       {{- if or .Values.historical.antiAffinity .Values.historical.nodeAffinity }}
       affinity:
@@ -123,6 +128,11 @@ spec:
         ports:
         - containerPort: {{ .Values.historical.port }}
           name: http
+        {{- if .Values.prometheus.enabled }}
+        - name: prometheus
+          containerPort: {{ .Values.prometheus.port }}
+          protocol: TCP
+        {{- end }}
         volumeMounts:
         - mountPath: /opt/druid/var/druid/
           name: data
diff --git a/helm/druid/templates/middleManager/statefulset.yaml b/helm/druid/templates/middleManager/statefulset.yaml
index 827ed561fe..87da92995e 100644
--- a/helm/druid/templates/middleManager/statefulset.yaml
+++ b/helm/druid/templates/middleManager/statefulset.yaml
@@ -42,10 +42,15 @@ spec:
         app: {{ template "druid.name" . }}
         component: {{ .Values.middleManager.name }}
         release: {{ .Release.Name }}
-        {{- if .Values.middleManager.podAnnotations }}
       annotations:
-{{ toYaml .Values.middleManager.podAnnotations | indent 8 }}
-        {{- end }}
+      {{- with .Values.middleManager.podAnnotations }}
+{{ toYaml . | indent 8 }}
+      {{- end }}
+      {{- if .Values.prometheus.enabled }}
+      {{- with .Values.prometheus.annotation }}
+{{ toYaml . | indent 8 }}
+      {{- end }}
+      {{- end }}
     spec:
       {{- if or .Values.middleManager.antiAffinity .Values.middleManager.nodeAffinity }}
       affinity:
@@ -123,6 +128,11 @@ spec:
         ports:
         - containerPort: {{ .Values.middleManager.port }}
           name: http
+        {{- if .Values.prometheus.enabled}}
+        - name: prometheus
+          containerPort: {{ .Values.prometheus.port }}
+          protocol: TCP
+        {{- end }}
         volumeMounts:
         - mountPath: /opt/druid/var/druid/
           name: data
diff --git a/helm/druid/templates/overlord/deployment.yaml b/helm/druid/templates/overlord/deployment.yaml
index 8eebbe2b3a..20b096bb6c 100644
--- a/helm/druid/templates/overlord/deployment.yaml
+++ b/helm/druid/templates/overlord/deployment.yaml
@@ -41,10 +41,15 @@ spec:
         app: {{ include "druid.name" . }}
         release: {{ .Release.Name }}
         component: {{ .Values.overlord.name }}
-      {{- with .Values.overlord.podAnnotations }}
       annotations:
+      {{- with .Values.overlord.podAnnotations }}
+{{ toYaml . | indent 8 }}
+      {{- end }}
+      {{- if .Values.prometheus.enabled }}
+      {{- with .Values.prometheus.annotation }}
 {{ toYaml . | indent 8 }}
       {{- end }}
+      {{- end }}
     spec:
       containers:
         - name: {{ .Chart.Name }}
@@ -67,6 +72,11 @@ spec:
             - name: http
               containerPort: {{ .Values.overlord.port }}
               protocol: TCP
+            {{- if .Values.prometheus.enabled }}
+            - name: prometheus
+              containerPort: {{ .Values.prometheus.port }}
+              protocol: TCP
+            {{- end }}
           livenessProbe:
             initialDelaySeconds: 60
             httpGet:
diff --git a/helm/druid/templates/router/deployment.yaml b/helm/druid/templates/router/deployment.yaml
index 31e2728582..d2f9e7d8ed 100644
--- a/helm/druid/templates/router/deployment.yaml
+++ b/helm/druid/templates/router/deployment.yaml
@@ -41,10 +41,15 @@ spec:
         app: {{ include "druid.name" . }}
         release: {{ .Release.Name }}
         component: {{ .Values.router.name }}
-      {{- with .Values.router.podAnnotations }}
       annotations:
+      {{- with .Values.router.podAnnotations }}
+{{ toYaml . | indent 8 }}
+      {{- end }}
+      {{- if .Values.prometheus.enabled }}
+      {{- with .Values.prometheus.annotation }}
 {{ toYaml . | indent 8 }}
       {{- end }}
+      {{- end }}
     spec:
       containers:
         - name: {{ .Chart.Name }}
@@ -67,6 +72,11 @@ spec:
             - name: http
               containerPort: {{ .Values.router.port }}
               protocol: TCP
+            {{- if .Values.prometheus.enabled }}
+            - name: prometheus
+              containerPort: {{ .Values.prometheus.port }}
+              protocol: TCP
+            {{- end }}
           livenessProbe:
             initialDelaySeconds: 60
             httpGet:
diff --git a/helm/druid/values.yaml b/helm/druid/values.yaml
index f710f012ab..f7dc218bd4 100644
--- a/helm/druid/values.yaml
+++ b/helm/druid/values.yaml
@@ -418,3 +418,10 @@ postgresql:
     port: 5432
 
 # Secrets
+prometheus:
+  enabled: false
+  #pick the any port what you want
+  port: 9090
+  annotation:
+    prometheus.io/scrape: "true"
+    prometheus.io/port: "9090"


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org