From b44b523c8a14255d6939c355130ae7f6e8fdb749 Mon Sep 17 00:00:00 2001 From: Thomas O'Neill Date: Thu, 13 Aug 2020 13:20:01 -0400 Subject: [PATCH] Allow initialization to be set (#53) Fixes #47 ### Motivation Only create the initialize job on install. ### Modifications - Added an initialize value that can be set to true on install, matching the documentation in the README.md --- .ci/helm.sh | 4 ++-- charts/pulsar/templates/bookkeeper-cluster-initialize.yaml | 3 ++- charts/pulsar/templates/pulsar-cluster-initialize.yaml | 2 ++ charts/pulsar/values.yaml | 3 +++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.ci/helm.sh b/.ci/helm.sh index 89f1fc8..2ebd685 100644 --- a/.ci/helm.sh +++ b/.ci/helm.sh @@ -81,9 +81,9 @@ function ci::install_pulsar_chart() { ${CHARTS_HOME}/scripts/pulsar/upload_tls.sh -k ${CLUSTER} -d ${PULSAR_HOME}/.ci/tls sleep 10 - echo ${HELM} install --values ${value_file} ${CLUSTER} ${CHARTS_HOME}/charts/pulsar + 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 --values ${value_file} ${CLUSTER} ${CHARTS_HOME}/charts/pulsar + ${HELM} install --set initialize=true --values ${value_file} ${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) diff --git a/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml b/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml index bb48022..e581023 100644 --- a/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml +++ b/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. # - +{{- if .Values.initialize }} {{- if .Values.components.bookkeeper }} apiVersion: batch/v1 kind: Job @@ -75,3 +75,4 @@ spec: {{- include "pulsar.toolset.certs.volumes" . | nindent 6 }} restartPolicy: Never {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/pulsar/templates/pulsar-cluster-initialize.yaml b/charts/pulsar/templates/pulsar-cluster-initialize.yaml index 95459a1..28ca512 100644 --- a/charts/pulsar/templates/pulsar-cluster-initialize.yaml +++ b/charts/pulsar/templates/pulsar-cluster-initialize.yaml @@ -17,6 +17,7 @@ # under the License. # +{{- if .Values.initialize }} {{- if .Values.components.broker }} apiVersion: batch/v1 kind: Job @@ -106,3 +107,4 @@ spec: {{- include "pulsar.toolset.certs.volumes" . | nindent 6 }} restartPolicy: Never {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/pulsar/values.yaml b/charts/pulsar/values.yaml index c71991c..df9d3cd 100644 --- a/charts/pulsar/values.yaml +++ b/charts/pulsar/values.yaml @@ -30,6 +30,9 @@ namespaceCreate: false ### Global Settings ### +## Set to true on install +initialize: false + ## Pulsar Metadata Prefix ## ## By default, pulsar stores all the metadata at root path.