From aff1d72d2aa3b3ca9baca364b55dd0974701e002 Mon Sep 17 00:00:00 2001 From: Eric Shen Date: Fri, 10 Nov 2023 15:09:55 +0800 Subject: [PATCH] feat: add extraArgs for detector to support tls-auth (#1124) * feat: add extraArgs for detector Signed-off-by: ericsyh * apply to sn-platform chart Signed-off-by: ericsyh * update examples Signed-off-by: ericsyh --------- Signed-off-by: ericsyh (cherry picked from commit 58076fb35ff1fb139db17cc44c475fb2b4c74a0a) --- .../detector/pulsar-detector-deployment.yaml | 13 ++++++++++++- charts/sn-platform-slim/values.yaml | 5 +++++ .../detector/pulsar-detector-deployment.yaml | 13 ++++++++++++- charts/sn-platform/values.yaml | 5 +++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/charts/sn-platform-slim/templates/detector/pulsar-detector-deployment.yaml b/charts/sn-platform-slim/templates/detector/pulsar-detector-deployment.yaml index f9c7ac243..f3beb074f 100644 --- a/charts/sn-platform-slim/templates/detector/pulsar-detector-deployment.yaml +++ b/charts/sn-platform-slim/templates/detector/pulsar-detector-deployment.yaml @@ -109,9 +109,20 @@ spec: image: "{{ .Values.images.pulsar_detector.repository }}:{{ .Values.images.pulsar_detector.tag }}" imagePullPolicy: {{ .Values.images.pulsar_detector.pullPolicy }} command: ["sh", "-c"] + {{- if .Values.pulsar_detector.extraArgs }} args: - > - bin/pulsar-detector -service-url {{ template "pulsar.detector.serviceUrl" . }} -webservice-url {{ template "pulsar.detector.webServiceUrl" . }} {{- if .Values.auth.authentication.enabled }} -auth-plugin token -auth-params "{\"token\":\"$brokerClientAuthenticationParameters\"}" {{- end }} {{- if .Values.pulsar_detector.extraArgs }} {{.Values.pulsar_detector.extraArgs }} {{- end }}; + bin/pulsar-detector \ + {{- range $key, $value := .Values.pulsar_detector.extraArgs }} + -{{ $key }} {{ $value }} \ + {{- end }} + -service-url {{ template "pulsar.detector.serviceUrl" . }} \ + -webservice-url {{ template "pulsar.detector.webServiceUrl" . }}}; + {{- else }} + args: + - > + bin/pulsar-detector -service-url {{ template "pulsar.detector.serviceUrl" . }} -webservice-url {{ template "pulsar.detector.webServiceUrl" . }} {{- if .Values.auth.authentication.enabled }} -auth-plugin token -auth-params "{\"token\":\"$brokerClientAuthenticationParameters\"}" {{- end }}; + {{- end }} {{- if .Values.pulsar_detector.resources }} resources: {{- toYaml .Values.pulsar_detector.resources | nindent 10 }} {{- end }} diff --git a/charts/sn-platform-slim/values.yaml b/charts/sn-platform-slim/values.yaml index 94701cf69..0241b6898 100644 --- a/charts/sn-platform-slim/values.yaml +++ b/charts/sn-platform-slim/values.yaml @@ -1403,6 +1403,11 @@ pulsar_detector: extraVolumes: [] extraVolumeMounts: [] extraEnv: [] + ## Additional pulsar_detector container arguments + extraArgs: {} + # Configure the tls auth for detector + # auth-plugin: "tls" + # auth-params: "{\"tlsCertFile\":\"/pulsar/certs/pulsar-detector/tls.crt\",\"tlsKeyFile\":\"/pulsar/certs/pulsar-detector/tls.key\"}" ## Proxy service ## templates/pulsar-detector-service.yaml ## diff --git a/charts/sn-platform/templates/detector/pulsar-detector-deployment.yaml b/charts/sn-platform/templates/detector/pulsar-detector-deployment.yaml index 4913186f2..1d9381a0c 100644 --- a/charts/sn-platform/templates/detector/pulsar-detector-deployment.yaml +++ b/charts/sn-platform/templates/detector/pulsar-detector-deployment.yaml @@ -109,9 +109,20 @@ spec: image: "{{ .Values.images.pulsar_detector.repository }}:{{ .Values.images.pulsar_detector.tag }}" imagePullPolicy: {{ .Values.images.pulsar_detector.pullPolicy }} command: ["sh", "-c"] + {{- if .Values.pulsar_detector.extraArgs }} args: - > - bin/pulsar-detector -service-url {{ template "pulsar.detector.serviceUrl" . }} -webservice-url {{ template "pulsar.detector.webServiceUrl" . }} {{- if .Values.auth.authentication.enabled }} -auth-plugin token -auth-params "{\"token\":\"$brokerClientAuthenticationParameters\"}" {{- end }} {{- if .Values.pulsar_detector.extraArgs }} {{.Values.pulsar_detector.extraArgs }} {{- end }}; + bin/pulsar-detector \ + {{- range $key, $value := .Values.pulsar_detector.extraArgs }} + -{{ $key }} {{ $value }} \ + {{- end }} + -service-url {{ template "pulsar.detector.serviceUrl" . }} \ + -webservice-url {{ template "pulsar.detector.webServiceUrl" . }}}; + {{- else }} + args: + - > + bin/pulsar-detector -service-url {{ template "pulsar.detector.serviceUrl" . }} -webservice-url {{ template "pulsar.detector.webServiceUrl" . }} {{- if .Values.auth.authentication.enabled }} -auth-plugin token -auth-params "{\"token\":\"$brokerClientAuthenticationParameters\"}" {{- end }}; + {{- end }} {{- if .Values.pulsar_detector.resources }} resources: {{- toYaml .Values.pulsar_detector.resources | nindent 10 }} {{- end }} diff --git a/charts/sn-platform/values.yaml b/charts/sn-platform/values.yaml index eacc0a796..f71b6d8e1 100644 --- a/charts/sn-platform/values.yaml +++ b/charts/sn-platform/values.yaml @@ -1478,6 +1478,11 @@ pulsar_detector: extraVolumes: [] extraVolumeMounts: [] extraEnv: [] + ## Additional pulsar_detector container arguments + extraArgs: {} + # Configure the tls auth for detector + # auth-plugin: "tls" + # auth-params: "{\"tlsCertFile\":\"/pulsar/certs/pulsar-detector/tls.crt\",\"tlsKeyFile\":\"/pulsar/certs/pulsar-detector/tls.key\"}" ## Proxy service ## templates/pulsar-detector-service.yaml ##