From e6279ad5898afc67aab1941625894d9c1855da2f Mon Sep 17 00:00:00 2001 From: Jason Witkowski Date: Tue, 28 Mar 2023 10:26:45 -0400 Subject: [PATCH] helm: Add metrics port exposure via service and Prometheus ServiceMonitors Signed-off-by: Jason Witkowski --- helm/druid/Chart.yaml | 2 +- helm/druid/README.md | 12 ++++++ helm/druid/templates/broker/service.yaml | 8 +++- .../templates/broker/serviceMonitor.yaml | 41 +++++++++++++++++++ helm/druid/templates/coordinator/service.yaml | 8 +++- .../templates/coordinator/serviceMonitor.yaml | 41 +++++++++++++++++++ helm/druid/templates/historical/service.yaml | 8 +++- .../templates/historical/serviceMonitor.yaml | 41 +++++++++++++++++++ .../templates/middleManager/service.yaml | 8 +++- .../middleManager/serviceMonitor.yaml | 41 +++++++++++++++++++ helm/druid/templates/overlord/service.yaml | 6 +++ .../templates/overlord/serviceMonitor.yaml | 41 +++++++++++++++++++ helm/druid/templates/router/service.yaml | 6 +++ .../templates/router/serviceMonitor.yaml | 41 +++++++++++++++++++ helm/druid/values.yaml | 30 ++++++++++++++ 15 files changed, 329 insertions(+), 5 deletions(-) create mode 100644 helm/druid/templates/broker/serviceMonitor.yaml create mode 100644 helm/druid/templates/coordinator/serviceMonitor.yaml create mode 100644 helm/druid/templates/historical/serviceMonitor.yaml create mode 100644 helm/druid/templates/middleManager/serviceMonitor.yaml create mode 100644 helm/druid/templates/overlord/serviceMonitor.yaml create mode 100644 helm/druid/templates/router/serviceMonitor.yaml diff --git a/helm/druid/Chart.yaml b/helm/druid/Chart.yaml index aeb629d9fcf2..5244f7d0afd2 100644 --- a/helm/druid/Chart.yaml +++ b/helm/druid/Chart.yaml @@ -30,7 +30,7 @@ dependencies: version: 8.6.4 repository: https://charts.helm.sh/stable condition: postgresql.enabled -version: 0.3.5 +version: 0.3.6 home: https://druid.apache.org/ icon: https://druid.apache.org/img/favicon.png sources: diff --git a/helm/druid/README.md b/helm/druid/README.md index 85c72ef2a818..068fa75b09d8 100644 --- a/helm/druid/README.md +++ b/helm/druid/README.md @@ -109,6 +109,8 @@ The following table lists the configurable parameters of the Druid chart and the | `broker.serviceType` | service type for service | `ClusterIP` | | `broker.resources` | broker node resources requests & limits | `{}` | | `broker.podAnnotations` | broker deployment annotations | `{}` | +| `broker.metrics.port` | Service port to expose metrics on | `8080` | +| `broker.metrics.serviceMonitor.enabled` | Create Prometheus serviceMonitor resource | `false` | | `broker.nodeSelector` | Node labels for broker pod assignment | `{}` | | `broker.tolerations` | broker tolerations | `[]` | | `broker.config` | broker private config such as `JAVA_OPTS` | | @@ -130,6 +132,8 @@ The following table lists the configurable parameters of the Druid chart and the | `coordinator.serviceAccount.automountServiceAccountToken` | Automount API credentials for the Service Account | `true` | | `coordinator.resources` | coordinator node resources requests & limits | `{}` | | `coordinator.podAnnotations` | coordinator Deployment annotations | `{}` | +| `coordinator.metrics.port` | Service port to expose metrics on | `8080` | +| `coordinator.metrics.serviceMonitor.enabled` | Create Prometheus serviceMonitor resource | `false` | | `coordinator.nodeSelector` | node labels for coordinator pod assignment | `{}` | | `coordinator.tolerations` | coordinator tolerations | `[]` | | `coordinator.config` | coordinator private config such as `JAVA_OPTS` | | @@ -151,6 +155,8 @@ The following table lists the configurable parameters of the Druid chart and the | `overlord.serviceAccount.automountServiceAccountToken` | Automount API credentials for the Service Account | `true` | | `overlord.resources` | overlord node resources requests & limits | `{}` | | `overlord.podAnnotations` | overlord Deployment annotations | `{}` | +| `overlord.metrics.port` | Service port to expose metrics on | `8080` | +| `overlord.metrics.serviceMonitor.enabled`| Create Prometheus serviceMonitor resource | `false` | | `overlord.nodeSelector` | node labels for overlord pod assignment | `{}` | | `overlord.tolerations` | overlord tolerations | `[]` | | `overlord.config` | overlord private config such as `JAVA_OPTS` | | @@ -174,6 +180,8 @@ The following table lists the configurable parameters of the Druid chart and the | `historical.livenessProbeInitialDelaySeconds` | historical node liveness probe initial delay in seconds | `60` | | `historical.readinessProbeInitialDelaySeconds` | historical node readiness probe initial delay in seconds | `60` | | `historical.podAnnotations` | historical Deployment annotations | `{}` | +| `historical.metrics.port` | Service port to expose metrics on | `8080` | +| `historical.metrics.serviceMonitor.enabled`| Create Prometheus serviceMonitor resource | `false` | | `historical.nodeSelector` | node labels for historical pod assignment | `{}` | | `historical.securityContext` | custom security context for historical containers | `{ fsGroup: 1000 }` | | `historical.tolerations` | historical tolerations | `[]` | @@ -201,6 +209,8 @@ The following table lists the configurable parameters of the Druid chart and the | `middleManager.serviceAccount.automountServiceAccountToken` | Automount API credentials for the Service Account | `true` | | `middleManager.resources` | middleManager node resources requests & limits | `{}` | | `middleManager.podAnnotations` | middleManager Deployment annotations | `{}` | +| `middleManager.metrics.port` | Service port to expose metrics on | `8080` | +| `middleManager.metrics.serviceMonitor.enabled`| Create Prometheus serviceMonitor resource | `false` | | `middleManager.nodeSelector` | Node labels for middleManager pod assignment | `{}` | | `middleManager.securityContext` | custom security context for middleManager containers | `{ fsGroup: 1000 }` | | `middleManager.tolerations` | middleManager tolerations | `[]` | @@ -232,6 +242,8 @@ The following table lists the configurable parameters of the Druid chart and the | `router.serviceAccount.automountServiceAccountToken` | Automount API credentials for the Service Account | `true` | | `router.resources` | router node resources requests & limits | `{}` | | `router.podAnnotations` | router Deployment annotations | `{}` | +| `router.metrics.port` | Service port to expose metrics on | `8080` | +| `router.metrics.serviceMonitor.enabled` | Create Prometheus serviceMonitor resource | `false` | | `router.nodeSelector` | node labels for router pod assignment | `{}` | | `router.tolerations` | router tolerations | `[]` | | `router.config` | router private config such as `JAVA_OPTS` | | diff --git a/helm/druid/templates/broker/service.yaml b/helm/druid/templates/broker/service.yaml index 4c767855340e..0f08a7f53a91 100644 --- a/helm/druid/templates/broker/service.yaml +++ b/helm/druid/templates/broker/service.yaml @@ -35,8 +35,14 @@ spec: targetPort: http protocol: TCP name: http + {{- if and .Values.broker.metrics.port (or .Values.broker.config.druid_emitter_prometheus_port .Values.configVars.druid_emitter_prometheus_port) }} + - port: {{ .Values.broker.metrics.port }} + targetPort: {{ default .Values.configVars.druid_emitter_prometheus_port .Values.broker.config.druid_emitter_prometheus_port }} + protocol: TCP + name: druid-metrics + {{- end }} selector: app: {{ include "druid.name" . }} release: {{ .Release.Name }} component: {{ .Values.broker.name }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/helm/druid/templates/broker/serviceMonitor.yaml b/helm/druid/templates/broker/serviceMonitor.yaml new file mode 100644 index 000000000000..d78ea72cafdf --- /dev/null +++ b/helm/druid/templates/broker/serviceMonitor.yaml @@ -0,0 +1,41 @@ +{{/* + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/}} +{{- if and .Values.broker.enabled .Values.broker.metrics.port .Values.broker.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "druid.broker.fullname" . }} + labels: + app: {{ include "druid.name" . }} + chart: {{ include "druid.chart" . }} + component: {{ .Values.broker.name }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + selector: + matchLabels: + app: {{ include "druid.name" . }} + component: {{ .Values.broker.name }} + endpoints: + - port: druid-metrics + interval: 20s + path: /metrics + scheme: http + honorLabels: true +{{- end }} diff --git a/helm/druid/templates/coordinator/service.yaml b/helm/druid/templates/coordinator/service.yaml index 953b03fec675..de8be171958d 100644 --- a/helm/druid/templates/coordinator/service.yaml +++ b/helm/druid/templates/coordinator/service.yaml @@ -35,8 +35,14 @@ spec: targetPort: http protocol: TCP name: http + {{- if and .Values.coordinator.metrics.port (or .Values.coordinator.config.druid_emitter_prometheus_port .Values.configVars.druid_emitter_prometheus_port) }} + - port: {{ .Values.coordinator.metrics.port }} + targetPort: {{ default .Values.configVars.druid_emitter_prometheus_port .Values.coordinator.config.druid_emitter_prometheus_port }} + protocol: TCP + name: druid-metrics + {{- end }} selector: app: {{ include "druid.name" . }} release: {{ .Release.Name }} component: {{ .Values.coordinator.name }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/helm/druid/templates/coordinator/serviceMonitor.yaml b/helm/druid/templates/coordinator/serviceMonitor.yaml new file mode 100644 index 000000000000..3b3343321b56 --- /dev/null +++ b/helm/druid/templates/coordinator/serviceMonitor.yaml @@ -0,0 +1,41 @@ +{{/* + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/}} +{{- if and .Values.coordinator.enabled .Values.coordinator.metrics.port .Values.coordinator.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "druid.coordinator.fullname" . }} + labels: + app: {{ include "druid.name" . }} + chart: {{ include "druid.chart" . }} + component: {{ .Values.coordinator.name }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + selector: + matchLabels: + app: {{ include "druid.name" . }} + component: {{ .Values.coordinator.name }} + endpoints: + - port: druid-metrics + interval: 20s + path: /metrics + scheme: http + honorLabels: true +{{- end }} diff --git a/helm/druid/templates/historical/service.yaml b/helm/druid/templates/historical/service.yaml index 2ccbe539bc78..2940afa849a3 100644 --- a/helm/druid/templates/historical/service.yaml +++ b/helm/druid/templates/historical/service.yaml @@ -35,8 +35,14 @@ spec: targetPort: http protocol: TCP name: http + {{- if and .Values.historical.metrics.port (or .Values.historical.config.druid_emitter_prometheus_port .Values.configVars.druid_emitter_prometheus_port) }} + - port: {{ .Values.historical.metrics.port }} + targetPort: {{ default .Values.configVars.druid_emitter_prometheus_port .Values.historical.config.druid_emitter_prometheus_port }} + protocol: TCP + name: druid-metrics + {{- end }} selector: app: {{ include "druid.name" . }} release: {{ .Release.Name }} component: {{ .Values.historical.name }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/helm/druid/templates/historical/serviceMonitor.yaml b/helm/druid/templates/historical/serviceMonitor.yaml new file mode 100644 index 000000000000..54cbf1fc6363 --- /dev/null +++ b/helm/druid/templates/historical/serviceMonitor.yaml @@ -0,0 +1,41 @@ +{{/* + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/}} +{{- if and .Values.historical.enabled .Values.historical.metrics.port .Values.historical.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "druid.historical.fullname" . }} + labels: + app: {{ include "druid.name" . }} + chart: {{ include "druid.chart" . }} + component: {{ .Values.historical.name }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + selector: + matchLabels: + app: {{ include "druid.name" . }} + component: {{ .Values.historical.name }} + endpoints: + - port: druid-metrics + interval: 20s + path: /metrics + scheme: http + honorLabels: true +{{- end }} diff --git a/helm/druid/templates/middleManager/service.yaml b/helm/druid/templates/middleManager/service.yaml index a0817015150c..18339414272f 100644 --- a/helm/druid/templates/middleManager/service.yaml +++ b/helm/druid/templates/middleManager/service.yaml @@ -35,8 +35,14 @@ spec: targetPort: http protocol: TCP name: http + {{- if and .Values.middleManager.metrics.port (or .Values.middleManager.config.druid_emitter_prometheus_port .Values.configVars.druid_emitter_prometheus_port) }} + - port: {{ .Values.middleManager.metrics.port }} + targetPort: {{ default .Values.configVars.druid_emitter_prometheus_port .Values.middleManager.config.druid_emitter_prometheus_port }} + protocol: TCP + name: druid-metrics + {{- end }} selector: app: {{ include "druid.name" . }} release: {{ .Release.Name }} component: {{ .Values.middleManager.name }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/helm/druid/templates/middleManager/serviceMonitor.yaml b/helm/druid/templates/middleManager/serviceMonitor.yaml new file mode 100644 index 000000000000..8c9becc129a1 --- /dev/null +++ b/helm/druid/templates/middleManager/serviceMonitor.yaml @@ -0,0 +1,41 @@ +{{/* + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/}} +{{- if and .Values.middleManager.enabled .Values.middleManager.metrics.port .Values.middleManager.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "druid.middleManager.fullname" . }} + labels: + app: {{ include "druid.name" . }} + chart: {{ include "druid.chart" . }} + component: {{ .Values.middleManager.name }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + selector: + matchLabels: + app: {{ include "druid.name" . }} + component: {{ .Values.middleManager.name }} + endpoints: + - port: druid-metrics + interval: 20s + path: /metrics + scheme: http + honorLabels: true +{{- end }} diff --git a/helm/druid/templates/overlord/service.yaml b/helm/druid/templates/overlord/service.yaml index 6a9b856d875c..43a8c27e9661 100644 --- a/helm/druid/templates/overlord/service.yaml +++ b/helm/druid/templates/overlord/service.yaml @@ -35,6 +35,12 @@ spec: targetPort: http protocol: TCP name: http + {{- if and .Values.overlord.metrics.port (or .Values.overlord.config.druid_emitter_prometheus_port .Values.configVars.druid_emitter_prometheus_port) }} + - port: {{ .Values.overlord.metrics.port }} + targetPort: {{ default .Values.configVars.druid_emitter_prometheus_port .Values.overlord.config.druid_emitter_prometheus_port }} + protocol: TCP + name: druid-metrics + {{- end }} selector: app: {{ include "druid.name" . }} release: {{ .Release.Name }} diff --git a/helm/druid/templates/overlord/serviceMonitor.yaml b/helm/druid/templates/overlord/serviceMonitor.yaml new file mode 100644 index 000000000000..45426948b10f --- /dev/null +++ b/helm/druid/templates/overlord/serviceMonitor.yaml @@ -0,0 +1,41 @@ +{{/* + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/}} +{{- if and .Values.overlord.enabled .Values.overlord.metrics.port .Values.overlord.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "druid.overlord.fullname" . }} + labels: + app: {{ include "druid.name" . }} + chart: {{ include "druid.chart" . }} + component: {{ .Values.overlord.name }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + selector: + matchLabels: + app: {{ include "druid.name" . }} + component: {{ .Values.overlord.name }} + endpoints: + - port: druid-metrics + interval: 20s + path: /metrics + scheme: http + honorLabels: true +{{- end }} diff --git a/helm/druid/templates/router/service.yaml b/helm/druid/templates/router/service.yaml index 07d3659c5a94..23c3f1751b74 100644 --- a/helm/druid/templates/router/service.yaml +++ b/helm/druid/templates/router/service.yaml @@ -35,6 +35,12 @@ spec: targetPort: http protocol: TCP name: http + {{- if and .Values.router.metrics.port (or .Values.router.config.druid_emitter_prometheus_port .Values.configVars.druid_emitter_prometheus_port) }} + - port: {{ .Values.router.metrics.port }} + targetPort: {{ default .Values.configVars.druid_emitter_prometheus_port .Values.router.config.druid_emitter_prometheus_port }} + protocol: TCP + name: druid-metrics + {{- end }} selector: app: {{ include "druid.name" . }} release: {{ .Release.Name }} diff --git a/helm/druid/templates/router/serviceMonitor.yaml b/helm/druid/templates/router/serviceMonitor.yaml new file mode 100644 index 000000000000..42877d39ff3e --- /dev/null +++ b/helm/druid/templates/router/serviceMonitor.yaml @@ -0,0 +1,41 @@ +{{/* + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/}} +{{- if and .Values.router.enabled .Values.router.metrics.port .Values.router.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "druid.router.fullname" . }} + labels: + app: {{ include "druid.name" . }} + chart: {{ include "druid.chart" . }} + component: {{ .Values.router.name }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + selector: + matchLabels: + app: {{ include "druid.name" . }} + component: {{ .Values.router.name }} + endpoints: + - port: druid-metrics + interval: 20s + path: /metrics + scheme: http + honorLabels: true +{{- end }} diff --git a/helm/druid/values.yaml b/helm/druid/values.yaml index dab6a49b807b..d7d8336d5cb1 100644 --- a/helm/druid/values.yaml +++ b/helm/druid/values.yaml @@ -107,6 +107,11 @@ broker: # -- Automount API credentials for the service account automountServiceAccountToken: true + metrics: + port: 8080 + serviceMonitor: + enabled: false + nodeSelector: {} tolerations: [] @@ -162,6 +167,11 @@ coordinator: # -- Automount API credentials for the service account automountServiceAccountToken: true + metrics: + port: 8080 + serviceMonitor: + enabled: false + nodeSelector: {} tolerations: [] @@ -208,6 +218,11 @@ overlord: # -- Automount API credentials for the service account automountServiceAccountToken: true + metrics: + port: 8080 + serviceMonitor: + enabled: false + nodeSelector: {} tolerations: [] @@ -285,6 +300,11 @@ historical: # -- Automount API credentials for the service account automountServiceAccountToken: true + metrics: + port: 8080 + serviceMonitor: + enabled: false + livenessProbeInitialDelaySeconds: 60 readinessProbeInitialDelaySeconds: 60 @@ -382,6 +402,11 @@ middleManager: # -- Automount API credentials for the service account automountServiceAccountToken: true + metrics: + port: 8080 + serviceMonitor: + enabled: false + ## (dict) If specified, apply these annotations to each master Pod podAnnotations: {} @@ -440,6 +465,11 @@ router: # -- Automount API credentials for the service account automountServiceAccountToken: true + metrics: + port: 8080 + serviceMonitor: + enabled: false + nodeSelector: {} tolerations: []