This is an automated email from the ASF dual-hosted git repository.
lhotari 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 b30eb6f Improve HPA (#354)
b30eb6f is described below
commit b30eb6fff8f63a83345542ce5fef40f05be496e2
Author: Atkins <[email protected]>
AuthorDate: Wed Jul 12 23:18:19 2023 +0800
Improve HPA (#354)
* Use `autoscaling/v2` if Kubernetes version >= 1.23
Signed-off-by: Atkins Chang <[email protected]>
* Disable replicas when autoscaling enabled
Signed-off-by: Atkins Chang <[email protected]>
---------
Signed-off-by: Atkins Chang <[email protected]>
---
charts/pulsar/templates/broker-hpa.yaml | 4 ++++
charts/pulsar/templates/broker-statefulset.yaml | 2 ++
charts/pulsar/templates/proxy-hpa.yaml | 4 ++++
charts/pulsar/templates/proxy-statefulset.yaml | 2 ++
4 files changed, 12 insertions(+)
diff --git a/charts/pulsar/templates/broker-hpa.yaml
b/charts/pulsar/templates/broker-hpa.yaml
index 018d218..f6e49e9 100644
--- a/charts/pulsar/templates/broker-hpa.yaml
+++ b/charts/pulsar/templates/broker-hpa.yaml
@@ -18,7 +18,11 @@
#
{{- if .Values.broker.autoscaling.enabled }}
+{{- if (semverCompare "<1.23-0" .Capabilities.KubeVersion.Version) }}
apiVersion: autoscaling/v2beta2
+{{- else }}
+apiVersion: autoscaling/v2
+{{- end }}
kind: HorizontalPodAutoscaler
metadata:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}"
diff --git a/charts/pulsar/templates/broker-statefulset.yaml
b/charts/pulsar/templates/broker-statefulset.yaml
index d969b66..c8e59fc 100644
--- a/charts/pulsar/templates/broker-statefulset.yaml
+++ b/charts/pulsar/templates/broker-statefulset.yaml
@@ -28,7 +28,9 @@ metadata:
component: {{ .Values.broker.component }}
spec:
serviceName: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component
}}"
+ {{- if not .Values.broker.autoscaling.enabled }}
replicas: {{ .Values.broker.replicaCount }}
+ {{- end }}
selector:
matchLabels:
{{- include "pulsar.matchLabels" . | nindent 6 }}
diff --git a/charts/pulsar/templates/proxy-hpa.yaml
b/charts/pulsar/templates/proxy-hpa.yaml
index 7314eca..7565de9 100644
--- a/charts/pulsar/templates/proxy-hpa.yaml
+++ b/charts/pulsar/templates/proxy-hpa.yaml
@@ -18,7 +18,11 @@
#
{{- if .Values.proxy.autoscaling.enabled }}
+{{- if (semverCompare "<1.23-0" .Capabilities.KubeVersion.Version) }}
apiVersion: autoscaling/v2beta2
+{{- else }}
+apiVersion: autoscaling/v2
+{{- end }}
kind: HorizontalPodAutoscaler
metadata:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}"
diff --git a/charts/pulsar/templates/proxy-statefulset.yaml
b/charts/pulsar/templates/proxy-statefulset.yaml
index 77254da..5a284f5 100644
--- a/charts/pulsar/templates/proxy-statefulset.yaml
+++ b/charts/pulsar/templates/proxy-statefulset.yaml
@@ -28,7 +28,9 @@ metadata:
component: {{ .Values.proxy.component }}
spec:
serviceName: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component
}}"
+ {{- if not .Values.proxy.autoscaling.enabled }}
replicas: {{ .Values.proxy.replicaCount }}
+ {{- end }}
selector:
matchLabels:
{{- include "pulsar.matchLabels" . | nindent 6 }}