You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by rx...@apache.org on 2020/07/23 02:34:49 UTC

[pulsar-helm-chart] branch master updated: Add zookeeper metrics port and PodMonitors (#44)

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

rxl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-helm-chart.git


The following commit(s) were added to refs/heads/master by this push:
     new 6b92881  Add zookeeper metrics port and PodMonitors (#44)
6b92881 is described below

commit 6b928811492f383c73cbf661cf878001d5b33930
Author: John Harris <jh...@users.noreply.github.com>
AuthorDate: Wed Jul 22 19:34:43 2020 -0700

    Add zookeeper metrics port and PodMonitors (#44)
    
    * Add 'http' port specification to zookeeper statefulset
    
    This makes the zookeeper spec inline with the other statefulset specs
    in this chart and it provides a port target for custom podMonitors
    
    * Added PodMonitors for bookie, broker, proxy, and zookeeper
    
    New PodMonitors are needed for prometheus-operator to pickup scrape
    targets.
    Defaults to disabled so users need to opt in to deploy
    
    * Added Apache license info to podmonitor yamls
---
 charts/pulsar/templates/bookkeeper-podmonitor.yaml | 42 ++++++++++++++++++++++
 charts/pulsar/templates/broker-podmonitor.yaml     | 42 ++++++++++++++++++++++
 charts/pulsar/templates/proxy-podmonitor.yaml      | 42 ++++++++++++++++++++++
 charts/pulsar/templates/zookeeper-podmonitor.yaml  | 42 ++++++++++++++++++++++
 charts/pulsar/templates/zookeeper-statefulset.yaml |  3 ++
 charts/pulsar/values.yaml                          | 25 +++++++++++++
 6 files changed, 196 insertions(+)

diff --git a/charts/pulsar/templates/bookkeeper-podmonitor.yaml b/charts/pulsar/templates/bookkeeper-podmonitor.yaml
new file mode 100644
index 0000000..bec86fe
--- /dev/null
+++ b/charts/pulsar/templates/bookkeeper-podmonitor.yaml
@@ -0,0 +1,42 @@
+#
+# 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.
+#
+
+# deploy bookkeeper PodMonitor only when `$.Values.bookkeeper.podMonitor.enabled` is true
+{{- if $.Values.bookkeeper.podMonitor.enabled }}
+apiVersion: monitoring.coreos.com/v1
+kind: PodMonitor
+metadata:
+  name: {{ template "pulsar.name" . }}-bookie
+  labels:
+    app: {{ template "pulsar.name" . }}
+    chart: {{ template "pulsar.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+spec:
+  jobLabel: bookie
+  podMetricsEndpoints:
+    - port: http
+      path: /metrics
+      scheme: http
+      interval: {{ $.Values.bookkeeper.podMonitor.interval }}
+      scrapeTimeout: {{ $.Values.bookkeeper.podMonitor.scrapeTimeout }}
+  selector:
+    matchLabels:
+      component: bookie
+{{- end }}
\ No newline at end of file
diff --git a/charts/pulsar/templates/broker-podmonitor.yaml b/charts/pulsar/templates/broker-podmonitor.yaml
new file mode 100644
index 0000000..c3474b2
--- /dev/null
+++ b/charts/pulsar/templates/broker-podmonitor.yaml
@@ -0,0 +1,42 @@
+#
+# 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.
+#
+
+# deploy broker PodMonitor only when `$.Values.broker.podMonitor.enabled` is true
+{{- if $.Values.broker.podMonitor.enabled }}
+apiVersion: monitoring.coreos.com/v1
+kind: PodMonitor
+metadata:
+  name: {{ template "pulsar.name" . }}-broker
+  labels:
+    app: {{ template "pulsar.name" . }}
+    chart: {{ template "pulsar.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+spec:
+  jobLabel: broker
+  podMetricsEndpoints:
+    - port: http
+      path: /metrics
+      scheme: http
+      interval: {{ $.Values.broker.podMonitor.interval }}
+      scrapeTimeout: {{ $.Values.broker.podMonitor.scrapeTimeout }}
+  selector:
+    matchLabels:
+      component: broker
+{{- end }}
\ No newline at end of file
diff --git a/charts/pulsar/templates/proxy-podmonitor.yaml b/charts/pulsar/templates/proxy-podmonitor.yaml
new file mode 100644
index 0000000..bf925bf
--- /dev/null
+++ b/charts/pulsar/templates/proxy-podmonitor.yaml
@@ -0,0 +1,42 @@
+#
+# 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.
+#
+
+# deploy proxy PodMonitor only when `$.Values.proxy.podMonitor.enabled` is true
+{{- if $.Values.proxy.podMonitor.enabled }}
+apiVersion: monitoring.coreos.com/v1
+kind: PodMonitor
+metadata:
+  name: {{ template "pulsar.name" . }}-proxy
+  labels:
+    app: {{ template "pulsar.name" . }}
+    chart: {{ template "pulsar.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+spec:
+  jobLabel: proxy
+  podMetricsEndpoints:
+    - port: http
+      path: /metrics
+      scheme: http
+      interval: {{ $.Values.proxy.podMonitor.interval }}
+      scrapeTimeout: {{ $.Values.proxy.podMonitor.scrapeTimeout }}
+  selector:
+    matchLabels:
+      component: proxy
+{{- end }}
\ No newline at end of file
diff --git a/charts/pulsar/templates/zookeeper-podmonitor.yaml b/charts/pulsar/templates/zookeeper-podmonitor.yaml
new file mode 100644
index 0000000..73b1267
--- /dev/null
+++ b/charts/pulsar/templates/zookeeper-podmonitor.yaml
@@ -0,0 +1,42 @@
+#
+# 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.
+#
+
+# deploy zookeeper PodMonitor only when `$.Values.zookeeper.podMonitor.enabled` is true
+{{- if $.Values.zookeeper.podMonitor.enabled }}
+apiVersion: monitoring.coreos.com/v1
+kind: PodMonitor
+metadata:
+  name: {{ template "pulsar.name" . }}-zookeeper
+  labels:
+    app: {{ template "pulsar.name" . }}
+    chart: {{ template "pulsar.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+spec:
+  jobLabel: zookeeper
+  podMetricsEndpoints:
+    - port: http
+      path: /metrics
+      scheme: http
+      interval: {{ $.Values.zookeeper.podMonitor.interval }}
+      scrapeTimeout: {{ $.Values.zookeeper.podMonitor.scrapeTimeout }}
+  selector:
+    matchLabels:
+      component: zookeeper
+{{- end }}
\ No newline at end of file
diff --git a/charts/pulsar/templates/zookeeper-statefulset.yaml b/charts/pulsar/templates/zookeeper-statefulset.yaml
index 598a3cf..c32678d 100644
--- a/charts/pulsar/templates/zookeeper-statefulset.yaml
+++ b/charts/pulsar/templates/zookeeper-statefulset.yaml
@@ -90,6 +90,9 @@ spec:
           bin/generate-zookeeper-config.sh conf/zookeeper.conf;
           bin/pulsar zookeeper;
         ports:
+        # prometheus needs to access /metrics endpoint
+        - name: http
+          containerPort: {{ .Values.zookeeper.ports.http }}
         - name: client
           containerPort: {{ .Values.zookeeper.ports.client }}
         - name: follower
diff --git a/charts/pulsar/values.yaml b/charts/pulsar/values.yaml
index 2405432..a9a5735 100644
--- a/charts/pulsar/values.yaml
+++ b/charts/pulsar/values.yaml
@@ -253,7 +253,14 @@ zookeeper:
   updateStrategy:
     type: RollingUpdate
   podManagementPolicy: OrderedReady
+  # If using Prometheus-Operator enable this PodMonitor to discover zookeeper scrape targets
+  # Prometheus-Operator does not add scrape targets based on k8s annotations
+  podMonitor:
+    enabled: false
+    interval: 10s
+    scrapeTimeout: 10s
   ports:
+    http: 8000
     client: 2181
     clientTls: 2281
     follower: 2888
@@ -355,6 +362,12 @@ bookkeeper:
   updateStrategy:
     type: RollingUpdate
   podManagementPolicy: Parallel
+  # If using Prometheus-Operator enable this PodMonitor to discover bookie scrape targets
+  # Prometheus-Operator does not add scrape targets based on k8s annotations
+  podMonitor:
+    enabled: false
+    interval: 10s
+    scrapeTimeout: 10s
   ports:
     http: 8000
     bookie: 3181
@@ -523,6 +536,12 @@ broker:
   # so the metrics are correctly rendered in grafana dashboard
   component: broker
   replicaCount: 3
+  # If using Prometheus-Operator enable this PodMonitor to discover broker scrape targets
+  # Prometheus-Operator does not add scrape targets based on k8s annotations
+  podMonitor:
+    enabled: false
+    interval: 10s
+    scrapeTimeout: 10s
   ports:
     http: 8080
     https: 8443
@@ -609,6 +628,12 @@ proxy:
   # so the metrics are correctly rendered in grafana dashboard
   component: proxy
   replicaCount: 3
+  # If using Prometheus-Operator enable this PodMonitor to discover proxy scrape targets
+  # Prometheus-Operator does not add scrape targets based on k8s annotations
+  podMonitor:
+    enabled: false
+    interval: 10s
+    scrapeTimeout: 10s
   # nodeSelector:
     # cloud.google.com/gke-nodepool: default-pool
   probe: