From 5049d3564a750fa82d8fab68ec2bc8df48967d82 Mon Sep 17 00:00:00 2001 From: Elad Dolev Date: Tue, 8 Sep 2020 05:06:30 +0300 Subject: [PATCH] add support for multiple clusters (#60) Co-authored-by: Elad Dolev ### Motivation Give the ability to deploy multi-cluster instance on K8s clusters with non-default `clusterDomain`, and connect to external configuration-store ### Modifications - give the ability to change cluster's name - give the ability to change `clusterDomain` - fix external configuration store functionality - use broker ports variables - use label templates, and add `component` label in several places ### Verifying this change - [x] Make sure that the change passes the CI checks. --- charts/pulsar/Chart.yaml | 2 +- charts/pulsar/templates/_autorecovery.tpl | 2 +- charts/pulsar/templates/_bookkeeper.tpl | 2 +- charts/pulsar/templates/_broker.tpl | 2 +- .../pulsar/templates/_configurationstore.tpl | 20 ++++++++++++ charts/pulsar/templates/_helpers.tpl | 15 +++++++-- charts/pulsar/templates/_toolset.tpl | 2 +- charts/pulsar/templates/_zookeeper.tpl | 2 +- .../bookkeeper-cluster-initialize.yaml | 4 +-- .../templates/bookkeeper-statefulset.yaml | 2 +- charts/pulsar/templates/broker-configmap.yaml | 10 +++--- .../pulsar/templates/broker-statefulset.yaml | 12 +++---- .../templates/dashboard-deployment.yaml | 11 ++----- .../pulsar/templates/dashboard-ingress.yaml | 19 +++++------- .../pulsar/templates/dashboard-service.yaml | 6 +--- charts/pulsar/templates/proxy-configmap.yaml | 2 +- charts/pulsar/templates/proxy-ingress.yaml | 19 +++++------- .../pulsar/templates/proxy-statefulset.yaml | 6 ++-- .../templates/pulsar-cluster-initialize.yaml | 14 ++++----- .../templates/pulsar-manager-ingress.yaml | 19 +++++------- .../templates/tls-cert-internal-issuer.yaml | 2 +- .../pulsar/templates/tls-certs-internal.yaml | 24 +++++++------- charts/pulsar/values.yaml | 31 ++++++++++++------- 23 files changed, 124 insertions(+), 104 deletions(-) create mode 100644 charts/pulsar/templates/_configurationstore.tpl diff --git a/charts/pulsar/Chart.yaml b/charts/pulsar/Chart.yaml index e47655a..f85fdc5 100644 --- a/charts/pulsar/Chart.yaml +++ b/charts/pulsar/Chart.yaml @@ -21,7 +21,7 @@ apiVersion: v1 appVersion: "2.6.1" description: Apache Pulsar Helm chart for Kubernetes name: pulsar -version: 2.6.1-1 +version: 2.6.1-2 home: https://pulsar.apache.org sources: - https://github.com/apache/pulsar diff --git a/charts/pulsar/templates/_autorecovery.tpl b/charts/pulsar/templates/_autorecovery.tpl index 1930c89..97f8e9e 100644 --- a/charts/pulsar/templates/_autorecovery.tpl +++ b/charts/pulsar/templates/_autorecovery.tpl @@ -9,7 +9,7 @@ Define the pulsar autorecovery service Define the autorecovery hostname */}} {{- define "pulsar.autorecovery.hostname" -}} -${HOSTNAME}.{{ template "pulsar.autorecovery.service" . }}.{{ .Values.namespace }}.svc.cluster.local +${HOSTNAME}.{{ template "pulsar.autorecovery.service" . }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }} {{- end -}} {{/* diff --git a/charts/pulsar/templates/_bookkeeper.tpl b/charts/pulsar/templates/_bookkeeper.tpl index fa4dd9f..b1a0b10 100644 --- a/charts/pulsar/templates/_bookkeeper.tpl +++ b/charts/pulsar/templates/_bookkeeper.tpl @@ -9,7 +9,7 @@ Define the pulsar bookkeeper service Define the bookkeeper hostname */}} {{- define "pulsar.bookkeeper.hostname" -}} -${HOSTNAME}.{{ template "pulsar.bookkeeper.service" . }}.{{ .Values.namespace }}.svc.cluster.local +${HOSTNAME}.{{ template "pulsar.bookkeeper.service" . }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }} {{- end -}} diff --git a/charts/pulsar/templates/_broker.tpl b/charts/pulsar/templates/_broker.tpl index bdc808f..600a7ae 100644 --- a/charts/pulsar/templates/_broker.tpl +++ b/charts/pulsar/templates/_broker.tpl @@ -9,7 +9,7 @@ Define the pulsar brroker service Define the hostname */}} {{- define "pulsar.broker.hostname" -}} -${HOSTNAME}.{{ template "pulsar.broker.service" . }}.{{ .Values.namespace }}.svc.cluster.local +${HOSTNAME}.{{ template "pulsar.broker.service" . }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }} {{- end -}} {{/* diff --git a/charts/pulsar/templates/_configurationstore.tpl b/charts/pulsar/templates/_configurationstore.tpl new file mode 100644 index 0000000..2eebf98 --- /dev/null +++ b/charts/pulsar/templates/_configurationstore.tpl @@ -0,0 +1,20 @@ +{{/* +Define configuration store endpoint +*/}} +{{- define "pulsar.configurationStore.service" -}} +{{- if .Values.pulsar_metadata.configurationStore }} +{{- .Values.pulsar_metadata.configurationStore }} +{{- else -}} +{{ template "pulsar.zookeeper.service" . }} +{{- end -}} +{{- end -}} + +{{/* +Define configuration store connection string +*/}} +{{- define "pulsar.configurationStore.connect" -}} +{{- if .Values.pulsar_metadata.configurationStore }} +{{- template "pulsar.configurationStore.service" . }}:{{ .Values.pulsar_metadata.configurationStorePort }} +{{- end -}} +{{- end -}} + diff --git a/charts/pulsar/templates/_helpers.tpl b/charts/pulsar/templates/_helpers.tpl index 931e097..8e4f38c 100644 --- a/charts/pulsar/templates/_helpers.tpl +++ b/charts/pulsar/templates/_helpers.tpl @@ -32,6 +32,17 @@ If release name contains chart name it will be used as a full name. {{- end -}} {{- end -}} +{{/* +Define cluster's name +*/}} +{{- define "pulsar.cluster.name" -}} +{{- if .Values.clusterName }} +{{- .Values.clusterName }} +{{- else -}} +{{- template "pulsar.fullname" .}} +{{- end -}} +{{- end -}} + {{/* Create chart name and version as used by the chart label. */}} @@ -47,7 +58,7 @@ app: {{ template "pulsar.name" . }} chart: {{ template "pulsar.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} -cluster: {{ template "pulsar.fullname" . }} +cluster: {{ template "pulsar.cluster.name" . }} {{- end }} {{/* @@ -56,7 +67,7 @@ Create the template labels. {{- define "pulsar.template.labels" -}} app: {{ template "pulsar.name" . }} release: {{ .Release.Name }} -cluster: {{ template "pulsar.fullname" . }} +cluster: {{ template "pulsar.cluster.name" . }} {{- end }} {{/* diff --git a/charts/pulsar/templates/_toolset.tpl b/charts/pulsar/templates/_toolset.tpl index 82217c9..8983c93 100644 --- a/charts/pulsar/templates/_toolset.tpl +++ b/charts/pulsar/templates/_toolset.tpl @@ -9,7 +9,7 @@ Define the pulsar toolset service Define the toolset hostname */}} {{- define "pulsar.toolset.hostname" -}} -${HOSTNAME}.{{ template "pulsar.toolset.service" . }}.{{ .Values.namespace }}.svc.cluster.local +${HOSTNAME}.{{ template "pulsar.toolset.service" . }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }} {{- end -}} {{/* diff --git a/charts/pulsar/templates/_zookeeper.tpl b/charts/pulsar/templates/_zookeeper.tpl index 25945d5..e67dd2e 100644 --- a/charts/pulsar/templates/_zookeeper.tpl +++ b/charts/pulsar/templates/_zookeeper.tpl @@ -26,7 +26,7 @@ Define the pulsar zookeeper Define the zookeeper hostname */}} {{- define "pulsar.zookeeper.hostname" -}} -${HOSTNAME}.{{ template "pulsar.zookeeper.service" . }}.{{ .Values.namespace }}.svc.cluster.local +${HOSTNAME}.{{ template "pulsar.zookeeper.service" . }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }} {{- end -}} {{/* diff --git a/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml b/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml index e581023..d4f1aa3 100644 --- a/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml +++ b/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml @@ -62,7 +62,7 @@ spec: echo "bookkeeper cluster already initialized"; else {{- if not (eq .Values.metadataPrefix "") }} - bin/bookkeeper org.apache.zookeeper.ZooKeeperMain -server {{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }} create {{ .Values.metadataPrefix }} 'created for pulsar cluster "{{ template "pulsar.fullname" . }}"' || yes && + bin/bookkeeper org.apache.zookeeper.ZooKeeperMain -server {{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }} create {{ .Values.metadataPrefix }} 'created for pulsar cluster "{{ template "pulsar.cluster.name" . }}"' || yes && {{- end }} bin/bookkeeper shell initnewcluster; fi @@ -75,4 +75,4 @@ spec: {{- include "pulsar.toolset.certs.volumes" . | nindent 6 }} restartPolicy: Never {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/pulsar/templates/bookkeeper-statefulset.yaml b/charts/pulsar/templates/bookkeeper-statefulset.yaml index f5fc81a..a0d7c22 100644 --- a/charts/pulsar/templates/bookkeeper-statefulset.yaml +++ b/charts/pulsar/templates/bookkeeper-statefulset.yaml @@ -90,7 +90,7 @@ spec: operator: In values: - {{ .Release.Name }} - - key: "component" + - key: "component" operator: In values: - {{ .Values.bookkeeper.component }} diff --git a/charts/pulsar/templates/broker-configmap.yaml b/charts/pulsar/templates/broker-configmap.yaml index 721038a..8139890 100644 --- a/charts/pulsar/templates/broker-configmap.yaml +++ b/charts/pulsar/templates/broker-configmap.yaml @@ -30,14 +30,14 @@ data: # Metadata settings zookeeperServers: "{{ template "pulsar.zookeeper.connect" . }}{{ .Values.metadataPrefix }}" {{- if .Values.pulsar_metadata.configurationStore }} - configurationStoreServers: "{{ .Values.pulsar_metadata.configurationStore }}{{ .Values.pulsar_metadata.configurationStoreMetadataPrefix }}" + configurationStoreServers: "{{ template "pulsar.configurationStore.connect" . }}{{ .Values.pulsar_metadata.configurationStoreMetadataPrefix }}" {{- end }} {{- if not .Values.pulsar_metadata.configurationStore }} configurationStoreServers: "{{ template "pulsar.zookeeper.connect" . }}{{ .Values.metadataPrefix }}" {{- end }} # Broker settings - clusterName: {{ template "pulsar.fullname" . }} + clusterName: {{ template "pulsar.cluster.name" . }} exposeTopicLevelMetricsInPrometheus: "true" numHttpServerThreads: "8" zooKeeperSessionTimeoutMillis: "30000" @@ -51,7 +51,7 @@ data: {{- if or .Values.components.functions .Values.extra.functionsAsPods }} functionsWorkerEnabled: "true" PF_functionRuntimeFactoryClassName: "org.apache.pulsar.functions.runtime.kubernetes.KubernetesRuntimeFactory" - PF_pulsarFunctionsCluster: {{ template "pulsar.fullname" . }} + PF_pulsarFunctionsCluster: {{ template "pulsar.cluster.name" . }} PF_connectorsDirectory: ./connectors PF_containerFactory: k8s PF_numFunctionPackageReplicas: "{{ .Values.broker.configData.managedLedgerDefaultEnsembleSize }}" @@ -90,7 +90,7 @@ data: PF_kubernetesContainerFactory_changeConfigMap: "{{ template "pulsar.fullname" . }}-{{ .Values.functions.component }}-config" PF_kubernetesContainerFactory_changeConfigMapNamespace: {{ .Values.namespace }} {{- end }} - + # prometheus needs to access /metrics endpoint webServicePort: "{{ .Values.broker.ports.http }}" {{- if or (not .Values.tls.enabled) (not .Values.tls.broker.enabled) }} @@ -143,4 +143,4 @@ data: bookkeeperUseV2WireProtocol: "false" {{- end }} {{ toYaml .Values.broker.configData | indent 2 }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/pulsar/templates/broker-statefulset.yaml b/charts/pulsar/templates/broker-statefulset.yaml index a5ce2b1..78300e0 100644 --- a/charts/pulsar/templates/broker-statefulset.yaml +++ b/charts/pulsar/templates/broker-statefulset.yaml @@ -91,7 +91,7 @@ spec: operator: In values: - {{ .Release.Name }} - - key: "component" + - key: "component" operator: In values: - {{ .Values.broker.component }} @@ -110,12 +110,12 @@ spec: - >- {{- include "pulsar.broker.zookeeper.tls.settings" . | nindent 12 }} {{- if .Values.pulsar_metadata.configurationStore }} - until bin/bookkeeper org.apache.zookeeper.ZooKeeperMain -server {{ .Values.pulsar_metadata.configurationStore}} get {{ .Values.configurationStoreMetadataPrefix }}/admin/clusters/{{ template "pulsar.fullname" . }}; do + until bin/bookkeeper org.apache.zookeeper.ZooKeeperMain -server {{ template "pulsar.configurationStore.connect" . }} get {{ .Values.configurationStoreMetadataPrefix }}/admin/clusters/{{ template "pulsar.cluster.name" . }}; do {{- end }} {{- if not .Values.pulsar_metadata.configurationStore }} - until bin/bookkeeper org.apache.zookeeper.ZooKeeperMain -server {{ template "pulsar.zookeeper.connect" . }} get {{ .Values.metadataPrefix }}/admin/clusters/{{ template "pulsar.fullname" . }}; do + until bin/bookkeeper org.apache.zookeeper.ZooKeeperMain -server {{ template "pulsar.zookeeper.connect" . }} get {{ .Values.metadataPrefix }}/admin/clusters/{{ template "pulsar.cluster.name" . }}; do {{- end }} - echo "pulsar cluster {{ template "pulsar.fullname" . }} isn't initialized yet ... check in 3 seconds ..." && sleep 3; + echo "pulsar cluster {{ template "pulsar.cluster.name" . }} isn't initialized yet ... check in 3 seconds ..." && sleep 3; done; volumeMounts: {{- include "pulsar.broker.certs.volumeMounts" . | nindent 8 }} @@ -136,7 +136,7 @@ spec: echo "bookkeeper cluster is already initialized"; bookieServiceNumber="$(nslookup -timeout=10 {{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }} | grep Name | wc -l)"; until [ ${bookieServiceNumber} -ge {{ .Values.broker.configData.managedLedgerDefaultEnsembleSize }} ]; do - echo "bookkeeper cluster {{ template "pulsar.fullname" . }} isn't ready yet ... check in 10 seconds ..."; + echo "bookkeeper cluster {{ template "pulsar.cluster.name" . }} isn't ready yet ... check in 10 seconds ..."; sleep 10; bookieServiceNumber="$(nslookup -timeout=10 {{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }} | grep Name | wc -l)"; done; @@ -253,4 +253,4 @@ spec: {{- end}} {{- end}} {{- include "pulsar.broker.certs.volumes" . | nindent 6 }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/pulsar/templates/dashboard-deployment.yaml b/charts/pulsar/templates/dashboard-deployment.yaml index 618edb6..abb50e4 100644 --- a/charts/pulsar/templates/dashboard-deployment.yaml +++ b/charts/pulsar/templates/dashboard-deployment.yaml @@ -24,12 +24,8 @@ metadata: name: "{{ template "pulsar.fullname" . }}-{{ .Values.dashboard.component }}" namespace: {{ .Values.namespace }} labels: - app: {{ template "pulsar.name" . }} - chart: {{ template "pulsar.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + {{- include "pulsar.standardLabels" . | nindent 4 }} component: {{ .Values.dashboard.component }} - cluster: {{ template "pulsar.fullname" . }} spec: replicas: {{ .Values.dashboard.replicaCount }} selector: @@ -40,10 +36,9 @@ spec: template: metadata: labels: - app: {{ template "pulsar.name" . }} - release: {{ .Release.Name }} + {{- include "pulsar.template.labels" . | nindent 8 }} component: {{ .Values.dashboard.component }} - cluster: {{ template "pulsar.fullname" . }} + annotations: {{ toYaml .Values.dashboard.annotations | indent 8 }} spec: diff --git a/charts/pulsar/templates/dashboard-ingress.yaml b/charts/pulsar/templates/dashboard-ingress.yaml index 10dc4f9..7e74d0e 100644 --- a/charts/pulsar/templates/dashboard-ingress.yaml +++ b/charts/pulsar/templates/dashboard-ingress.yaml @@ -19,22 +19,19 @@ {{- if .Values.extra.dashboard }} {{- if .Values.dashboard.ingress.enabled }} -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - labels: - app: {{ template "pulsar.name" . }} - chart: {{ template "pulsar.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - cluster: "{{ template "pulsar.fullname" . }}-{{ .Values.dashboard.component }}" - annotations: +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + labels: + {{- include "pulsar.standardLabels" . | nindent 4 }} + component: {{ .Values.dashboard.component }} + annotations: {{- with .Values.dashboard.ingress.annotations }} {{ toYaml . | indent 4 }} {{- end }} name: "{{ template "pulsar.fullname" . }}-{{ .Values.dashboard.component }}" namespace: {{ .Values.namespace }} -spec: +spec: {{- if .Values.dashboard.ingress.tls.enabled }} tls: - hosts: diff --git a/charts/pulsar/templates/dashboard-service.yaml b/charts/pulsar/templates/dashboard-service.yaml index 34147af..86dc707 100644 --- a/charts/pulsar/templates/dashboard-service.yaml +++ b/charts/pulsar/templates/dashboard-service.yaml @@ -24,12 +24,8 @@ metadata: name: "{{ template "pulsar.fullname" . }}-{{ .Values.dashboard.component }}" namespace: {{ .Values.namespace }} labels: - app: {{ template "pulsar.name" . }} - chart: {{ template "pulsar.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + {{- include "pulsar.standardLabels" . | nindent 4 }} component: {{ .Values.dashboard.component }} - cluster: {{ template "pulsar.fullname" . }} annotations: {{ toYaml .Values.dashboard.service.annotations | indent 4 }} spec: diff --git a/charts/pulsar/templates/proxy-configmap.yaml b/charts/pulsar/templates/proxy-configmap.yaml index 491d1bc..64704d7 100644 --- a/charts/pulsar/templates/proxy-configmap.yaml +++ b/charts/pulsar/templates/proxy-configmap.yaml @@ -27,7 +27,7 @@ metadata: {{- include "pulsar.standardLabels" . | nindent 4 }} component: {{ .Values.proxy.component }} data: - clusterName: {{ template "pulsar.fullname" . }} + clusterName: {{ template "pulsar.cluster.name" . }} httpNumThreads: "8" statusFilePath: "{{ template "pulsar.home" . }}/status" # prometheus needs to access /metrics endpoint diff --git a/charts/pulsar/templates/proxy-ingress.yaml b/charts/pulsar/templates/proxy-ingress.yaml index 6fb820c..522aec3 100644 --- a/charts/pulsar/templates/proxy-ingress.yaml +++ b/charts/pulsar/templates/proxy-ingress.yaml @@ -18,22 +18,19 @@ # {{- if .Values.proxy.ingress.enabled }} -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - labels: - app: {{ template "pulsar.name" . }} - chart: {{ template "pulsar.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - cluster: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}" - annotations: +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + labels: + {{- include "pulsar.standardLabels" . | nindent 4 }} + component: {{ .Values.proxy.component }} + annotations: {{- with .Values.proxy.ingress.annotations }} {{ toYaml . | indent 4 }} {{- end }} name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}" namespace: {{ .Values.namespace }} -spec: +spec: {{- if .Values.proxy.ingress.tls.enabled }} tls: - hosts: diff --git a/charts/pulsar/templates/proxy-statefulset.yaml b/charts/pulsar/templates/proxy-statefulset.yaml index e10722b..c14ae98 100644 --- a/charts/pulsar/templates/proxy-statefulset.yaml +++ b/charts/pulsar/templates/proxy-statefulset.yaml @@ -90,7 +90,7 @@ spec: operator: In values: - {{ .Release.Name }} - - key: "component" + - key: "component" operator: In values: - {{ .Values.proxy.component }} @@ -112,7 +112,7 @@ spec: echo "user provided zookeepers {{ $zk }} are unreachable... check in 3 seconds ..." && sleep 3; done; {{ else }} - until bin/pulsar zookeeper-shell -server {{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }} get {{ .Values.metadataPrefix }}/admin/clusters/{{ template "pulsar.fullname" . }}; do + until bin/pulsar zookeeper-shell -server {{ template "pulsar.configurationStore.service" . }} get {{ .Values.metadataPrefix }}/admin/clusters/{{ template "pulsar.cluster.name" . }}; do sleep 3; done; {{- end}} @@ -127,7 +127,7 @@ spec: set -e; brokerServiceNumber="$(nslookup -timeout=10 {{ template "pulsar.fullname" . }}-{{ .Values.broker.component }} | grep Name | wc -l)"; until [ ${brokerServiceNumber} -ge 1 ]; do - echo "pulsar cluster {{ template "pulsar.fullname" . }} isn't initialized yet ... check in 10 seconds ..."; + echo "pulsar cluster {{ template "pulsar.cluster.name" . }} isn't initialized yet ... check in 10 seconds ..."; sleep 10; brokerServiceNumber="$(nslookup -timeout=10 {{ template "pulsar.fullname" . }}-{{ .Values.broker.component }} | grep Name | wc -l)"; done; diff --git a/charts/pulsar/templates/pulsar-cluster-initialize.yaml b/charts/pulsar/templates/pulsar-cluster-initialize.yaml index 28ca512..0fd2cb6 100644 --- a/charts/pulsar/templates/pulsar-cluster-initialize.yaml +++ b/charts/pulsar/templates/pulsar-cluster-initialize.yaml @@ -89,22 +89,22 @@ spec: - > {{- include "pulsar.toolset.zookeeper.tls.settings" . | nindent 12 }} bin/pulsar initialize-cluster-metadata \ - --cluster {{ template "pulsar.fullname" . }} \ + --cluster {{ template "pulsar.cluster.name" . }} \ --zookeeper {{ template "pulsar.zookeeper.connect" . }}{{ .Values.metadataPrefix }} \ {{- if .Values.pulsar_metadata.configurationStore }} - --configuration-store {{ .Values.pulsar_metadata.configurationStore }}{{ .Values.pulsar_metadata.configurationStoreMetadataPrefix }} \ + --configuration-store {{ template "pulsar.configurationStore.connect" . }}{{ .Values.pulsar_metadata.configurationStoreMetadataPrefix }} \ {{- end }} {{- if not .Values.pulsar_metadata.configurationStore }} --configuration-store {{ template "pulsar.zookeeper.connect" . }}{{ .Values.metadataPrefix }} \ {{- end }} - --web-service-url http://{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}.{{ .Values.namespace }}.svc.cluster.local:8080/ \ - --web-service-url-tls https://{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}.{{ .Values.namespace }}.svc.cluster.local:8443/ \ - --broker-service-url pulsar://{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}.{{ .Values.namespace }}.svc.cluster.local:6650/ \ - --broker-service-url-tls pulsar+ssl://{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}.{{ .Values.namespace }}.svc.cluster.local:6651/ || true; + --web-service-url http://{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.broker.ports.http }}/ \ + --web-service-url-tls https://{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.broker.ports.https }}/ \ + --broker-service-url pulsar://{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.broker.ports.pulsar }}/ \ + --broker-service-url-tls pulsar+ssl://{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.broker.ports.pulsarssl }}/ || true; volumeMounts: {{- include "pulsar.toolset.certs.volumeMounts" . | nindent 8 }} volumes: {{- include "pulsar.toolset.certs.volumes" . | nindent 6 }} restartPolicy: Never {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/pulsar/templates/pulsar-manager-ingress.yaml b/charts/pulsar/templates/pulsar-manager-ingress.yaml index f8678d4..9678cb1 100644 --- a/charts/pulsar/templates/pulsar-manager-ingress.yaml +++ b/charts/pulsar/templates/pulsar-manager-ingress.yaml @@ -18,22 +18,19 @@ # {{- if .Values.pulsar_manager.ingress.enabled }} -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - labels: - app: {{ template "pulsar.name" . }} - chart: {{ template "pulsar.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - cluster: "{{ template "pulsar.fullname" . }}-{{ .Values.pulsar_manager.component }}" - annotations: +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + labels: + {{- include "pulsar.standardLabels" . | nindent 4 }} + component: {{ .Values.pulsar_manager.component }} + annotations: {{- with .Values.pulsar_manager.ingress.annotations }} {{ toYaml . | indent 4 }} {{- end }} name: "{{ template "pulsar.fullname" . }}-{{ .Values.pulsar_manager.component }}" namespace: {{ .Values.namespace }} -spec: +spec: {{- if .Values.pulsar_manager.ingress.tls.enabled }} tls: - hosts: diff --git a/charts/pulsar/templates/tls-cert-internal-issuer.yaml b/charts/pulsar/templates/tls-cert-internal-issuer.yaml index bf006a1..4f94374 100644 --- a/charts/pulsar/templates/tls-cert-internal-issuer.yaml +++ b/charts/pulsar/templates/tls-cert-internal-issuer.yaml @@ -35,7 +35,7 @@ metadata: namespace: {{ .Values.namespace }} spec: secretName: "{{ .Release.Name }}-ca-tls" - commonName: "{{ .Values.namespace }}.svc.cluster.local" + commonName: "{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}" usages: - server auth - client auth diff --git a/charts/pulsar/templates/tls-certs-internal.yaml b/charts/pulsar/templates/tls-certs-internal.yaml index 1a20bbd..e7b7c2a 100644 --- a/charts/pulsar/templates/tls-certs-internal.yaml +++ b/charts/pulsar/templates/tls-certs-internal.yaml @@ -35,7 +35,7 @@ spec: {{ toYaml .Values.tls.common.organization | indent 2 }} # The use of the common name field has been deprecated since 2000 and is # discouraged from being used. - commonName: "*.{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}.{{ .Values.namespace }}.svc.cluster.local" + commonName: "*.{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}" isCA: false keySize: {{ .Values.tls.common.keySize }} keyAlgorithm: {{ .Values.tls.common.keyAlgorithm }} @@ -45,7 +45,7 @@ spec: - client auth # At least one of a DNS Name, USI SAN, or IP address is required. dnsNames: - - "*.{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}.{{ .Values.namespace }}.svc.cluster.local" + - "*.{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}" - "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}" # Issuer references are always required. issuerRef: @@ -74,7 +74,7 @@ spec: {{ toYaml .Values.tls.common.organization | indent 2 }} # The use of the common name field has been deprecated since 2000 and is # discouraged from being used. - commonName: "*.{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}.{{ .Values.namespace }}.svc.cluster.local" + commonName: "*.{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}" isCA: false keySize: {{ .Values.tls.common.keySize }} keyAlgorithm: {{ .Values.tls.common.keyAlgorithm }} @@ -84,7 +84,7 @@ spec: - client auth # At least one of a DNS Name, USI SAN, or IP address is required. dnsNames: - - "*.{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}.{{ .Values.namespace }}.svc.cluster.local" + - "*.{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}" - "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}" # Issuer references are always required. issuerRef: @@ -113,7 +113,7 @@ spec: {{ toYaml .Values.tls.common.organization | indent 2 }} # The use of the common name field has been deprecated since 2000 and is # discouraged from being used. - commonName: "*.{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}.{{ .Values.namespace }}.svc.cluster.local" + commonName: "*.{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}" isCA: false keySize: {{ .Values.tls.common.keySize }} keyAlgorithm: {{ .Values.tls.common.keyAlgorithm }} @@ -122,7 +122,7 @@ spec: - server auth - client auth dnsNames: - - "*.{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}.{{ .Values.namespace }}.svc.cluster.local" + - "*.{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}" - "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}" # Issuer references are always required. issuerRef: @@ -151,7 +151,7 @@ spec: {{ toYaml .Values.tls.common.organization | indent 2 }} # The use of the common name field has been deprecated since 2000 and is # discouraged from being used. - commonName: "*.{{ template "pulsar.fullname" . }}-{{ .Values.autorecovery.component }}.{{ .Values.namespace }}.svc.cluster.local" + commonName: "*.{{ template "pulsar.fullname" . }}-{{ .Values.autorecovery.component }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}" isCA: false keySize: {{ .Values.tls.common.keySize }} keyAlgorithm: {{ .Values.tls.common.keyAlgorithm }} @@ -160,7 +160,7 @@ spec: - server auth - client auth dnsNames: - - "*.{{ template "pulsar.fullname" . }}-{{ .Values.autorecovery.component }}.{{ .Values.namespace }}.svc.cluster.local" + - "*.{{ template "pulsar.fullname" . }}-{{ .Values.autorecovery.component }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}" - "{{ template "pulsar.fullname" . }}-{{ .Values.autorecovery.component }}" # Issuer references are always required. issuerRef: @@ -186,7 +186,7 @@ spec: {{ toYaml .Values.tls.common.organization | indent 2 }} # The use of the common name field has been deprecated since 2000 and is # discouraged from being used. - commonName: "*.{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component }}.{{ .Values.namespace }}.svc.cluster.local" + commonName: "*.{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}" isCA: false keySize: {{ .Values.tls.common.keySize }} keyAlgorithm: {{ .Values.tls.common.keyAlgorithm }} @@ -195,7 +195,7 @@ spec: - server auth - client auth dnsNames: - - "*.{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component }}.{{ .Values.namespace }}.svc.cluster.local" + - "*.{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}" - "{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component }}" # Issuer references are always required. issuerRef: @@ -221,7 +221,7 @@ spec: {{ toYaml .Values.tls.common.organization | indent 2 }} # The use of the common name field has been deprecated since 2000 and is # discouraged from being used. - commonName: "*.{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}.{{ .Values.namespace }}.svc.cluster.local" + commonName: "*.{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}" isCA: false keySize: {{ .Values.tls.common.keySize }} keyAlgorithm: {{ .Values.tls.common.keyAlgorithm }} @@ -230,7 +230,7 @@ spec: - server auth - client auth dnsNames: - - "*.{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}.{{ .Values.namespace }}.svc.cluster.local" + - "*.{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}.{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}" - "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}" # Issuer references are always required. issuerRef: diff --git a/charts/pulsar/values.yaml b/charts/pulsar/values.yaml index 18d5d7c..a2a73e7 100644 --- a/charts/pulsar/values.yaml +++ b/charts/pulsar/values.yaml @@ -26,6 +26,9 @@ namespace: pulsar namespaceCreate: false +## clusterDomain as defined for your k8s cluster +clusterDomain: cluster.local + ### ### Global Settings ### @@ -33,6 +36,9 @@ namespaceCreate: false ## Set to true on install initialize: false +## Set cluster name +# clusterName: + ## Pulsar Metadata Prefix ## ## By default, pulsar stores all the metadata at root path. @@ -69,10 +75,10 @@ volumes: ## the `affinity.anti_affinity` settings to `false` for that component. affinity: anti_affinity: true - # Set the anti affinity type. Valid values: + # Set the anti affinity type. Valid values: # requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee - type: requiredDuringSchedulingIgnoredDuringExecution + type: requiredDuringSchedulingIgnoredDuringExecution ## Components ## @@ -292,10 +298,10 @@ zookeeper: periodSeconds: 30 affinity: anti_affinity: true - # Set the anti affinity type. Valid values: + # Set the anti affinity type. Valid values: # requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee - type: requiredDuringSchedulingIgnoredDuringExecution + type: requiredDuringSchedulingIgnoredDuringExecution annotations: prometheus.io/scrape: "true" prometheus.io/port: "8000" @@ -402,10 +408,10 @@ bookkeeper: periodSeconds: 30 affinity: anti_affinity: true - # Set the anti affinity type. Valid values: + # Set the anti affinity type. Valid values: # requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee - type: requiredDuringSchedulingIgnoredDuringExecution + type: requiredDuringSchedulingIgnoredDuringExecution annotations: {} tolerations: [] gracePeriod: 30 @@ -507,10 +513,10 @@ autorecovery: # cloud.google.com/gke-nodepool: default-pool affinity: anti_affinity: true - # Set the anti affinity type. Valid values: + # Set the anti affinity type. Valid values: # requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee - type: requiredDuringSchedulingIgnoredDuringExecution + type: requiredDuringSchedulingIgnoredDuringExecution annotations: {} # tolerations: [] gracePeriod: 30 @@ -541,6 +547,7 @@ pulsar_metadata: ## set an existing configuration store # configurationStore: configurationStoreMetadataPrefix: "" + configurationStorePort: 2181 ## optional, you can provide your own zookeeper metadata store for other components # to use this, you should explicit set components.zookeeper to false @@ -586,10 +593,10 @@ broker: periodSeconds: 10 affinity: anti_affinity: true - # Set the anti affinity type. Valid values: + # Set the anti affinity type. Valid values: # requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee - type: preferredDuringSchedulingIgnoredDuringExecution + type: preferredDuringSchedulingIgnoredDuringExecution annotations: {} tolerations: [] gracePeriod: 30 @@ -677,10 +684,10 @@ proxy: periodSeconds: 10 affinity: anti_affinity: true - # Set the anti affinity type. Valid values: + # Set the anti affinity type. Valid values: # requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee - type: requiredDuringSchedulingIgnoredDuringExecution + type: requiredDuringSchedulingIgnoredDuringExecution annotations: {} tolerations: [] gracePeriod: 30