You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ad...@apache.org on 2022/05/06 14:04:18 UTC

[pulsar-helm-chart] branch master updated: Add support for Horizontal Pod Autoscaling for Broker and Proxy. (#262)

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

addisonj 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 bfb6985  Add support for Horizontal Pod Autoscaling for Broker and Proxy. (#262)
bfb6985 is described below

commit bfb6985de8bc2e6e693de1024159a6a6fc89340c
Author: Frank Kelly <62...@users.noreply.github.com>
AuthorDate: Fri May 6 10:04:13 2022 -0400

    Add support for Horizontal Pod Autoscaling for Broker and Proxy. (#262)
    
    * Add support for Horizontal Pod Autoscaling for Broker and Proxy.
    
    * Add license
---
 charts/pulsar/Chart.yaml                           |  2 +-
 .../{Chart.yaml => templates/broker-hpa.yaml}      | 29 +++++++++++++---------
 .../{Chart.yaml => templates/proxy-hpa.yaml}       | 29 +++++++++++++---------
 charts/pulsar/values.yaml                          | 10 ++++++++
 4 files changed, 45 insertions(+), 25 deletions(-)

diff --git a/charts/pulsar/Chart.yaml b/charts/pulsar/Chart.yaml
index a9ff7fa..f5c26bc 100644
--- a/charts/pulsar/Chart.yaml
+++ b/charts/pulsar/Chart.yaml
@@ -21,7 +21,7 @@ apiVersion: v2
 appVersion: "2.9.2"
 description: Apache Pulsar Helm chart for Kubernetes
 name: pulsar
-version: 2.9.2
+version: 2.9.3
 home: https://pulsar.apache.org
 sources:
 - https://github.com/apache/pulsar
diff --git a/charts/pulsar/Chart.yaml b/charts/pulsar/templates/broker-hpa.yaml
similarity index 57%
copy from charts/pulsar/Chart.yaml
copy to charts/pulsar/templates/broker-hpa.yaml
index a9ff7fa..018d218 100644
--- a/charts/pulsar/Chart.yaml
+++ b/charts/pulsar/templates/broker-hpa.yaml
@@ -17,15 +17,20 @@
 # under the License.
 #
 
-apiVersion: v2
-appVersion: "2.9.2"
-description: Apache Pulsar Helm chart for Kubernetes
-name: pulsar
-version: 2.9.2
-home: https://pulsar.apache.org
-sources:
-- https://github.com/apache/pulsar
-icon: http://pulsar.apache.org/img/pulsar.svg
-maintainers:
-- name: The Apache Pulsar Team
-  email: dev@pulsar.apache.org
+{{- if .Values.broker.autoscaling.enabled }}
+apiVersion: autoscaling/v2beta2
+kind: HorizontalPodAutoscaler
+metadata:
+  name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}"
+spec:
+  maxReplicas: {{ .Values.broker.autoscaling.maxReplicas }}
+  {{- with .Values.broker.autoscaling.metrics }}
+  metrics:
+    {{- toYaml . | nindent 4 }}
+  {{- end }}
+  minReplicas: {{ .Values.broker.autoscaling.minReplicas }}
+  scaleTargetRef:
+    apiVersion: apps/v1
+    kind: StatefulSet
+    name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}"
+{{- end }}
diff --git a/charts/pulsar/Chart.yaml b/charts/pulsar/templates/proxy-hpa.yaml
similarity index 58%
copy from charts/pulsar/Chart.yaml
copy to charts/pulsar/templates/proxy-hpa.yaml
index a9ff7fa..7314eca 100644
--- a/charts/pulsar/Chart.yaml
+++ b/charts/pulsar/templates/proxy-hpa.yaml
@@ -17,15 +17,20 @@
 # under the License.
 #
 
-apiVersion: v2
-appVersion: "2.9.2"
-description: Apache Pulsar Helm chart for Kubernetes
-name: pulsar
-version: 2.9.2
-home: https://pulsar.apache.org
-sources:
-- https://github.com/apache/pulsar
-icon: http://pulsar.apache.org/img/pulsar.svg
-maintainers:
-- name: The Apache Pulsar Team
-  email: dev@pulsar.apache.org
+{{- if .Values.proxy.autoscaling.enabled }}
+apiVersion: autoscaling/v2beta2
+kind: HorizontalPodAutoscaler
+metadata:
+  name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}"
+spec:
+  maxReplicas: {{ .Values.proxy.autoscaling.maxReplicas }}
+  {{- with .Values.proxy.autoscaling.metrics }}
+  metrics:
+    {{- toYaml . | nindent 4 }}
+  {{- end }}
+  minReplicas: {{ .Values.proxy.autoscaling.minReplicas }}
+  scaleTargetRef:
+    apiVersion: apps/v1
+    kind: StatefulSet
+    name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}"
+{{- end }}
diff --git a/charts/pulsar/values.yaml b/charts/pulsar/values.yaml
index 81cfa16..2193169 100644
--- a/charts/pulsar/values.yaml
+++ b/charts/pulsar/values.yaml
@@ -668,6 +668,11 @@ broker:
   # so the metrics are correctly rendered in grafana dashboard
   component: broker
   replicaCount: 3
+  autoscaling:
+    enabled: false
+    minReplicas: 1
+    maxReplicas: 3
+    metrics: ~
   # If using Prometheus-Operator enable this PodMonitor to discover broker scrape targets
   # Prometheus-Operator does not add scrape targets based on k8s annotations
   podMonitor:
@@ -784,6 +789,11 @@ proxy:
   # so the metrics are correctly rendered in grafana dashboard
   component: proxy
   replicaCount: 3
+  autoscaling:
+    enabled: false
+    minReplicas: 1
+    maxReplicas: 3
+    metrics: ~
   # If using Prometheus-Operator enable this PodMonitor to discover proxy scrape targets
   # Prometheus-Operator does not add scrape targets based on k8s annotations
   podMonitor: