Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit c9f19d3

Browse files
committed
Store credentials in secret rather then directly in the values
1 parent 52d5ff0 commit c9f19d3

File tree

3 files changed

+35
-7
lines changed

3 files changed

+35
-7
lines changed

persistence/persistence-elastic/templates/persistence-provider.yaml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,24 @@ spec:
1616
{{- end }}
1717
{{- if and .Values.authentication.user.username .Values.authentication.user.password }}
1818
- name: ELASTICSEARCH_USERNAME
19-
value: {{ .Values.authentication.user.username | quote }}
19+
valueFrom:
20+
secretKeyRef:
21+
name: {{ include "persistence-elastic.fullname" . }}
22+
key: username
2023
- name: ELASTICSEARCH_PASSWORD
21-
value: {{ .Values.authentication.user.password | quote }}
22-
{{- else if .Values.authentication.apikey.key }}
24+
valueFrom:
25+
secretKeyRef:
26+
name: {{ include "persistence-elastic.fullname" . }}
27+
key: password
28+
{{- else if and .Values.authentication.apiKey.id .Values.authentication.apiKey.key }}
2329
- name: ELASTICSEARCH_APIKEY_ID
24-
value: {{ .Values.authentication.apikey.id | quote }}
30+
valueFrom:
31+
secretKeyRef:
32+
name: {{ include "persistence-elastic.fullname" . }}
33+
key: apiKey
2534
- name: ELASTICSEARCH_APIKEY
26-
value: {{ .Values.authentication.apikey.key | quote }}
35+
valueFrom:
36+
secretKeyRef:
37+
name: {{ include "persistence-elastic.fullname" . }}
38+
key: apiKeyId
2739
{{- end }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{- if or .Values.authentication.user.username .Values.authentication.user.password .Values.authentication.apiKey.key .Values.authentication.apiKey.id }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ include "persistence-elastic.fullname" . }}
6+
type: Opaque
7+
data:
8+
{{- if and .Values.authentication.user.username .Values.authentication.user.password }}
9+
username: {{ .Values.authentication.user.username | b64enc | quote }}
10+
password: {{ .Values.authentication.user.password | b64enc | quote }}
11+
{{- end }}
12+
{{- if and .Values.authentication.apiKey.key .Values.authentication.apiKey.id }}
13+
apiKey: {{ .Values.authentication.apiKey.key | b64enc | quote }}
14+
apiKeyId: {{ .Values.authentication.apiKey.id | b64enc | quote }}
15+
{{- end }}
16+
{{- end }}

persistence/persistence-elastic/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ authentication:
1818
user:
1919
username: null
2020
password: null
21-
apikey:
22-
# Todo(@J12934) figure out when the "id" field is required for api keys.
21+
apiKey:
22+
id: null
2323
key: null
2424

2525
elasticsearch:

0 commit comments

Comments
 (0)