From 75dedfcafbc430b41251a086fc48a50b5ec221b1 Mon Sep 17 00:00:00 2001 From: wangxye Date: Fri, 20 Oct 2023 15:42:06 +0800 Subject: [PATCH] fix: update broker with StatefulSet Signed-off-by: wangxye --- rocketmq-k8s-helm/helm_sample_values.yaml | 2 +- rocketmq-k8s-helm/templates/broker/_brokerconfig.tpl | 2 +- .../broker/{deployment.yaml => statefulset.yaml} | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) rename rocketmq-k8s-helm/templates/broker/{deployment.yaml => statefulset.yaml} (94%) diff --git a/rocketmq-k8s-helm/helm_sample_values.yaml b/rocketmq-k8s-helm/helm_sample_values.yaml index 42e4386..b65e592 100644 --- a/rocketmq-k8s-helm/helm_sample_values.yaml +++ b/rocketmq-k8s-helm/helm_sample_values.yaml @@ -14,7 +14,7 @@ # limitations under the License. broker: - replicaCount: 1 + replicaCount: 2 conf: clusterNameOverride: "automq" s3stream: diff --git a/rocketmq-k8s-helm/templates/broker/_brokerconfig.tpl b/rocketmq-k8s-helm/templates/broker/_brokerconfig.tpl index e406c21..79917ea 100644 --- a/rocketmq-k8s-helm/templates/broker/_brokerconfig.tpl +++ b/rocketmq-k8s-helm/templates/broker/_brokerconfig.tpl @@ -26,7 +26,7 @@ limitations under the License. {{- $db := .Values.broker.db }} {{- $replicaCount := .Values.broker.replicaCount | int }} {{- range $index := until $replicaCount }} - {{ $name }}-{{ $clusterName }}: | + {{ $clusterName }}-{{ $name }}-{{ $index }}: | name: {{ $clusterName }}-{{ $brokerNamePrefix }} instanceId: {{ $brokerNamePrefix }}-{{ $index }} bindAddress: "0.0.0.0:{{ $bindAddress.port }}" diff --git a/rocketmq-k8s-helm/templates/broker/deployment.yaml b/rocketmq-k8s-helm/templates/broker/statefulset.yaml similarity index 94% rename from rocketmq-k8s-helm/templates/broker/deployment.yaml rename to rocketmq-k8s-helm/templates/broker/statefulset.yaml index 5d6c3e8..41228a2 100644 --- a/rocketmq-k8s-helm/templates/broker/deployment.yaml +++ b/rocketmq-k8s-helm/templates/broker/statefulset.yaml @@ -14,14 +14,18 @@ # limitations under the License. apiVersion: apps/v1 -kind: Deployment +kind: StatefulSet metadata: name: {{ include "rocketmq-broker.fullname" . }} spec: replicas: {{ .Values.broker.replicaCount }} + serviceName: {{ include "rocketmq-broker.fullname" . }} selector: matchLabels: {{- include "rocketmq-broker.selectorLabels" . | nindent 6 }} + podManagementPolicy: Parallel + updateStrategy: + type: RollingUpdate template: metadata: labels: @@ -34,7 +38,7 @@ spec: imagePullPolicy: {{ $.Values.broker.image.pullPolicy }} {{- end }} command: [ "/bin/sh" ] - args: [ "-c", "./run-server.sh com.automq.rocketmq.broker.BrokerStartup -c /home/rocketmq/rocketmq-on-s3-5.1.3/conf/$(INSTANCE_NAME)-$(CLUSTER_NAME)" ] + args: [ "-c", "./run-server.sh com.automq.rocketmq.broker.BrokerStartup -c /home/rocketmq/rocketmq-on-s3-5.1.3/conf/$(CLUSTER_NAME)-$(POD_NAME)" ] env: - name: POD_NAME valueFrom: