Skip to content

Commit bfb6985

Browse files
authored
Add support for Horizontal Pod Autoscaling for Broker and Proxy. (#262)
* Add support for Horizontal Pod Autoscaling for Broker and Proxy. * Add license
1 parent cee3fcf commit bfb6985

File tree

4 files changed

+83
-1
lines changed

4 files changed

+83
-1
lines changed

charts/pulsar/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ apiVersion: v2
2121
appVersion: "2.9.2"
2222
description: Apache Pulsar Helm chart for Kubernetes
2323
name: pulsar
24-
version: 2.9.2
24+
version: 2.9.3
2525
home: https://pulsar.apache.org
2626
sources:
2727
- https://github.com/apache/pulsar
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
{{- if .Values.broker.autoscaling.enabled }}
21+
apiVersion: autoscaling/v2beta2
22+
kind: HorizontalPodAutoscaler
23+
metadata:
24+
name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}"
25+
spec:
26+
maxReplicas: {{ .Values.broker.autoscaling.maxReplicas }}
27+
{{- with .Values.broker.autoscaling.metrics }}
28+
metrics:
29+
{{- toYaml . | nindent 4 }}
30+
{{- end }}
31+
minReplicas: {{ .Values.broker.autoscaling.minReplicas }}
32+
scaleTargetRef:
33+
apiVersion: apps/v1
34+
kind: StatefulSet
35+
name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}"
36+
{{- end }}
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
{{- if .Values.proxy.autoscaling.enabled }}
21+
apiVersion: autoscaling/v2beta2
22+
kind: HorizontalPodAutoscaler
23+
metadata:
24+
name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}"
25+
spec:
26+
maxReplicas: {{ .Values.proxy.autoscaling.maxReplicas }}
27+
{{- with .Values.proxy.autoscaling.metrics }}
28+
metrics:
29+
{{- toYaml . | nindent 4 }}
30+
{{- end }}
31+
minReplicas: {{ .Values.proxy.autoscaling.minReplicas }}
32+
scaleTargetRef:
33+
apiVersion: apps/v1
34+
kind: StatefulSet
35+
name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}"
36+
{{- end }}

charts/pulsar/values.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,11 @@ broker:
668668
# so the metrics are correctly rendered in grafana dashboard
669669
component: broker
670670
replicaCount: 3
671+
autoscaling:
672+
enabled: false
673+
minReplicas: 1
674+
maxReplicas: 3
675+
metrics: ~
671676
# If using Prometheus-Operator enable this PodMonitor to discover broker scrape targets
672677
# Prometheus-Operator does not add scrape targets based on k8s annotations
673678
podMonitor:
@@ -784,6 +789,11 @@ proxy:
784789
# so the metrics are correctly rendered in grafana dashboard
785790
component: proxy
786791
replicaCount: 3
792+
autoscaling:
793+
enabled: false
794+
minReplicas: 1
795+
maxReplicas: 3
796+
metrics: ~
787797
# If using Prometheus-Operator enable this PodMonitor to discover proxy scrape targets
788798
# Prometheus-Operator does not add scrape targets based on k8s annotations
789799
podMonitor:

0 commit comments

Comments
 (0)