From 10785027e332b237419e627da138cca4783d847b Mon Sep 17 00:00:00 2001 From: ericsyh Date: Sun, 22 Sep 2024 21:48:47 +0800 Subject: [PATCH] apply autoscaling on sn-platform Signed-off-by: ericsyh --- .../templates/bookkeeper/bookkeeper-cluster.yaml | 11 +++++++++++ .../templates/broker/broker-cluster.yaml | 11 +++++++++++ charts/sn-platform/values.yaml | 16 ++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/charts/sn-platform/templates/bookkeeper/bookkeeper-cluster.yaml b/charts/sn-platform/templates/bookkeeper/bookkeeper-cluster.yaml index c9560f59..94af4a76 100644 --- a/charts/sn-platform/templates/bookkeeper/bookkeeper-cluster.yaml +++ b/charts/sn-platform/templates/bookkeeper/bookkeeper-cluster.yaml @@ -33,6 +33,17 @@ spec: replicas: {{ .Values.bookkeeper.replicaCount }} image: "{{ .Values.images.bookie.repository }}:{{ .Values.images.bookie.tag }}" imagePullPolicy: {{ .Values.images.bookie.pullPolicy }} +{{- if .Values.bookkeeper.autoScaling.enabled }} + autoScalingPolicy: + minReplicas: {{ .Values.bookkeeper.autoScaling.minReplicas }} + maxReplicas: {{ .Values.bookkeeper.autoScaling.maxReplicas }} +{{- if .Values.bookkeeper.autoScaling.metrics }} + metrics: +{{- with .Values.bookkeeper.autoScaling.metrics }} +{{ toYaml . | indent 4 }} +{{- end }} +{{- end }} +{{- end }} logConfig: level: {{ .Values.bookkeeper.logConfig.level }} format: {{ .Values.bookkeeper.logConfig.format }} diff --git a/charts/sn-platform/templates/broker/broker-cluster.yaml b/charts/sn-platform/templates/broker/broker-cluster.yaml index eff81fce..b8704cea 100644 --- a/charts/sn-platform/templates/broker/broker-cluster.yaml +++ b/charts/sn-platform/templates/broker/broker-cluster.yaml @@ -35,6 +35,17 @@ spec: replicas: {{ .Values.broker.replicaCount }} image: "{{ .Values.images.broker.repository }}:{{ .Values.images.broker.tag }}" imagePullPolicy: {{ .Values.images.broker.pullPolicy }} +{{- if .Values.broker.autoScaling.enabled }} + autoScalingPolicy: + minReplicas: {{ .Values.broker.autoScaling.minReplicas }} + maxReplicas: {{ .Values.broker.autoScaling.maxReplicas }} +{{- if .Values.broker.autoScaling.metrics }} + metrics: +{{- with .Values.broker.autoScaling.metrics }} +{{ toYaml . | indent 4 }} +{{- end }} +{{- end }} +{{- end }} logConfig: level: {{ .Values.broker.logConfig.level }} format: {{ .Values.broker.logConfig.format }} diff --git a/charts/sn-platform/values.yaml b/charts/sn-platform/values.yaml index 6794800c..44faf8f6 100644 --- a/charts/sn-platform/values.yaml +++ b/charts/sn-platform/values.yaml @@ -862,6 +862,14 @@ bookkeeper: # annotations that will be added on the BookKeeperCluster CR only. annotations: {} + # The field autoScaling will track the average metrics usage of the Pulsar nodes and adjusts the nodes to keep at the target metrics usage level. + # If the average metrics usage for nodes is over the target, scaling controller will scale out to bring more nodes and if the average metrics for the nodes is less than the target, scaling controller will downscale nodes to save resources. + autoScaling: + enabled: false + minReplicas: 1 + maxReplicas: 4 + metrics: {} + # The field logConfig can be used to change the log level and log format of pods. # The logConfig field is optional. If it is not specified, the component will use the default log configuration /pulsar/conf/log4j2.yaml. # If it is specified will dynamically change the log level and log format of the component by changing the CR. @@ -1099,6 +1107,14 @@ broker: # annotations that will be added on the PulsarBroker CR only. annotations: {} + # The field autoScaling will track the average metrics usage of the Pulsar nodes and adjusts the nodes to keep at the target metrics usage level. + # If the average metrics usage for nodes is over the target, scaling controller will scale out to bring more nodes and if the average metrics for the nodes is less than the target, scaling controller will downscale nodes to save resources. + autoScaling: + enabled: false + minReplicas: 1 + maxReplicas: 4 + metrics: {} + # The field logConfig can be used to change the log level and log format of pods. # The logConfig field is optional. If it is not specified, the component will use the default log configuration /pulsar/conf/log4j2.yaml. # If it is specified will dynamically change the log level and log format of the component by changing the CR.