From 8aa5aae1fcae994ea222705c79e6bc54542679b2 Mon Sep 17 00:00:00 2001 From: Eric Shen Date: Fri, 28 Jul 2023 19:07:29 +0800 Subject: [PATCH] feat: add podLabel support for pulsar components (#1069) Signed-off-by: ericsyh --- charts/pulsar/Chart.yaml | 1 + .../bookkeeper-autorecovery-statefulset.yaml | 10 ++++++++ .../bookkeeper/bookkeeper-statefulset.yaml | 10 ++++++++ .../templates/broker/broker-statefulset.yaml | 10 ++++++++ .../templates/proxy/proxy-statefulset.yaml | 10 ++++++++ .../zookeeper/zookeeper-statefulset.yaml | 10 ++++++++ charts/pulsar/values.yaml | 24 +++++++++++++++++++ 7 files changed, 75 insertions(+) diff --git a/charts/pulsar/Chart.yaml b/charts/pulsar/Chart.yaml index 3a87ce3e5..654ad0b96 100644 --- a/charts/pulsar/Chart.yaml +++ b/charts/pulsar/Chart.yaml @@ -19,6 +19,7 @@ apiVersion: v1 appVersion: "2.10" +kubeVersion: ">= 1.19.0-0 <= 1.25.0-0" description: Apache Pulsar Helm chart for Kubernetes name: pulsar version: 2.10.0 diff --git a/charts/pulsar/templates/bookkeeper/bookkeeper-autorecovery-statefulset.yaml b/charts/pulsar/templates/bookkeeper/bookkeeper-autorecovery-statefulset.yaml index be9a3e92b..8e201de17 100644 --- a/charts/pulsar/templates/bookkeeper/bookkeeper-autorecovery-statefulset.yaml +++ b/charts/pulsar/templates/bookkeeper/bookkeeper-autorecovery-statefulset.yaml @@ -26,6 +26,13 @@ metadata: labels: {{- include "pulsar.standardLabels" . | nindent 4 }} component: {{ .Values.autorecovery.component }} +{{- with .Values.autorecovery.statefulset.labels }} +{{ toYaml . | indent 4 }} +{{- end }} +{{- with .Values.autorecovery.statefulset.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} spec: serviceName: "{{ template "pulsar.fullname" . }}-{{ .Values.autorecovery.component }}" replicas: {{ .Values.autorecovery.replicaCount }} @@ -42,6 +49,9 @@ spec: labels: {{- include "pulsar.template.labels" . | nindent 8 }} component: {{ .Values.autorecovery.component }} +{{- with .Values.autorecovery.labels }} +{{ toYaml . | indent 8 }} +{{- end }} annotations: prometheus.io/scrape: "true" prometheus.io/port: "{{ .Values.autorecovery.ports.http }}" diff --git a/charts/pulsar/templates/bookkeeper/bookkeeper-statefulset.yaml b/charts/pulsar/templates/bookkeeper/bookkeeper-statefulset.yaml index 1fef1f2c7..eecadb6cc 100644 --- a/charts/pulsar/templates/bookkeeper/bookkeeper-statefulset.yaml +++ b/charts/pulsar/templates/bookkeeper/bookkeeper-statefulset.yaml @@ -26,6 +26,13 @@ metadata: labels: {{- include "pulsar.standardLabels" . | nindent 4 }} component: {{ .Values.bookkeeper.component }} +{{- with .Values.bookkeeper.statefulset.labels }} +{{ toYaml . | indent 4 }} +{{- end }} +{{- with .Values.bookkeeper.statefulset.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} spec: serviceName: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}" replicas: {{ .Values.bookkeeper.replicaCount }} @@ -41,6 +48,9 @@ spec: labels: {{- include "pulsar.template.labels" . | nindent 8 }} component: {{ .Values.bookkeeper.component }} +{{- with .Values.bookkeeper.labels }} +{{ toYaml . | indent 8 }} +{{- end }} annotations: {{- if .Values.monitoring.datadog }} {{- include "pulsar.bookkeeper.datadog.annotation" . | nindent 8 }} diff --git a/charts/pulsar/templates/broker/broker-statefulset.yaml b/charts/pulsar/templates/broker/broker-statefulset.yaml index bea1b959b..fb9da3cc3 100644 --- a/charts/pulsar/templates/broker/broker-statefulset.yaml +++ b/charts/pulsar/templates/broker/broker-statefulset.yaml @@ -26,6 +26,13 @@ metadata: labels: {{- include "pulsar.standardLabels" . | nindent 4 }} component: {{ .Values.broker.component }} +{{- with .Values.broker.statefulset.labels }} +{{ toYaml . | indent 4 }} +{{- end }} +{{- with .Values.broker.statefulset.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} spec: serviceName: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}" replicas: {{ .Values.broker.replicaCount }} @@ -41,6 +48,9 @@ spec: labels: {{- include "pulsar.template.labels" . | nindent 8 }} component: {{ .Values.broker.component }} +{{- with .Values.broker.labels }} +{{ toYaml . | indent 8 }} +{{- end }} annotations: {{- if .Values.monitoring.datadog }} {{- include "pulsar.broker.datadog.annotation" . | nindent 8 }} diff --git a/charts/pulsar/templates/proxy/proxy-statefulset.yaml b/charts/pulsar/templates/proxy/proxy-statefulset.yaml index dd5ea9409..b204f1dc3 100644 --- a/charts/pulsar/templates/proxy/proxy-statefulset.yaml +++ b/charts/pulsar/templates/proxy/proxy-statefulset.yaml @@ -26,6 +26,13 @@ metadata: labels: {{- include "pulsar.standardLabels" . | nindent 4 }} component: {{ .Values.proxy.component }} +{{- with .Values.proxy.statefulset.labels }} +{{ toYaml . | indent 4 }} +{{- end }} +{{- with .Values.proxy.statefulset.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} spec: serviceName: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}" replicas: {{ .Values.proxy.replicaCount }} @@ -41,6 +48,9 @@ spec: labels: {{- include "pulsar.template.labels" . | nindent 8 }} component: {{ .Values.proxy.component }} +{{- with .Values.proxy.labels }} +{{ toYaml . | indent 8 }} +{{- end }} annotations: {{- if .Values.monitoring.datadog }} {{- include "pulsar.proxy.datadog.annotation" . | nindent 8 }} diff --git a/charts/pulsar/templates/zookeeper/zookeeper-statefulset.yaml b/charts/pulsar/templates/zookeeper/zookeeper-statefulset.yaml index c93f7e32c..442f3c15c 100644 --- a/charts/pulsar/templates/zookeeper/zookeeper-statefulset.yaml +++ b/charts/pulsar/templates/zookeeper/zookeeper-statefulset.yaml @@ -24,9 +24,16 @@ kind: StatefulSet metadata: name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}" namespace: {{ template "pulsar.namespace" . }} +{{- with .Values.zookeeper.statefulset.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} labels: {{- include "pulsar.standardLabels" . | nindent 4 }} component: {{ .Values.zookeeper.component }} +{{- with .Values.zookeeper.statefulset.labels }} +{{ toYaml . | indent 4 }} +{{- end }} spec: serviceName: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}" replicas: {{ .Values.zookeeper.replicaCount }} @@ -42,6 +49,9 @@ spec: labels: {{- include "pulsar.template.labels" . | nindent 8 }} component: {{ .Values.zookeeper.component }} +{{- with .Values.zookeeper.labels }} +{{ toYaml . | indent 8 }} +{{- end }} annotations: {{- if .Values.monitoring.datadog }} {{- include "pulsar.zookeeper.datadog.annotation" . | nindent 8 }} diff --git a/charts/pulsar/values.yaml b/charts/pulsar/values.yaml index 24278167a..23f0fdae4 100644 --- a/charts/pulsar/values.yaml +++ b/charts/pulsar/values.yaml @@ -527,6 +527,7 @@ zookeeper: annotations: prometheus.io/scrape: "true" prometheus.io/port: "8000" + labels: {} securityContext: fsGroup: 0 fsGroupChangePolicy: "OnRootMismatch" @@ -611,6 +612,9 @@ zookeeper: -XX:+DisableExplicitGC -XX:+PerfDisableSharedMem -Dzookeeper.forceSync=no + statefulset: + annotations: {} + labels: {} ## Zookeeper service ## templates/zookeeper-service.yaml ## @@ -721,6 +725,7 @@ bookkeeper: # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee type: preferredDuringSchedulingIgnoredDuringExecution annotations: {} + labels: {} securityContext: fsGroup: 0 tolerations: [] @@ -819,6 +824,9 @@ bookkeeper: -XX:+ExitOnOutOfMemoryError -XX:+PerfDisableSharedMem -verbosegc + statefulset: + annotations: {} + labels: {} ## Bookkeeper Service ## templates/bookkeeper-service.yaml ## @@ -851,6 +859,7 @@ autorecovery: # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee type: preferredDuringSchedulingIgnoredDuringExecution annotations: {} + labels: {} securityContext: fsGroup: 0 # tolerations: [] @@ -868,6 +877,9 @@ autorecovery: configData: BOOKIE_MEM: > -Xms64m -Xmx64m + statefulset: + annotations: {} + labels: {} ## Pulsar Zookeeper metadata. The metadata will be deployed as ## soon as the last zookeeper node is reachable. The deployment @@ -963,6 +975,7 @@ broker: # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee type: preferredDuringSchedulingIgnoredDuringExecution annotations: {} + labels: {} tolerations: [] securityContext: {} gracePeriod: 30 @@ -1023,6 +1036,9 @@ broker: managedLedgerDefaultEnsembleSize: "3" managedLedgerDefaultWriteQuorum: "3" managedLedgerDefaultAckQuorum: "2" + statefulset: + annotations: {} + labels: {} ## Broker service ## templates/broker-service.yaml ## @@ -1130,6 +1146,7 @@ functions: clusterRole: true autoRollDeployment: true annotations: {} + labels: {} ports: http: 8080 https: 8443 @@ -1153,6 +1170,9 @@ functions: failureThreshold: 30 initialDelaySeconds: 60 periodSeconds: 10 + statefulset: + annotations: {} + labels: {} service: annotations: {} affinity: @@ -1255,6 +1275,7 @@ proxy: # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee type: preferredDuringSchedulingIgnoredDuringExecution annotations: {} + labels: {} securityContext: {} tolerations: [] gracePeriod: 30 @@ -1340,6 +1361,9 @@ proxy: pulsarssl: 6651 websocket: 9090 websockettls: 9443 + statefulset: + annotations: {} + labels: {} service: annotations: {} type: ClusterIP