Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
[incubator/zookeeper] Add secrets to zookeeper (#7232)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
rustycl0ck authored and k8s-ci-robot committed Oct 1, 2018
1 parent 50057e6 commit f4cf35b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
2 changes: 1 addition & 1 deletion incubator/zookeeper/Chart.yaml
@@ -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.
Expand Down
27 changes: 25 additions & 2 deletions incubator/zookeeper/templates/statefulset.yaml
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -159,7 +183,6 @@ spec:
- name: data
emptyDir: {}
{{- end }}
{{- end }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
Expand Down
17 changes: 17 additions & 0 deletions incubator/zookeeper/values.yaml
Expand Up @@ -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
Expand Down

0 comments on commit f4cf35b

Please sign in to comment.