This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-helm-chart.git


The following commit(s) were added to refs/heads/master by this push:
     new 6c9856a  Use `.Release.Namespace` by default to handle namespaces (#80)
6c9856a is described below

commit 6c9856a1afd888d7851c2e2cc7d4744e56613ac2
Author: Jean Helou <[email protected]>
AuthorDate: Fri Dec 4 04:32:05 2020 +0100

    Use `.Release.Namespace` by default to handle namespaces (#80)
    
    It remains possible to override the current release namespace by setting
    the `namespace` value though this may lead to having the helm metadata
    and the pulsar components in different namespaces
    
    Fixes #66
    
    ### Motivation
    
    Trying to deploy the chart in a namespace using the usual helm pattern 
fails for example
    ```
    kubectl create ns pulsartest
    helm upgrade --install pulsar -n pulsartest apache/pulsar
    Error: namespaces "pulsar" not found
    ```
    fixing that while keeping the helm metadata and the deployed objects in the 
same namespace requires declaring the namespace twice
    ```
    kubectl create ns pulsartest
    helm upgrade --install pulsar -n pulsartest apache/pulsar --set 
namespace=pulsartest
    Error: namespaces "pulsar" not found
    ```
    This is needlessly confusing for newcomers who follow the helm 
documentation and is contrary to helm best practices.
    
    ### Modifications
    
    I changed the chart to use the context namespace `.Release.Namespace` by 
default while preserving the ability to override that by explicitly providing a 
namespace on the commande line, with the this modification both  examples 
behave as expected
    
    ### Verifying this change
    
    - [x] Make sure that the change passes the CI checks.
---
 .ci/helm.sh                                        |  6 ++--
 charts/pulsar/Chart.yaml                           |  2 +-
 charts/pulsar/templates/_autorecovery.tpl          |  2 +-
 charts/pulsar/templates/_bookkeeper.tpl            |  2 +-
 charts/pulsar/templates/_broker.tpl                |  2 +-
 charts/pulsar/templates/_helpers.tpl               |  7 +++++
 charts/pulsar/templates/_toolset.tpl               |  2 +-
 charts/pulsar/templates/_zookeeper.tpl             |  2 +-
 .../pulsar/templates/autorecovery-configmap.yaml   |  2 +-
 charts/pulsar/templates/autorecovery-service.yaml  |  2 +-
 .../pulsar/templates/autorecovery-statefulset.yaml |  2 +-
 .../templates/bookkeeper-cluster-initialize.yaml   |  4 +--
 charts/pulsar/templates/bookkeeper-configmap.yaml  |  2 +-
 charts/pulsar/templates/bookkeeper-pdb.yaml        |  2 +-
 charts/pulsar/templates/bookkeeper-service.yaml    |  2 +-
 .../pulsar/templates/bookkeeper-statefulset.yaml   |  2 +-
 .../pulsar/templates/bookkeeper-storageclass.yaml  |  4 +--
 .../templates/broker-cluster-role-binding.yaml     |  2 +-
 charts/pulsar/templates/broker-configmap.yaml      | 10 +++---
 charts/pulsar/templates/broker-pdb.yaml            |  2 +-
 charts/pulsar/templates/broker-rbac.yaml           |  4 +--
 .../pulsar/templates/broker-service-account.yaml   |  2 +-
 charts/pulsar/templates/broker-service.yaml        |  2 +-
 charts/pulsar/templates/broker-statefulset.yaml    |  2 +-
 charts/pulsar/templates/dashboard-deployment.yaml  |  2 +-
 charts/pulsar/templates/dashboard-ingress.yaml     |  2 +-
 charts/pulsar/templates/dashboard-service.yaml     |  2 +-
 .../templates/function-worker-configmap.yaml       |  2 +-
 charts/pulsar/templates/grafana-admin-secret.yaml  |  2 +-
 charts/pulsar/templates/grafana-configmap.yaml     |  2 +-
 charts/pulsar/templates/grafana-deployment.yaml    |  2 +-
 charts/pulsar/templates/grafana-ingress.yaml       |  2 +-
 charts/pulsar/templates/grafana-service.yaml       |  2 +-
 charts/pulsar/templates/keytool.yaml               |  2 +-
 charts/pulsar/templates/namespace.yaml             |  2 +-
 charts/pulsar/templates/prometheus-configmap.yaml  |  2 +-
 charts/pulsar/templates/prometheus-deployment.yaml |  2 +-
 charts/pulsar/templates/prometheus-pvc.yaml        |  2 +-
 charts/pulsar/templates/prometheus-rbac.yaml       |  4 +--
 charts/pulsar/templates/prometheus-service.yaml    |  2 +-
 .../pulsar/templates/prometheus-storageclass.yaml  |  2 +-
 charts/pulsar/templates/proxy-configmap.yaml       |  2 +-
 charts/pulsar/templates/proxy-ingress.yaml         |  2 +-
 charts/pulsar/templates/proxy-pdb.yaml             |  2 +-
 charts/pulsar/templates/proxy-service.yaml         |  2 +-
 charts/pulsar/templates/proxy-statefulset.yaml     |  2 +-
 .../templates/pulsar-cluster-initialize.yaml       | 12 ++++----
 .../templates/pulsar-manager-admin-secret.yaml     |  2 +-
 .../pulsar/templates/pulsar-manager-configmap.yaml |  2 +-
 .../templates/pulsar-manager-deployment.yaml       |  2 +-
 .../pulsar/templates/pulsar-manager-ingress.yaml   |  2 +-
 .../pulsar/templates/pulsar-manager-service.yaml   |  2 +-
 .../pulsar/templates/tls-cert-internal-issuer.yaml |  8 ++---
 charts/pulsar/templates/tls-certs-internal.yaml    | 36 +++++++++++-----------
 charts/pulsar/templates/toolset-configmap.yaml     |  2 +-
 charts/pulsar/templates/toolset-service.yaml       |  2 +-
 charts/pulsar/templates/toolset-statefulset.yaml   |  2 +-
 charts/pulsar/templates/zookeeper-configmap.yaml   |  2 +-
 charts/pulsar/templates/zookeeper-pdb.yaml         |  2 +-
 charts/pulsar/templates/zookeeper-service.yaml     |  2 +-
 charts/pulsar/templates/zookeeper-statefulset.yaml |  2 +-
 .../pulsar/templates/zookeeper-storageclass.yaml   |  2 +-
 charts/pulsar/values.yaml                          |  7 +++--
 scripts/pulsar/generate_token.sh                   |  9 ++++--
 64 files changed, 113 insertions(+), 102 deletions(-)

diff --git a/.ci/helm.sh b/.ci/helm.sh
index 2ebd685..55df7ca 100644
--- a/.ci/helm.sh
+++ b/.ci/helm.sh
@@ -78,12 +78,12 @@ function ci::install_pulsar_chart() {
     ${KUBECTL} create namespace ${NAMESPACE}
     echo ${CHARTS_HOME}/scripts/pulsar/prepare_helm_release.sh -k ${CLUSTER} 
-n ${NAMESPACE} ${extra_opts}
     ${CHARTS_HOME}/scripts/pulsar/prepare_helm_release.sh -k ${CLUSTER} -n 
${NAMESPACE} ${extra_opts}
-    ${CHARTS_HOME}/scripts/pulsar/upload_tls.sh -k ${CLUSTER} -d 
${PULSAR_HOME}/.ci/tls
+    ${CHARTS_HOME}/scripts/pulsar/upload_tls.sh -k ${CLUSTER} -n ${NAMESPACE} 
-d ${PULSAR_HOME}/.ci/tls
     sleep 10
 
     echo ${HELM} install --set initialize=true --values ${value_file} 
${CLUSTER} ${CHARTS_HOME}/charts/pulsar
     ${HELM} template --values ${value_file} ${CLUSTER} 
${CHARTS_HOME}/charts/pulsar
-    ${HELM} install --set initialize=true --values ${value_file} ${CLUSTER} 
${CHARTS_HOME}/charts/pulsar
+    ${HELM} install --set initialize=true --values ${value_file} 
--namespace=${NAMESPACE} ${CLUSTER} ${CHARTS_HOME}/charts/pulsar
 
     echo "wait until broker is alive"
     WC=$(${KUBECTL} get pods -n ${NAMESPACE} 
--field-selector=status.phase=Running | grep ${CLUSTER}-broker | wc -l)
@@ -161,4 +161,4 @@ function ci::test_pulsar_function() {
     # ci::wait_function_running
     # ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- 
bin/pulsar-client produce -m "hello pulsar function!" pulsar-ci/test/test_input
     # ci::wait_message_processed
-}
\ No newline at end of file
+}
diff --git a/charts/pulsar/Chart.yaml b/charts/pulsar/Chart.yaml
index ea2533e..a09d11a 100644
--- a/charts/pulsar/Chart.yaml
+++ b/charts/pulsar/Chart.yaml
@@ -21,7 +21,7 @@ apiVersion: v1
 appVersion: "2.6.2"
 description: Apache Pulsar Helm chart for Kubernetes
 name: pulsar
-version: 2.6.2-1
+version: 2.6.2-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 97f8e9e..e1e74d5 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.{{ .Values.clusterDomain }}
+${HOSTNAME}.{{ template "pulsar.autorecovery.service" . }}.{{ template 
"pulsar.namespace" . }}.svc.{{ .Values.clusterDomain }}
 {{- end -}}
 
 {{/*
diff --git a/charts/pulsar/templates/_bookkeeper.tpl 
b/charts/pulsar/templates/_bookkeeper.tpl
index b1a0b10..bd319ff 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.{{ .Values.clusterDomain }}
+${HOSTNAME}.{{ template "pulsar.bookkeeper.service" . }}.{{ template 
"pulsar.namespace" . }}.svc.{{ .Values.clusterDomain }}
 {{- end -}}
 
 
diff --git a/charts/pulsar/templates/_broker.tpl 
b/charts/pulsar/templates/_broker.tpl
index 600a7ae..758a0b6 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.{{ .Values.clusterDomain }}
+${HOSTNAME}.{{ template "pulsar.broker.service" . }}.{{ template 
"pulsar.namespace" . }}.svc.{{ .Values.clusterDomain }}
 {{- end -}}
 
 {{/*
diff --git a/charts/pulsar/templates/_helpers.tpl 
b/charts/pulsar/templates/_helpers.tpl
index 8e4f38c..ebc0409 100644
--- a/charts/pulsar/templates/_helpers.tpl
+++ b/charts/pulsar/templates/_helpers.tpl
@@ -15,6 +15,13 @@ Expand the name of the chart.
 {{- end -}}
 
 {{/*
+Expand the namespace of the chart.
+*/}}
+{{- define "pulsar.namespace" -}}
+{{- default .Release.Namespace .Values.namespace  -}}
+{{- end -}}
+
+{{/*
 Create a default fully qualified app name.
 We truncate at 63 chars because some Kubernetes name fields are limited to 
this (by the DNS naming spec).
 If release name contains chart name it will be used as a full name.
diff --git a/charts/pulsar/templates/_toolset.tpl 
b/charts/pulsar/templates/_toolset.tpl
index 8983c93..5b149b5 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.{{ .Values.clusterDomain }}
+${HOSTNAME}.{{ template "pulsar.toolset.service" . }}.{{ template 
"pulsar.namespace" . }}.svc.{{ .Values.clusterDomain }}
 {{- end -}}
 
 {{/*
diff --git a/charts/pulsar/templates/_zookeeper.tpl 
b/charts/pulsar/templates/_zookeeper.tpl
index e67dd2e..6104afc 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.{{ .Values.clusterDomain }}
+${HOSTNAME}.{{ template "pulsar.zookeeper.service" . }}.{{ template 
"pulsar.namespace" . }}.svc.{{ .Values.clusterDomain }}
 {{- end -}}
 
 {{/*
diff --git a/charts/pulsar/templates/autorecovery-configmap.yaml 
b/charts/pulsar/templates/autorecovery-configmap.yaml
index 8d7fb3f..65cd644 100644
--- a/charts/pulsar/templates/autorecovery-configmap.yaml
+++ b/charts/pulsar/templates/autorecovery-configmap.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: ConfigMap
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.autorecovery.component 
}}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.autorecovery.component }}
diff --git a/charts/pulsar/templates/autorecovery-service.yaml 
b/charts/pulsar/templates/autorecovery-service.yaml
index ab237c9..a6cb064 100644
--- a/charts/pulsar/templates/autorecovery-service.yaml
+++ b/charts/pulsar/templates/autorecovery-service.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: Service
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.autorecovery.component 
}}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.autorecovery.component }}
diff --git a/charts/pulsar/templates/autorecovery-statefulset.yaml 
b/charts/pulsar/templates/autorecovery-statefulset.yaml
index 0ededb7..1e3d46f 100644
--- a/charts/pulsar/templates/autorecovery-statefulset.yaml
+++ b/charts/pulsar/templates/autorecovery-statefulset.yaml
@@ -22,7 +22,7 @@ apiVersion: apps/v1
 kind: StatefulSet
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.autorecovery.component 
}}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.autorecovery.component }}
diff --git a/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml 
b/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml
index d4f1aa3..4c12bae 100644
--- a/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml
+++ b/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml
@@ -22,7 +22,7 @@ apiVersion: batch/v1
 kind: Job
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component 
}}-init"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: "{{ .Values.bookkeeper.component }}-init"
@@ -41,7 +41,7 @@ spec:
               echo "user provided zookeepers {{ $zk }} are unreachable... 
check in 3 seconds ..." && sleep 3;
             done;
             {{ else }}
-            until nslookup {{ template "pulsar.fullname" . }}-{{ 
.Values.zookeeper.component }}-{{ add (.Values.zookeeper.replicaCount | int) -1 
}}.{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}.{{ 
.Values.namespace }}; do
+            until nslookup {{ template "pulsar.fullname" . }}-{{ 
.Values.zookeeper.component }}-{{ add (.Values.zookeeper.replicaCount | int) -1 
}}.{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}.{{ 
template "pulsar.namespace" . }}; do
               sleep 3;
             done;
             {{- end}}
diff --git a/charts/pulsar/templates/bookkeeper-configmap.yaml 
b/charts/pulsar/templates/bookkeeper-configmap.yaml
index 05c43ce..a99ee20 100644
--- a/charts/pulsar/templates/bookkeeper-configmap.yaml
+++ b/charts/pulsar/templates/bookkeeper-configmap.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: ConfigMap
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.bookkeeper.component }}
diff --git a/charts/pulsar/templates/bookkeeper-pdb.yaml 
b/charts/pulsar/templates/bookkeeper-pdb.yaml
index 35ac16d..74e1503 100644
--- a/charts/pulsar/templates/bookkeeper-pdb.yaml
+++ b/charts/pulsar/templates/bookkeeper-pdb.yaml
@@ -23,7 +23,7 @@ apiVersion: policy/v1beta1
 kind: PodDisruptionBudget
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.bookkeeper.component }}
diff --git a/charts/pulsar/templates/bookkeeper-service.yaml 
b/charts/pulsar/templates/bookkeeper-service.yaml
index cd2578e..3bf9495 100644
--- a/charts/pulsar/templates/bookkeeper-service.yaml
+++ b/charts/pulsar/templates/bookkeeper-service.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: Service
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.bookkeeper.component }}
diff --git a/charts/pulsar/templates/bookkeeper-statefulset.yaml 
b/charts/pulsar/templates/bookkeeper-statefulset.yaml
index a0d7c22..5662bbb 100644
--- a/charts/pulsar/templates/bookkeeper-statefulset.yaml
+++ b/charts/pulsar/templates/bookkeeper-statefulset.yaml
@@ -22,7 +22,7 @@ apiVersion: apps/v1
 kind: StatefulSet
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.bookkeeper.component }}
diff --git a/charts/pulsar/templates/bookkeeper-storageclass.yaml 
b/charts/pulsar/templates/bookkeeper-storageclass.yaml
index 3e8ebce..9d7e501 100644
--- a/charts/pulsar/templates/bookkeeper-storageclass.yaml
+++ b/charts/pulsar/templates/bookkeeper-storageclass.yaml
@@ -24,7 +24,7 @@ apiVersion: storage.k8s.io/v1
 kind: StorageClass
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component 
}}-{{ .Values.bookkeeper.volumes.journal.name }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.bookkeeper.component }}
@@ -40,7 +40,7 @@ apiVersion: storage.k8s.io/v1
 kind: StorageClass
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component 
}}-{{ .Values.bookkeeper.volumes.ledgers.name }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.bookkeeper.component }}
diff --git a/charts/pulsar/templates/broker-cluster-role-binding.yaml 
b/charts/pulsar/templates/broker-cluster-role-binding.yaml
index 803fccb..4fd5769 100644
--- a/charts/pulsar/templates/broker-cluster-role-binding.yaml
+++ b/charts/pulsar/templates/broker-cluster-role-binding.yaml
@@ -32,7 +32,7 @@ roleRef:
 subjects:
 - kind: ServiceAccount
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component 
}}-acct"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 ---
 
 apiVersion: rbac.authorization.k8s.io/v1beta1
diff --git a/charts/pulsar/templates/broker-configmap.yaml 
b/charts/pulsar/templates/broker-configmap.yaml
index 8139890..f92e330 100644
--- a/charts/pulsar/templates/broker-configmap.yaml
+++ b/charts/pulsar/templates/broker-configmap.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: ConfigMap
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.broker.component }}
@@ -61,7 +61,7 @@ data:
   PF_functionRuntimeFactoryConfigs_pulsarDockerImageName: "{{ 
.Values.images.functions.repository }}:{{ .Values.images.functions.tag }}"
   PF_functionRuntimeFactoryConfigs_submittingInsidePod: "true"
   PF_functionRuntimeFactoryConfigs_installUserCodeDependencies: "true"
-  PF_functionRuntimeFactoryConfigs_jobNamespace: {{ .Values.namespace }}
+  PF_functionRuntimeFactoryConfigs_jobNamespace: {{ template 
"pulsar.namespace" . }}
   PF_functionRuntimeFactoryConfigs_expectedMetricsCollectionInterval: "30"
   {{- if not (and .Values.tls.enabled .Values.tls.broker.enabled) }}
   PF_functionRuntimeFactoryConfigs_pulsarAdminUrl: "http://{{ template 
"pulsar.fullname" . }}-{{ .Values.broker.component }}:{{ 
.Values.broker.ports.http }}/"
@@ -72,12 +72,12 @@ data:
   PF_functionRuntimeFactoryConfigs_pulsarServiceUrl: "pulsar+ssl://{{ template 
"pulsar.fullname" . }}-{{ .Values.broker.component }}:{{ 
.Values.broker.ports.pulsarssl }}/"
   {{- end }}
   PF_functionRuntimeFactoryConfigs_changeConfigMap: "{{ template 
"pulsar.fullname" . }}-{{ .Values.functions.component }}-config"
-  PF_functionRuntimeFactoryConfigs_changeConfigMapNamespace: {{ 
.Values.namespace }}
+  PF_functionRuntimeFactoryConfigs_changeConfigMapNamespace: {{ template 
"pulsar.namespace" . }}
   # support version < 2.5.0
   PF_kubernetesContainerFactory_pulsarDockerImageName: "{{ 
.Values.images.functions.repository }}:{{ .Values.images.functions.tag }}"
   PF_kubernetesContainerFactory_submittingInsidePod: "true"
   PF_kubernetesContainerFactory_installUserCodeDependencies: "true"
-  PF_kubernetesContainerFactory_jobNamespace: {{ .Values.namespace }}
+  PF_kubernetesContainerFactory_jobNamespace: {{ template "pulsar.namespace" . 
}}
   PF_kubernetesContainerFactory_expectedMetricsCollectionInterval: "30"
   {{- if not (and .Values.tls.enabled .Values.tls.broker.enabled) }}
   PF_kubernetesContainerFactory_pulsarAdminUrl: "http://{{ template 
"pulsar.fullname" . }}-{{ .Values.broker.component }}:{{ 
.Values.broker.ports.http }}/"
@@ -88,7 +88,7 @@ data:
   PF_kubernetesContainerFactory_pulsarServiceUrl: "pulsar+ssl://{{ template 
"pulsar.fullname" . }}-{{ .Values.broker.component }}:{{ 
.Values.broker.ports.pulsarssl }}/"
   {{- end }}
   PF_kubernetesContainerFactory_changeConfigMap: "{{ template 
"pulsar.fullname" . }}-{{ .Values.functions.component }}-config"
-  PF_kubernetesContainerFactory_changeConfigMapNamespace: {{ .Values.namespace 
}}
+  PF_kubernetesContainerFactory_changeConfigMapNamespace: {{ template 
"pulsar.namespace" . }}
   {{- end }}
 
   # prometheus needs to access /metrics endpoint
diff --git a/charts/pulsar/templates/broker-pdb.yaml 
b/charts/pulsar/templates/broker-pdb.yaml
index a3843a1..c03aca6 100644
--- a/charts/pulsar/templates/broker-pdb.yaml
+++ b/charts/pulsar/templates/broker-pdb.yaml
@@ -23,7 +23,7 @@ apiVersion: policy/v1beta1
 kind: PodDisruptionBudget
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.broker.component }}
diff --git a/charts/pulsar/templates/broker-rbac.yaml 
b/charts/pulsar/templates/broker-rbac.yaml
index 763efae..fc26c04 100644
--- a/charts/pulsar/templates/broker-rbac.yaml
+++ b/charts/pulsar/templates/broker-rbac.yaml
@@ -42,7 +42,7 @@ apiVersion: v1
 kind: ServiceAccount
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.functions.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 ---
 
 apiVersion: rbac.authorization.k8s.io/v1beta1
@@ -56,5 +56,5 @@ roleRef:
 subjects:
 - kind: ServiceAccount
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.functions.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 {{- end }}
diff --git a/charts/pulsar/templates/broker-service-account.yaml 
b/charts/pulsar/templates/broker-service-account.yaml
index 5e77d10..6be8b1d 100644
--- a/charts/pulsar/templates/broker-service-account.yaml
+++ b/charts/pulsar/templates/broker-service-account.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: ServiceAccount
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component 
}}-acct"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.broker.component }}
diff --git a/charts/pulsar/templates/broker-service.yaml 
b/charts/pulsar/templates/broker-service.yaml
index 2b30333..84b1b5e 100644
--- a/charts/pulsar/templates/broker-service.yaml
+++ b/charts/pulsar/templates/broker-service.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: Service
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.broker.component }}
diff --git a/charts/pulsar/templates/broker-statefulset.yaml 
b/charts/pulsar/templates/broker-statefulset.yaml
index 78300e0..96096de 100644
--- a/charts/pulsar/templates/broker-statefulset.yaml
+++ b/charts/pulsar/templates/broker-statefulset.yaml
@@ -22,7 +22,7 @@ apiVersion: apps/v1
 kind: StatefulSet
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.broker.component }}
diff --git a/charts/pulsar/templates/dashboard-deployment.yaml 
b/charts/pulsar/templates/dashboard-deployment.yaml
index abb50e4..9a0a3a7 100644
--- a/charts/pulsar/templates/dashboard-deployment.yaml
+++ b/charts/pulsar/templates/dashboard-deployment.yaml
@@ -22,7 +22,7 @@ apiVersion: apps/v1
 kind: Deployment
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.dashboard.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.dashboard.component }}
diff --git a/charts/pulsar/templates/dashboard-ingress.yaml 
b/charts/pulsar/templates/dashboard-ingress.yaml
index 7e74d0e..2543ad7 100644
--- a/charts/pulsar/templates/dashboard-ingress.yaml
+++ b/charts/pulsar/templates/dashboard-ingress.yaml
@@ -30,7 +30,7 @@ metadata:
 {{ toYaml . | indent 4 }}
 {{- end }}
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.dashboard.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 spec:
 {{- if .Values.dashboard.ingress.tls.enabled }}
   tls:
diff --git a/charts/pulsar/templates/dashboard-service.yaml 
b/charts/pulsar/templates/dashboard-service.yaml
index 86dc707..b306ec7 100644
--- a/charts/pulsar/templates/dashboard-service.yaml
+++ b/charts/pulsar/templates/dashboard-service.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: Service
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.dashboard.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.dashboard.component }}
diff --git a/charts/pulsar/templates/function-worker-configmap.yaml 
b/charts/pulsar/templates/function-worker-configmap.yaml
index 98d9cfd..186edad 100644
--- a/charts/pulsar/templates/function-worker-configmap.yaml
+++ b/charts/pulsar/templates/function-worker-configmap.yaml
@@ -23,7 +23,7 @@ apiVersion: v1
 kind: ConfigMap
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.functions.component 
}}-config"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.functions.component }}
diff --git a/charts/pulsar/templates/grafana-admin-secret.yaml 
b/charts/pulsar/templates/grafana-admin-secret.yaml
index cca87b1..d38e823 100644
--- a/charts/pulsar/templates/grafana-admin-secret.yaml
+++ b/charts/pulsar/templates/grafana-admin-secret.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: Secret
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component 
}}-secret"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.grafana.component }}
diff --git a/charts/pulsar/templates/grafana-configmap.yaml 
b/charts/pulsar/templates/grafana-configmap.yaml
index 2e999c9..9d5fa71 100644
--- a/charts/pulsar/templates/grafana-configmap.yaml
+++ b/charts/pulsar/templates/grafana-configmap.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: ConfigMap
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.grafana.component }}
diff --git a/charts/pulsar/templates/grafana-deployment.yaml 
b/charts/pulsar/templates/grafana-deployment.yaml
index 3528f62..3f4ce94 100644
--- a/charts/pulsar/templates/grafana-deployment.yaml
+++ b/charts/pulsar/templates/grafana-deployment.yaml
@@ -22,7 +22,7 @@ apiVersion: apps/v1
 kind: Deployment
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.grafana.component }}
diff --git a/charts/pulsar/templates/grafana-ingress.yaml 
b/charts/pulsar/templates/grafana-ingress.yaml
index 91af70a..854d3a6 100644
--- a/charts/pulsar/templates/grafana-ingress.yaml
+++ b/charts/pulsar/templates/grafana-ingress.yaml
@@ -23,7 +23,7 @@ apiVersion: extensions/v1beta1
 kind: Ingress
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     app: {{ template "pulsar.name" . }}
     chart: {{ template "pulsar.chart" . }}
diff --git a/charts/pulsar/templates/grafana-service.yaml 
b/charts/pulsar/templates/grafana-service.yaml
index eabd0b0..4aa7f2d 100644
--- a/charts/pulsar/templates/grafana-service.yaml
+++ b/charts/pulsar/templates/grafana-service.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: Service
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.grafana.component }}
diff --git a/charts/pulsar/templates/keytool.yaml 
b/charts/pulsar/templates/keytool.yaml
index aed05b0..fb3af71 100644
--- a/charts/pulsar/templates/keytool.yaml
+++ b/charts/pulsar/templates/keytool.yaml
@@ -23,7 +23,7 @@ apiVersion: v1
 kind: ConfigMap
 metadata:
   name: "{{ template "pulsar.fullname" . }}-keytool-configmap"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: keytool 
diff --git a/charts/pulsar/templates/namespace.yaml 
b/charts/pulsar/templates/namespace.yaml
index c00b1e5..13f70bd 100644
--- a/charts/pulsar/templates/namespace.yaml
+++ b/charts/pulsar/templates/namespace.yaml
@@ -21,5 +21,5 @@
 apiVersion: v1
 kind: Namespace
 metadata:
-  name: {{ .Values.namespace }}
+  name: {{ template "pulsar.namespace" . }}
 {{- end }}
diff --git a/charts/pulsar/templates/prometheus-configmap.yaml 
b/charts/pulsar/templates/prometheus-configmap.yaml
index ab971ad..ffe9660 100644
--- a/charts/pulsar/templates/prometheus-configmap.yaml
+++ b/charts/pulsar/templates/prometheus-configmap.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: ConfigMap
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.prometheus.component }}
diff --git a/charts/pulsar/templates/prometheus-deployment.yaml 
b/charts/pulsar/templates/prometheus-deployment.yaml
index b51fd7a..dfb10d6 100644
--- a/charts/pulsar/templates/prometheus-deployment.yaml
+++ b/charts/pulsar/templates/prometheus-deployment.yaml
@@ -22,7 +22,7 @@ apiVersion: apps/v1
 kind: Deployment
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.prometheus.component }}
diff --git a/charts/pulsar/templates/prometheus-pvc.yaml 
b/charts/pulsar/templates/prometheus-pvc.yaml
index d647db3..ff9bb92 100644
--- a/charts/pulsar/templates/prometheus-pvc.yaml
+++ b/charts/pulsar/templates/prometheus-pvc.yaml
@@ -23,7 +23,7 @@ apiVersion: v1
 kind: PersistentVolumeClaim
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component 
}}-{{ .Values.prometheus.volumes.data.name }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 spec:
   resources:
     requests:
diff --git a/charts/pulsar/templates/prometheus-rbac.yaml 
b/charts/pulsar/templates/prometheus-rbac.yaml
index d027676..2da0fc7 100644
--- a/charts/pulsar/templates/prometheus-rbac.yaml
+++ b/charts/pulsar/templates/prometheus-rbac.yaml
@@ -40,7 +40,7 @@ apiVersion: v1
 kind: ServiceAccount
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 ---
 
 apiVersion: rbac.authorization.k8s.io/v1beta1
@@ -54,6 +54,6 @@ roleRef:
 subjects:
 - kind: ServiceAccount
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 {{- end }}
 {{- end }}
diff --git a/charts/pulsar/templates/prometheus-service.yaml 
b/charts/pulsar/templates/prometheus-service.yaml
index c4a660d..8cbc1f9 100644
--- a/charts/pulsar/templates/prometheus-service.yaml
+++ b/charts/pulsar/templates/prometheus-service.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: Service
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.prometheus.component }}
diff --git a/charts/pulsar/templates/prometheus-storageclass.yaml 
b/charts/pulsar/templates/prometheus-storageclass.yaml
index 7cda9e0..8e2a5a3 100644
--- a/charts/pulsar/templates/prometheus-storageclass.yaml
+++ b/charts/pulsar/templates/prometheus-storageclass.yaml
@@ -24,7 +24,7 @@ apiVersion: storage.k8s.io/v1
 kind: StorageClass
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component 
}}-{{ .Values.prometheus.volumes.data.name }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.prometheus.component }}
diff --git a/charts/pulsar/templates/proxy-configmap.yaml 
b/charts/pulsar/templates/proxy-configmap.yaml
index 64704d7..c3e4bf6 100644
--- a/charts/pulsar/templates/proxy-configmap.yaml
+++ b/charts/pulsar/templates/proxy-configmap.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: ConfigMap
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.proxy.component }}
diff --git a/charts/pulsar/templates/proxy-ingress.yaml 
b/charts/pulsar/templates/proxy-ingress.yaml
index c9339ba..3716d55 100644
--- a/charts/pulsar/templates/proxy-ingress.yaml
+++ b/charts/pulsar/templates/proxy-ingress.yaml
@@ -29,7 +29,7 @@ metadata:
 {{ toYaml . | indent 4 }}
 {{- end }}
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 spec:
 {{- if .Values.proxy.ingress.tls.enabled }}
   tls:
diff --git a/charts/pulsar/templates/proxy-pdb.yaml 
b/charts/pulsar/templates/proxy-pdb.yaml
index 50cfe7a..befdccc 100644
--- a/charts/pulsar/templates/proxy-pdb.yaml
+++ b/charts/pulsar/templates/proxy-pdb.yaml
@@ -23,7 +23,7 @@ apiVersion: policy/v1beta1
 kind: PodDisruptionBudget
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.proxy.component }}
diff --git a/charts/pulsar/templates/proxy-service.yaml 
b/charts/pulsar/templates/proxy-service.yaml
index 273d5aa..62683e7 100644
--- a/charts/pulsar/templates/proxy-service.yaml
+++ b/charts/pulsar/templates/proxy-service.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: Service
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.proxy.component }}
diff --git a/charts/pulsar/templates/proxy-statefulset.yaml 
b/charts/pulsar/templates/proxy-statefulset.yaml
index c14ae98..e05e243 100644
--- a/charts/pulsar/templates/proxy-statefulset.yaml
+++ b/charts/pulsar/templates/proxy-statefulset.yaml
@@ -22,7 +22,7 @@ apiVersion: apps/v1
 kind: StatefulSet
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.proxy.component }}
diff --git a/charts/pulsar/templates/pulsar-cluster-initialize.yaml 
b/charts/pulsar/templates/pulsar-cluster-initialize.yaml
index 0fd2cb6..9418868 100644
--- a/charts/pulsar/templates/pulsar-cluster-initialize.yaml
+++ b/charts/pulsar/templates/pulsar-cluster-initialize.yaml
@@ -23,7 +23,7 @@ apiVersion: batch/v1
 kind: Job
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ 
.Values.pulsar_metadata.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.pulsar_metadata.component }}
@@ -54,7 +54,7 @@ spec:
               echo "user provided zookeepers {{ $zk }} are unreachable... 
check in 3 seconds ..." && sleep 3;
             done;
             {{ else }}
-            until nslookup {{ template "pulsar.fullname" . }}-{{ 
.Values.zookeeper.component }}-{{ add (.Values.zookeeper.replicaCount | int) -1 
}}.{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}.{{ 
.Values.namespace }}; do
+            until nslookup {{ template "pulsar.fullname" . }}-{{ 
.Values.zookeeper.component }}-{{ add (.Values.zookeeper.replicaCount | int) -1 
}}.{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}.{{ 
template "pulsar.namespace" . }}; do
               sleep 3;
             done;
             {{- end}}
@@ -97,10 +97,10 @@ spec:
               {{- 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.{{ 
.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;
+              --web-service-url http://{{ template "pulsar.fullname" . }}-{{ 
.Values.broker.component }}.{{ template "pulsar.namespace" . }}.svc.{{ 
.Values.clusterDomain }}:{{ .Values.broker.ports.http }}/ \
+              --web-service-url-tls https://{{ template "pulsar.fullname" . 
}}-{{ .Values.broker.component }}.{{ template "pulsar.namespace" . }}.svc.{{ 
.Values.clusterDomain }}:{{ .Values.broker.ports.https }}/ \
+              --broker-service-url pulsar://{{ template "pulsar.fullname" . 
}}-{{ .Values.broker.component }}.{{ template "pulsar.namespace" . }}.svc.{{ 
.Values.clusterDomain }}:{{ .Values.broker.ports.pulsar }}/ \
+              --broker-service-url-tls pulsar+ssl://{{ template 
"pulsar.fullname" . }}-{{ .Values.broker.component }}.{{ template 
"pulsar.namespace" . }}.svc.{{ .Values.clusterDomain }}:{{ 
.Values.broker.ports.pulsarssl }}/ || true;
         volumeMounts:
         {{- include "pulsar.toolset.certs.volumeMounts" . | nindent 8 }}
       volumes:
diff --git a/charts/pulsar/templates/pulsar-manager-admin-secret.yaml 
b/charts/pulsar/templates/pulsar-manager-admin-secret.yaml
index ef4ecf9..ed94e16 100644
--- a/charts/pulsar/templates/pulsar-manager-admin-secret.yaml
+++ b/charts/pulsar/templates/pulsar-manager-admin-secret.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: Secret
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ 
.Values.pulsar_manager.component }}-secret"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     app: {{ template "pulsar.name" . }}
     chart: {{ template "pulsar.chart" . }}
diff --git a/charts/pulsar/templates/pulsar-manager-configmap.yaml 
b/charts/pulsar/templates/pulsar-manager-configmap.yaml
index acfb315..6154265 100644
--- a/charts/pulsar/templates/pulsar-manager-configmap.yaml
+++ b/charts/pulsar/templates/pulsar-manager-configmap.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: ConfigMap
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ 
.Values.pulsar_manager.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.pulsar_manager.component }}
diff --git a/charts/pulsar/templates/pulsar-manager-deployment.yaml 
b/charts/pulsar/templates/pulsar-manager-deployment.yaml
index 5f10268..57037df 100644
--- a/charts/pulsar/templates/pulsar-manager-deployment.yaml
+++ b/charts/pulsar/templates/pulsar-manager-deployment.yaml
@@ -22,7 +22,7 @@ apiVersion: apps/v1
 kind: Deployment
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ 
.Values.pulsar_manager.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.pulsar_manager.component }}
diff --git a/charts/pulsar/templates/pulsar-manager-ingress.yaml 
b/charts/pulsar/templates/pulsar-manager-ingress.yaml
index 5a72203..41d07a6 100644
--- a/charts/pulsar/templates/pulsar-manager-ingress.yaml
+++ b/charts/pulsar/templates/pulsar-manager-ingress.yaml
@@ -29,7 +29,7 @@ metadata:
 {{ toYaml . | indent 4 }}
 {{- end }}
   name: "{{ template "pulsar.fullname" . }}-{{ 
.Values.pulsar_manager.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 spec:
 {{- if .Values.pulsar_manager.ingress.tls.enabled }}
   tls:
diff --git a/charts/pulsar/templates/pulsar-manager-service.yaml 
b/charts/pulsar/templates/pulsar-manager-service.yaml
index 8aff88d..ae02f19 100644
--- a/charts/pulsar/templates/pulsar-manager-service.yaml
+++ b/charts/pulsar/templates/pulsar-manager-service.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: Service
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ 
.Values.pulsar_manager.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.pulsar_manager.component }}
diff --git a/charts/pulsar/templates/tls-cert-internal-issuer.yaml 
b/charts/pulsar/templates/tls-cert-internal-issuer.yaml
index 4f94374..2a944a5 100644
--- a/charts/pulsar/templates/tls-cert-internal-issuer.yaml
+++ b/charts/pulsar/templates/tls-cert-internal-issuer.yaml
@@ -23,7 +23,7 @@ apiVersion: cert-manager.io/v1alpha2
 kind: Issuer
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ 
.Values.certs.internal_issuer.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 spec:
   selfSigned: {}
 ---
@@ -32,10 +32,10 @@ apiVersion: cert-manager.io/v1alpha2
 kind: Certificate
 metadata:
   name: "{{ template "pulsar.fullname" . }}-ca"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 spec:
   secretName: "{{ .Release.Name }}-ca-tls"
-  commonName: "{{ .Values.namespace }}.svc.{{ .Values.clusterDomain }}"
+  commonName: "{{ template "pulsar.namespace" . }}.svc.{{ 
.Values.clusterDomain }}"
   usages:
     - server auth
     - client auth
@@ -54,7 +54,7 @@ apiVersion: cert-manager.io/v1alpha2
 kind: Issuer
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ 
.Values.certs.internal_issuer.component }}-ca-issuer"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 spec:
   ca:
     secretName: "{{ .Release.Name }}-ca-tls"
diff --git a/charts/pulsar/templates/tls-certs-internal.yaml 
b/charts/pulsar/templates/tls-certs-internal.yaml
index e7b7c2a..8e90da3 100644
--- a/charts/pulsar/templates/tls-certs-internal.yaml
+++ b/charts/pulsar/templates/tls-certs-internal.yaml
@@ -25,7 +25,7 @@ apiVersion: cert-manager.io/v1alpha2
 kind: Certificate
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.tls.proxy.cert_name }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 spec:
   # Secret names are always required.
   secretName: "{{ .Release.Name }}-{{ .Values.tls.proxy.cert_name }}"
@@ -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.{{ .Values.clusterDomain }}"
+  commonName: "*.{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component 
}}.{{ template "pulsar.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.{{ .Values.clusterDomain }}"
+    -  "*.{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}.{{ 
template "pulsar.namespace" . }}.svc.{{ .Values.clusterDomain }}"
     -  "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}"
   # Issuer references are always required.
   issuerRef:
@@ -64,7 +64,7 @@ apiVersion: cert-manager.io/v1alpha2
 kind: Certificate
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.tls.broker.cert_name }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 spec:
   # Secret names are always required.
   secretName: "{{ .Release.Name }}-{{ .Values.tls.broker.cert_name }}"
@@ -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.{{ 
.Values.clusterDomain }}"
+  commonName: "*.{{ template "pulsar.fullname" . }}-{{ 
.Values.broker.component }}.{{ template "pulsar.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.{{ .Values.clusterDomain }}"
+    -  "*.{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}.{{ 
template "pulsar.namespace" . }}.svc.{{ .Values.clusterDomain }}"
     -  "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}"
   # Issuer references are always required.
   issuerRef:
@@ -103,7 +103,7 @@ apiVersion: cert-manager.io/v1alpha2
 kind: Certificate
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.tls.bookie.cert_name }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 spec:
   # Secret names are always required.
   secretName: "{{ .Release.Name }}-{{ .Values.tls.bookie.cert_name }}"
@@ -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.{{ 
.Values.clusterDomain }}"
+  commonName: "*.{{ template "pulsar.fullname" . }}-{{ 
.Values.bookkeeper.component }}.{{ template "pulsar.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.{{ .Values.clusterDomain }}"
+    -  "*.{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component 
}}.{{ template "pulsar.namespace" . }}.svc.{{ .Values.clusterDomain }}"
     -  "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}"
   # Issuer references are always required.
   issuerRef:
@@ -141,7 +141,7 @@ apiVersion: cert-manager.io/v1alpha2
 kind: Certificate
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ 
.Values.tls.autorecovery.cert_name }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 spec:
   # Secret names are always required.
   secretName: "{{ .Release.Name }}-{{ .Values.tls.autorecovery.cert_name }}"
@@ -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.{{ 
.Values.clusterDomain }}"
+  commonName: "*.{{ template "pulsar.fullname" . }}-{{ 
.Values.autorecovery.component }}.{{ template "pulsar.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.{{ .Values.clusterDomain }}"
+    -  "*.{{ template "pulsar.fullname" . }}-{{ .Values.autorecovery.component 
}}.{{ template "pulsar.namespace" . }}.svc.{{ .Values.clusterDomain }}"
     -  "{{ template "pulsar.fullname" . }}-{{ .Values.autorecovery.component 
}}"
   # Issuer references are always required.
   issuerRef:
@@ -176,7 +176,7 @@ apiVersion: cert-manager.io/v1alpha2
 kind: Certificate
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.tls.toolset.cert_name 
}}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 spec:
   # Secret names are always required.
   secretName: "{{ .Release.Name }}-{{ .Values.tls.toolset.cert_name }}"
@@ -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.{{ 
.Values.clusterDomain }}"
+  commonName: "*.{{ template "pulsar.fullname" . }}-{{ 
.Values.toolset.component }}.{{ template "pulsar.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.{{ .Values.clusterDomain }}"
+    -  "*.{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component 
}}.{{ template "pulsar.namespace" . }}.svc.{{ .Values.clusterDomain }}"
     -  "{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component }}"
   # Issuer references are always required.
   issuerRef:
@@ -211,7 +211,7 @@ apiVersion: cert-manager.io/v1alpha2
 kind: Certificate
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.tls.zookeeper.cert_name 
}}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
 spec:
   # Secret names are always required.
   secretName: "{{ .Release.Name }}-{{ .Values.tls.zookeeper.cert_name }}"
@@ -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.{{ 
.Values.clusterDomain }}"
+  commonName: "*.{{ template "pulsar.fullname" . }}-{{ 
.Values.zookeeper.component }}.{{ template "pulsar.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.{{ .Values.clusterDomain }}"
+    -  "*.{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component 
}}.{{ template "pulsar.namespace" . }}.svc.{{ .Values.clusterDomain }}"
     -  "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}"
   # Issuer references are always required.
   issuerRef:
diff --git a/charts/pulsar/templates/toolset-configmap.yaml 
b/charts/pulsar/templates/toolset-configmap.yaml
index 4e8fc16..7a1cafe 100644
--- a/charts/pulsar/templates/toolset-configmap.yaml
+++ b/charts/pulsar/templates/toolset-configmap.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: ConfigMap
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.toolset.component }}
diff --git a/charts/pulsar/templates/toolset-service.yaml 
b/charts/pulsar/templates/toolset-service.yaml
index e1c0ccc..000711b 100644
--- a/charts/pulsar/templates/toolset-service.yaml
+++ b/charts/pulsar/templates/toolset-service.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
 kind: Service
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.toolset.component }}
diff --git a/charts/pulsar/templates/toolset-statefulset.yaml 
b/charts/pulsar/templates/toolset-statefulset.yaml
index 715680c..a250239 100644
--- a/charts/pulsar/templates/toolset-statefulset.yaml
+++ b/charts/pulsar/templates/toolset-statefulset.yaml
@@ -22,7 +22,7 @@ apiVersion: apps/v1
 kind: StatefulSet
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.toolset.component }}
diff --git a/charts/pulsar/templates/zookeeper-configmap.yaml 
b/charts/pulsar/templates/zookeeper-configmap.yaml
index 3b4cabf..3084dea 100644
--- a/charts/pulsar/templates/zookeeper-configmap.yaml
+++ b/charts/pulsar/templates/zookeeper-configmap.yaml
@@ -23,7 +23,7 @@ apiVersion: v1
 kind: ConfigMap
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.zookeeper.component }}
diff --git a/charts/pulsar/templates/zookeeper-pdb.yaml 
b/charts/pulsar/templates/zookeeper-pdb.yaml
index 5417bed..387a05a 100644
--- a/charts/pulsar/templates/zookeeper-pdb.yaml
+++ b/charts/pulsar/templates/zookeeper-pdb.yaml
@@ -24,7 +24,7 @@ apiVersion: policy/v1beta1
 kind: PodDisruptionBudget
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.zookeeper.component }}
diff --git a/charts/pulsar/templates/zookeeper-service.yaml 
b/charts/pulsar/templates/zookeeper-service.yaml
index 478a264..7ee9890 100644
--- a/charts/pulsar/templates/zookeeper-service.yaml
+++ b/charts/pulsar/templates/zookeeper-service.yaml
@@ -23,7 +23,7 @@ apiVersion: v1
 kind: Service
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.zookeeper.component }}
diff --git a/charts/pulsar/templates/zookeeper-statefulset.yaml 
b/charts/pulsar/templates/zookeeper-statefulset.yaml
index d3effe8..cb89469 100644
--- a/charts/pulsar/templates/zookeeper-statefulset.yaml
+++ b/charts/pulsar/templates/zookeeper-statefulset.yaml
@@ -23,7 +23,7 @@ apiVersion: apps/v1
 kind: StatefulSet
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.zookeeper.component }}
diff --git a/charts/pulsar/templates/zookeeper-storageclass.yaml 
b/charts/pulsar/templates/zookeeper-storageclass.yaml
index 08b66c8..ff2af9f 100644
--- a/charts/pulsar/templates/zookeeper-storageclass.yaml
+++ b/charts/pulsar/templates/zookeeper-storageclass.yaml
@@ -27,7 +27,7 @@ apiVersion: storage.k8s.io/v1
 kind: StorageClass
 metadata:
   name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component 
}}-{{ .Values.zookeeper.volumes.data.name }}"
-  namespace: {{ .Values.namespace }}
+  namespace: {{ template "pulsar.namespace" . }}
   labels:
     {{- include "pulsar.standardLabels" . | nindent 4 }}
     component: {{ .Values.zookeeper.component }}
diff --git a/charts/pulsar/values.yaml b/charts/pulsar/values.yaml
index 005e625..af74515 100644
--- a/charts/pulsar/values.yaml
+++ b/charts/pulsar/values.yaml
@@ -17,13 +17,14 @@
 # under the License.
 #
 
-
 ###
 ### K8S Settings
 ###
 
-## Namespace to deploy pulsar
-namespace: pulsar
+### Namespace to deploy pulsar
+# The namespace to use to deploy the pulsar components, if left empty
+# will default to .Release.Namespace (aka helm --namespace).
+namespace: ""
 namespaceCreate: false
 
 ## clusterDomain as defined for your k8s cluster
diff --git a/scripts/pulsar/generate_token.sh b/scripts/pulsar/generate_token.sh
index 86b3190..b70ef13 100755
--- a/scripts/pulsar/generate_token.sh
+++ b/scripts/pulsar/generate_token.sh
@@ -96,10 +96,12 @@ release=${release:-pulsar-dev}
 function pulsar::jwt::get_secret() {
     local type=$1
     local tmpfile=$2
-
+    local secret_name=$3
+    echo ${secret_name}
     if [[ "${local}" == "true" ]]; then
         cp ${type} ${tmpfile}
     else
+        echo "kubectl get -n ${namespace} secrets ${secret_name} -o 
jsonpath="{.data.${type}}" | base64 --decode > ${tmpfile}"
         kubectl get -n ${namespace} secrets ${secret_name} -o 
jsonpath="{.data['${type}']}" | base64 --decode > ${tmpfile}
     fi
 }
@@ -112,10 +114,11 @@ function pulsar::jwt::generate_symmetric_token() {
     trap "test -f $tmpfile && rm $tmpfile" RETURN
     tokentmpfile=$(mktemp)
     trap "test -f $tokentmpfile && rm $tokentmpfile" RETURN
-    pulsar::jwt::get_secret SECRETKEY ${tmpfile}
+    pulsar::jwt::get_secret SECRETKEY ${tmpfile} ${secret_name}
     ${PULSARCTL_BIN} token create -a HS256 --secret-key-file ${tmpfile} 
--subject ${role} 2&> ${tokentmpfile}
     newtokentmpfile=$(mktemp)
     tr -d '\n' < ${tokentmpfile} > ${newtokentmpfile}
+    echo "kubectl create secret generic ${token_name} -n ${namespace} 
--from-file="TOKEN=${newtokentmpfile}" --from-literal="TYPE=symmetric" 
${local:+ -o yaml --dry-run=client}"
     kubectl create secret generic ${token_name} -n ${namespace} 
--from-file="TOKEN=${newtokentmpfile}" --from-literal="TYPE=symmetric" 
${local:+ -o yaml --dry-run=client}
 }
 
@@ -127,7 +130,7 @@ function pulsar::jwt::generate_asymmetric_token() {
     trap "test -f $privatekeytmpfile && rm $privatekeytmpfile" RETURN
     tokentmpfile=$(mktemp)
     trap "test -f $tokentmpfile && rm $tokentmpfile" RETURN
-    pulsar::jwt::get_secret SECRETKEY ${tmpfile}
+    pulsar::jwt::get_secret PRIVATEKEY ${privatekeytmpfile} ${secret_name}
     ${PULSARCTL_BIN} token create -a RS256 --private-key-file 
${privatekeytmpfile} --subject ${role} 2&> ${tokentmpfile}
     newtokentmpfile=$(mktemp)
     tr -d '\n' < ${tokentmpfile} > ${newtokentmpfile}

Reply via email to