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.
77 lines
2.0 KiB
Smarty
77 lines
2.0 KiB
Smarty
{{/*
|
|
Define the pulsar brroker service
|
|
*/}}
|
|
{{- define "pulsar.broker.service" -}}
|
|
{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Define the hostname
|
|
*/}}
|
|
{{- define "pulsar.broker.hostname" -}}
|
|
${HOSTNAME}.{{ template "pulsar.broker.service" . }}.{{ template "pulsar.namespace" . }}.svc.{{ .Values.clusterDomain }}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Define the broker znode
|
|
*/}}
|
|
{{- define "pulsar.broker.znode" -}}
|
|
{{ .Values.metadataPrefix }}/loadbalance/brokers/{{ template "pulsar.broker.hostname" . }}:{{ .Values.broker.ports.http }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Define broker zookeeper client tls settings
|
|
*/}}
|
|
{{- define "pulsar.broker.zookeeper.tls.settings" -}}
|
|
{{- if and .Values.tls.enabled .Values.tls.zookeeper.enabled }}
|
|
/pulsar/keytool/keytool.sh broker {{ template "pulsar.broker.hostname" . }} true;
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Define broker tls certs mounts
|
|
*/}}
|
|
{{- define "pulsar.broker.certs.volumeMounts" -}}
|
|
{{- if and .Values.tls.enabled (or .Values.tls.broker.enabled (or .Values.tls.bookie.enabled .Values.tls.zookeeper.enabled)) }}
|
|
- name: broker-certs
|
|
mountPath: "/pulsar/certs/broker"
|
|
readOnly: true
|
|
- name: ca
|
|
mountPath: "/pulsar/certs/ca"
|
|
readOnly: true
|
|
{{- if .Values.tls.zookeeper.enabled }}
|
|
- name: keytool
|
|
mountPath: "/pulsar/keytool/keytool.sh"
|
|
subPath: keytool.sh
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Define broker tls certs volumes
|
|
*/}}
|
|
{{- define "pulsar.broker.certs.volumes" -}}
|
|
{{- if and .Values.tls.enabled (or .Values.tls.broker.enabled (or .Values.tls.bookie.enabled .Values.tls.zookeeper.enabled)) }}
|
|
- name: broker-certs
|
|
secret:
|
|
secretName: "{{ .Release.Name }}-{{ .Values.tls.broker.cert_name }}"
|
|
items:
|
|
- key: tls.crt
|
|
path: tls.crt
|
|
- key: tls.key
|
|
path: tls.key
|
|
- name: ca
|
|
secret:
|
|
secretName: "{{ .Release.Name }}-ca-tls"
|
|
items:
|
|
- key: ca.crt
|
|
path: ca.crt
|
|
{{- if .Values.tls.zookeeper.enabled }}
|
|
- name: keytool
|
|
configMap:
|
|
name: "{{ template "pulsar.fullname" . }}-keytool-configmap"
|
|
defaultMode: 0755
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|