From cb5c44f8ec18c3da0d162aa03e09c2c92cc25988 Mon Sep 17 00:00:00 2001 From: Massimiliano Mirelli Date: Tue, 4 Jun 2024 18:45:14 +0300 Subject: [PATCH] Allow broker's service clusterIP customisation (#498) * Allow broker's service clusterIP customisation This customisation is useful to configure headless vs non-headless broker's service. The default is headless broker service, i.e. a service for which kubernetes does not allocate an IP address (https://kubernetes.io/docs/concepts/services-networking/service/#type-clusterip). A headless service is a very simple type of service that doesn't seem to work well when pulsar service is exposed by pulsar-proxy via a nodeport. Addresses #497. * Address review comments https://github.com/apache/pulsar-helm-chart/pull/498/files#r1605762934 and https://github.com/apache/pulsar-helm-chart/pull/498/files#r1605763245 * Move doc to Values.broker.service --- charts/pulsar/templates/broker-service.yaml | 3 ++- charts/pulsar/values.yaml | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/charts/pulsar/templates/broker-service.yaml b/charts/pulsar/templates/broker-service.yaml index 5f0161b..f9cd1c7 100644 --- a/charts/pulsar/templates/broker-service.yaml +++ b/charts/pulsar/templates/broker-service.yaml @@ -29,6 +29,7 @@ metadata: annotations: {{ toYaml .Values.broker.service.annotations | indent 4 }} spec: + type: ClusterIP ports: # prometheus needs to access /metrics endpoint - name: http @@ -43,7 +44,7 @@ spec: - name: "{{ .Values.tlsPrefix }}pulsarssl" port: {{ .Values.broker.ports.pulsarssl }} {{- end }} - clusterIP: None + clusterIP: "{{ .Values.broker.service.clusterIP }}" selector: {{- include "pulsar.matchLabels" . | nindent 4 }} component: {{ .Values.broker.component }} diff --git a/charts/pulsar/values.yaml b/charts/pulsar/values.yaml index 1094510..22ad8f0 100755 --- a/charts/pulsar/values.yaml +++ b/charts/pulsar/values.yaml @@ -861,6 +861,12 @@ broker: ## templates/broker-service.yaml ## service: + # clusterIP can be one of the three, which determines the type of k8s service deployed for broker + # 1. a valid IPv4 address -> non-headless service, let you select the IPv4 address + # 2. '' -> non-headless service, k8s picks an IPv4 address + # 3. 'None' -> headless + # Ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-clusterip + clusterIP: "None" annotations: {} ## Broker PodDisruptionBudget ## templates/broker-pdb.yaml