From fdec9c69ef6d01f1760fb75310f8aab8fc0fd2d0 Mon Sep 17 00:00:00 2001 From: Lari Hotari Date: Tue, 26 Mar 2024 10:49:33 -0700 Subject: [PATCH] Use podManagementPolicy OrderedReady for Broker sts when Functions are enabled (#474) * Use podManagementPolicy OrderedReady for Broker sts when Functions are enabled * Don't change podManagementPolicy when the sts already exists * Fix template issue * Fix apiVersion --- .../pulsar/templates/broker-statefulset.yaml | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/charts/pulsar/templates/broker-statefulset.yaml b/charts/pulsar/templates/broker-statefulset.yaml index c6e069e5..34938cfa 100644 --- a/charts/pulsar/templates/broker-statefulset.yaml +++ b/charts/pulsar/templates/broker-statefulset.yaml @@ -21,8 +21,10 @@ apiVersion: apps/v1 kind: StatefulSet metadata: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}" - namespace: {{ template "pulsar.namespace" . }} + {{- $stsName := printf "%s-%s" (include "pulsar.fullname" .) .Values.broker.component }} + name: {{ $stsName | quote }} + {{- $namespace := include "pulsar.namespace" . }} + namespace: {{ $namespace | quote }} labels: {{- include "pulsar.standardLabels" . | nindent 4 }} component: {{ .Values.broker.component }} @@ -37,7 +39,21 @@ spec: component: {{ .Values.broker.component }} updateStrategy: type: RollingUpdate + {{- /* + When functions are enabled, podManagementPolicy must be OrderedReady to ensure that other started brokers are available via DNS + for the function worker to connect to. + Since podManagementPolicy is immutable, this rule is only applied when the broker is first installed. + */}} + {{- $stsObj := lookup "apps/v1" "StatefulSet" $namespace $stsName }} + {{- if $stsObj }} + podManagementPolicy: {{ $stsObj.spec.podManagementPolicy }} + {{- else }} + {{- if not .Values.components.functions }} podManagementPolicy: Parallel + {{- else }} + podManagementPolicy: OrderedReady + {{- end }} + {{- end }} template: metadata: labels: