diff --git a/helm/druid/README.md b/helm/druid/README.md index 1d985f92264..64274a71d7c 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 d320cf1cbf4..fa87515e90e 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 fc26757ef22..affc0ff5223 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 1a575ac7202..8f56f9039e4 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 827ed561fe0..87da92995e0 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 8eebbe2b3ac..20b096bb6c3 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 31e27285828..d2f9e7d8ed0 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 f710f012ab3..f7dc218bd43 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"