You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2024/04/04 04:28:51 UTC
(pulsar-helm-chart) branch master updated: Fix pulsar-manager persistence (#485)
This is an automated email from the ASF dual-hosted git repository.
lhotari 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 347326e Fix pulsar-manager persistence (#485)
347326e is described below
commit 347326e0c32d084f77ab8965e2ad4229fbe9b0f7
Author: Martin <43...@users.noreply.github.com>
AuthorDate: Thu Apr 4 06:28:46 2024 +0200
Fix pulsar-manager persistence (#485)
- only setup environment in pulsar manager if broker is deployed
- fix indent
- enable persistence for manager and move configs around
---
.ci/helm.sh | 3 +--
.../templates/pulsar-manager-cluster-initialize.yaml | 12 ++++++++++++
charts/pulsar/templates/pulsar-manager-configmap.yaml | 15 ++++++++++++++-
charts/pulsar/templates/pulsar-manager-statefulset.yaml | 17 ++---------------
charts/pulsar/values.yaml | 9 ++++-----
5 files changed, 33 insertions(+), 23 deletions(-)
diff --git a/.ci/helm.sh b/.ci/helm.sh
index 71b7d37..69fabfb 100644
--- a/.ci/helm.sh
+++ b/.ci/helm.sh
@@ -357,8 +357,7 @@ function ci::test_pulsar_manager() {
until ${KUBECTL} get jobs -n ${NAMESPACE} ${CLUSTER}-pulsar-manager-init -o json | jq -r '.status.conditions[] | select (.type | test("Complete")).status' | grep True; do sleep 3; done
${KUBECTL} describe job -n ${NAMESPACE} ${CLUSTER}-pulsar-manager-init
${KUBECTL} logs -n ${NAMESPACE} job.batch/${CLUSTER}-pulsar-manager-init
- # this line errors in some tests? - i do not know why, but is really useful for debugging, try: cat ./pulsar-manager.log otherwise
- # ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-manager-0 -- cat /pulsar-manager/pulsar-manager/pulsar-manager.log
+ ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-manager-0 -- cat /pulsar-manager/pulsar-manager.log
echo "Checking Podname"
podname=$(${KUBECTL} get pods -n ${NAMESPACE} -l component=pulsar-manager --no-headers -o custom-columns=":metadata.name")
echo "Getting pulsar manager UI password"
diff --git a/charts/pulsar/templates/pulsar-manager-cluster-initialize.yaml b/charts/pulsar/templates/pulsar-manager-cluster-initialize.yaml
index 0a23971..a5f76fc 100755
--- a/charts/pulsar/templates/pulsar-manager-cluster-initialize.yaml
+++ b/charts/pulsar/templates/pulsar-manager-cluster-initialize.yaml
@@ -56,6 +56,7 @@ spec:
done;
# This init container will wait for at least one broker to be ready before
# initializing the pulsar-manager
+ {{- if .Values.components.broker }}
- name: wait-broker-ready
image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.proxy "root" .) }}"
imagePullPolicy: {{ .Values.images.proxy.pullPolicy }}
@@ -70,6 +71,7 @@ spec:
sleep 10;
brokerServiceNumber="$(nslookup -timeout=10 {{ template "pulsar.fullname" . }}-{{ .Values.broker.component }} | grep Name | wc -l)";
done;
+ {{- end }}
containers:
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.pulsar_manager.component }}-init"
image: "{{ template "pulsar.imageFullName" (dict "image" .Values.pulsar_metadata.image "root" .) }}"
@@ -118,6 +120,7 @@ spec:
echo "$LOGIN_REPLY"
fi
+ {{- if .Values.components.broker }}
LOGIN_TOKEN=$(grep "token:" headers.txt | sed 's/^.*: //')
LOGIN_JSESSSIONID=$(grep -o "JSESSIONID=[a-zA-Z0-9_]*" headers.txt | sed 's/^.*=//')
@@ -147,6 +150,15 @@ spec:
echo "Error creating environment"
exit 1
fi
+ {{- else }}
+ if [ -n "$(echo "$LOGIN_REPLY" | grep 'success')" ]; then
+ echo "Successfully created / found existing account"
+ exit 0
+ else
+ echo "Error creating account"
+ exit 1
+ fi
+ {{- end }}
env:
- name: USERNAME
valueFrom:
diff --git a/charts/pulsar/templates/pulsar-manager-configmap.yaml b/charts/pulsar/templates/pulsar-manager-configmap.yaml
index 5595931..df70ecd 100644
--- a/charts/pulsar/templates/pulsar-manager-configmap.yaml
+++ b/charts/pulsar/templates/pulsar-manager-configmap.yaml
@@ -27,5 +27,18 @@ metadata:
{{- include "pulsar.standardLabels" . | nindent 4 }}
component: {{ .Values.pulsar_manager.component }}
data:
-{{ toYaml .Values.pulsar_manager.configData | indent 2 }}
+ PULSAR_CLUSTER: {{ template "pulsar.fullname" . }}
+ PULSAR_MANAGER_OPTS: "-Dlog4j2.formatMsgNoLookups=true"
+ {{- if .Values.auth.authentication.enabled }}
+ # auth
+ {{- if eq .Values.auth.authentication.provider "jwt" }}
+ {{- if .Values.auth.authentication.jwt.usingSecretKey }}
+ SECRET_KEY: "file:///pulsar-manager/keys/token/secret.key"
+ {{- else }}
+ PRIVATE_KEY: "file:///pulsar-manager/keys/token/private.key"
+ PUBLIC_KEY: "file:///pulsar-manager/keys/token/public.key"
+ {{- end }}
+ {{- end }}
+ {{- end }}
+{{ toYaml .Values.pulsar_manager.configData | indent 2}}
{{- end }}
diff --git a/charts/pulsar/templates/pulsar-manager-statefulset.yaml b/charts/pulsar/templates/pulsar-manager-statefulset.yaml
index dbb2b1f..3b29d6f 100755
--- a/charts/pulsar/templates/pulsar-manager-statefulset.yaml
+++ b/charts/pulsar/templates/pulsar-manager-statefulset.yaml
@@ -79,8 +79,6 @@ spec:
- configMapRef:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.pulsar_manager.component }}"
env:
- - name: PULSAR_CLUSTER
- value: {{ template "pulsar.fullname" . }}
- name: USERNAME
valueFrom:
secretKeyRef:
@@ -99,8 +97,6 @@ spec:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.pulsar_manager.component }}-secret"
{{- end }}
key: DB_PASSWORD
- - name: PULSAR_MANAGER_OPTS
- value: "$(PULSAR_MANAGER_OPTS) -Dlog4j2.formatMsgNoLookups=true"
{{- if .Values.auth.authentication.enabled }}
{{- if eq .Values.auth.authentication.provider "jwt" }}
{{- if .Values.auth.superUsers.manager }}
@@ -110,15 +106,6 @@ spec:
key: TOKEN
name: "{{ .Release.Name }}-token-{{ .Values.auth.superUsers.manager }}"
{{- end }}
- {{- if .Values.auth.authentication.jwt.usingSecretKey }}
- - name: SECRET_KEY
- value: file:///pulsar-manager/keys/token/secret.key
- {{- else }}
- - name: PRIVATE_KEY
- value: file:///pulsar-manager/keys/token/private.key
- - name: PUBLIC_KEY
- value: file:///pulsar-manager/keys/token/public.key
- {{- end }}
{{- end }}
{{- end }}
{{- include "pulsar.imagePullSecrets" . | nindent 6}}
@@ -146,8 +133,8 @@ spec:
{{- end }}
{{- end }}
{{- if not (and (and .Values.persistence .Values.volumes.persistence) .Values.pulsar_manager.volumes.persistence) }}
- - name: "{{ template "pulsar.fullname" . }}-{{ .Values.pulsar_manager.component }}-{{ .Values.pulsar_manager.volumes.data.name }}"
- emptyDir: {}
+ - name: "{{ template "pulsar.fullname" . }}-{{ .Values.pulsar_manager.component }}-{{ .Values.pulsar_manager.volumes.data.name }}"
+ emptyDir: {}
{{- end }}
{{- if and (and .Values.persistence .Values.volumes.persistence) .Values.pulsar_manager.volumes.persistence }}
volumeClaimTemplates:
diff --git a/charts/pulsar/values.yaml b/charts/pulsar/values.yaml
index 1f73983..43f5ba4 100755
--- a/charts/pulsar/values.yaml
+++ b/charts/pulsar/values.yaml
@@ -1279,11 +1279,10 @@ pulsar_manager:
configData:
REDIRECT_HOST: "http://127.0.0.1"
REDIRECT_PORT: "9527"
- DRIVER_CLASS_NAME: org.postgresql.Driver
- URL: jdbc:postgresql://127.0.0.1:5432/pulsar_manager
- LOG_LEVEL: DEBUG
- SPRING_CONFIGURATION_FILE: "/pulsar-manager/pulsar-manager/application.properties"
- PULSAR_MANAGER_OPTS: " -Dlog4j2.formatMsgNoLookups=true"
+ LOG_LEVEL: "INFO"
+ # DB
+ URL: "jdbc:postgresql://127.0.0.1:5432/pulsar_manager"
+ DRIVER_CLASS_NAME: "org.postgresql.Driver"
volumes:
# use a persistent volume or emptyDir
persistence: true