[incubator/zookeeper] Add secrets to zookeeper (#7232)

* Provide the ability to mount secrets to the zookeeper nodes. This is useful when using kafka with a custom authorizer.

Signed-off-by: rustycl0ck <the.absolute.dude@gmail.com>
This commit is contained in:
Ravi Kumar
2018-10-01 12:49:52 -07:00
committed by k8s-ci-robot
parent 50057e688d
commit f4cf35b5f3
3 changed files with 43 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
name: zookeeper
home: https://zookeeper.apache.org/
version: 1.1.2
version: 1.2.0
appVersion: 3.4.10
description: Centralized service for maintaining configuration information, naming,
providing distributed synchronization, and providing group services.
+25 -2
View File
@@ -72,11 +72,31 @@ spec:
- name: {{ $key | upper | replace "." "_" }}
value: {{ $value | quote }}
{{- end }}
{{- range $secret := .Values.secrets }}
{{- range $key := $secret.keys }}
- name: {{ (print $secret.name "_" $key) | upper }}
valueFrom:
secretKeyRef:
name: {{ $secret.name }}
key: {{ $key }}
{{- end }}
{{- end }}
resources:
{{ toYaml .Values.resources | indent 12 }}
volumeMounts:
- name: data
mountPath: /var/lib/zookeeper
{{- range $secret := .Values.secrets }}
{{- if $secret.mountPath }}
{{- range $key := $secret.keys }}
- name: {{ $.Release.Name }}-{{ $secret.name }}
mountPath: {{ $secret.mountPath }}/{{ $key }}
subPath: {{ $key }}
readOnly: true
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.exporters.jmx.enabled }}
- name: jmx-exporter
@@ -148,8 +168,12 @@ spec:
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{- if (or .Values.exporters.jmx.enabled (not .Values.persistence.enabled)) }}
volumes:
{{- range .Values.secrets }}
- name: {{ $.Release.Name }}-{{ .name }}
secret:
secretName: {{ .name }}
{{- end }}
{{- if .Values.exporters.jmx.enabled }}
- name: config-jmx-exporter
configMap:
@@ -159,7 +183,6 @@ spec:
- name: data
emptyDir: {}
{{- end }}
{{- end }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
+17
View File
@@ -113,6 +113,23 @@ securityContext:
fsGroup: 1000
runAsUser: 1000
## Useful if using any custom authorizer.
## Pass any secrets to the kafka pods. Each secret will be passed as an
## environment variable by default. The secret can also be mounted to a
## specific path (in addition to environment variable) if required. Environment
## variable names are generated as: `<secretName>_<secretKey>` (All upper case)
# secrets:
# - name: myKafkaSecret
# keys:
# - username
# - password
# # mountPath: /opt/kafka/secret
# - name: myZkSecret
# keys:
# - user
# - pass
# mountPath: /opt/zookeeper/secret
persistence:
enabled: true
## zookeeper data Persistent Volume Storage Class