From d3ec6207e78919210dc9d984664d3b69fa52febd Mon Sep 17 00:00:00 2001 From: SakaSun Date: Thu, 13 Feb 2020 18:39:32 -0300 Subject: [PATCH] [Helm] Pulsar Manager do not work if Pulsar authentication is enabled (#6315) Fixes ##6314 ### Motivation Pulsar Manager do not work if Pulsar authentication is enabled. ### Modifications pulsar-manager-configmap.yaml was created in order to allow configuration of the enviroment properties in values.yaml --- .../pulsar/templates/grafana-service.yaml | 8 ++--- .../templates/pulsar-manager-configmap.yaml | 33 +++++++++++++++++++ .../templates/pulsar-manager-deployment.yaml | 14 ++------ .../kubernetes/helm/pulsar/values-mini.yaml | 9 +++++ deployment/kubernetes/helm/pulsar/values.yaml | 9 +++++ 5 files changed, 58 insertions(+), 15 deletions(-) create mode 100644 deployment/kubernetes/helm/pulsar/templates/pulsar-manager-configmap.yaml diff --git a/deployment/kubernetes/helm/pulsar/templates/grafana-service.yaml b/deployment/kubernetes/helm/pulsar/templates/grafana-service.yaml index 3288f26daf0a9..56daddec7dc3b 100644 --- a/deployment/kubernetes/helm/pulsar/templates/grafana-service.yaml +++ b/deployment/kubernetes/helm/pulsar/templates/grafana-service.yaml @@ -17,7 +17,7 @@ # under the License. # - {{- if .Values.extra.monitoring }} +{{- if .Values.extra.monitoring }} apiVersion: v1 kind: Service metadata: @@ -31,14 +31,14 @@ metadata: component: {{ .Values.grafana.component }} cluster: {{ template "pulsar.fullname" . }} annotations: - {{ toYaml .Values.grafana.service.annotations | indent 4 }} +{{ toYaml .Values.grafana.service.annotations | indent 4 }} spec: ports: - {{ toYaml .Values.grafana.service.ports | indent 2 }} +{{ toYaml .Values.grafana.service.ports | indent 2 }} selector: app: {{ template "pulsar.name" . }} release: {{ .Release.Name }} component: {{ .Values.grafana.component }} type: ClusterIP sessionAffinity: None - {{- end }} +{{- end }} diff --git a/deployment/kubernetes/helm/pulsar/templates/pulsar-manager-configmap.yaml b/deployment/kubernetes/helm/pulsar/templates/pulsar-manager-configmap.yaml new file mode 100644 index 0000000000000..5444469cba53d --- /dev/null +++ b/deployment/kubernetes/helm/pulsar/templates/pulsar-manager-configmap.yaml @@ -0,0 +1,33 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +apiVersion: v1 +kind: ConfigMap +metadata: + name: "{{ template "pulsar.fullname" . }}-{{ .Values.pulsar_manager.component }}" + namespace: {{ .Values.namespace }} + labels: + app: {{ template "pulsar.name" . }} + chart: {{ template "pulsar.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + component: {{ .Values.pulsar_manager.component }} + cluster: {{ template "pulsar.fullname" . }} +data: +{{ toYaml .Values.pulsar_manager.configData | indent 2 }} diff --git a/deployment/kubernetes/helm/pulsar/templates/pulsar-manager-deployment.yaml b/deployment/kubernetes/helm/pulsar/templates/pulsar-manager-deployment.yaml index bb153e78e6699..8a8493aa53c92 100644 --- a/deployment/kubernetes/helm/pulsar/templates/pulsar-manager-deployment.yaml +++ b/deployment/kubernetes/helm/pulsar/templates/pulsar-manager-deployment.yaml @@ -69,18 +69,12 @@ spec: volumeMounts: - name: pulsar-manager-data mountPath: /data + envFrom: + - configMapRef: + name: "{{ template "pulsar.fullname" . }}-{{ .Values.pulsar_manager.component }}" env: - # for supporting apachepulsar/pulsar-manager - name: PULSAR_CLUSTER value: {{ template "pulsar.fullname" . }} - - name: REDIRECT_HOST - value: http://127.0.0.1 - - name: REDIRECT_PORT - value: "9527" - - name: DRIVER_CLASS_NAME - value: org.postgresql.Driver - - name: URL - value: jdbc:postgresql://127.0.0.1:5432/pulsar_manager - name: USERNAME valueFrom: secretKeyRef: @@ -91,8 +85,6 @@ spec: secretKeyRef: key: PULSAR_MANAGER_ADMIN_PASSWORD name: "{{ template "pulsar.fullname" . }}-{{ .Values.pulsar_manager.component }}-secret" - - name: LOG_LEVEL - value: DEBUG volumes: - name: pulsar-manager-data emptyDir: {} diff --git a/deployment/kubernetes/helm/pulsar/values-mini.yaml b/deployment/kubernetes/helm/pulsar/values-mini.yaml index a932d3211e877..dadff58ddfbdc 100644 --- a/deployment/kubernetes/helm/pulsar/values-mini.yaml +++ b/deployment/kubernetes/helm/pulsar/values-mini.yaml @@ -497,6 +497,15 @@ pulsar_manager: requests: memory: 250Mi cpu: 0.1 + 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 + ## If you enabled authentication support + #JWT_TOKEN: + #SECRET_KEY: data:base64, ## Pulsar manager service ## templates/pulsar-manager-service.yaml ## diff --git a/deployment/kubernetes/helm/pulsar/values.yaml b/deployment/kubernetes/helm/pulsar/values.yaml index 3ccd0ae9ba5f1..84a2bba86a623 100644 --- a/deployment/kubernetes/helm/pulsar/values.yaml +++ b/deployment/kubernetes/helm/pulsar/values.yaml @@ -493,6 +493,15 @@ pulsar_manager: requests: memory: 250Mi cpu: 0.1 + 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 + ## If you enabled authentication support + #JWT_TOKEN: + #SECRET_KEY: data:base64, ## Pulsar manager service ## templates/pulsar-manager-service.yaml ##