Skip to content

Commit 387d8cb

Browse files
committed
Update helm chart to generate secret for SERVER_PASSPHRASE
This allows runtime encrypt/decrypt operations to and from the database. Signed-off-by: Jeremy Ho <jujaga@gmail.com>
1 parent 3f1be20 commit 387d8cb

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

charts/coms/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: common-object-management-service
33
# This is the chart version. This version number should be incremented each time you make changes
44
# to the chart and its templates, including the app version.
55
# Versions are expected to follow Semantic Versioning (https://semver.org/)
6-
version: 0.0.5
6+
version: 0.0.6
77
kubeVersion: ">= 1.13.0"
88
description: A microservice for managing access control to S3 Objects
99
# A chart can be either an 'application' or a 'library' chart.

charts/coms/templates/deploymentconfig.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ spec:
151151
secretKeyRef:
152152
key: password
153153
name: {{ include "coms.configname" . }}-objectstorage
154+
- name: SERVER_PASSPHRASE
155+
valueFrom:
156+
secretKeyRef:
157+
key: password
158+
name: {{ include "coms.fullname" . }}-passphrase
154159
envFrom:
155160
- configMapRef:
156161
name: {{ include "coms.configname" . }}-config

charts/coms/templates/secret.yaml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,38 @@
1-
{{- $password := (randAlphaNum 32) | b64enc }}
2-
{{- $username := (randAlphaNum 32) | b64enc }}
1+
{{- $bPassword := (randAlphaNum 32) | b64enc }}
2+
{{- $bUsername := (randAlphaNum 32) | b64enc }}
3+
{{- $pPassword := (randAlphaNum 32) | b64enc }}
4+
{{- $pUsername := (randAlphaNum 32) | b64enc }}
35

4-
{{- $secretName := printf "%s-%s" (include "coms.fullname" .) "basicauth" }}
5-
{{- $secret := (lookup "v1" "Secret" .Release.Namespace $secretName ) }}
6-
{{- if not $secret }}
6+
{{- $bSecretName := printf "%s-%s" (include "coms.fullname" .) "basicauth" }}
7+
{{- $bSecret := (lookup "v1" "Secret" .Release.Namespace $bSecretName ) }}
8+
{{- $pSecretName := printf "%s-%s" (include "coms.fullname" .) "passphrase" }}
9+
{{- $pSecret := (lookup "v1" "Secret" .Release.Namespace $pSecretName ) }}
10+
11+
{{- if not $bSecret }}
12+
---
13+
apiVersion: v1
14+
kind: Secret
15+
metadata:
16+
annotations:
17+
"helm.sh/resource-policy": keep
18+
name: {{ $bSecretName }}
19+
labels: {{ include "coms.labels" . | nindent 4 }}
20+
type: kubernetes.io/basic-auth
21+
data:
22+
password: {{ $bPassword }}
23+
username: {{ $bUsername }}
24+
{{- end }}
25+
{{- if not $pSecret }}
726
---
827
apiVersion: v1
928
kind: Secret
1029
metadata:
1130
annotations:
1231
"helm.sh/resource-policy": keep
13-
name: {{ $secretName }}
32+
name: {{ $pSecretName }}
1433
labels: {{ include "coms.labels" . | nindent 4 }}
1534
type: kubernetes.io/basic-auth
1635
data:
17-
password: {{ $password }}
18-
username: {{ $username }}
36+
password: {{ $pPassword }}
37+
username: {{ $pUsername }}
1938
{{- end }}

0 commit comments

Comments
 (0)