Skip to content

Commit 0858beb

Browse files
committed
Use an initContainer to grab token
Signed-off-by: Stephen Heywood <stephen@ii.coop>
1 parent f322b33 commit 0858beb

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

charts/snoopdb/templates/statefulset.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ spec:
3434
serviceAccountName: {{ include "chart.serviceAccountName" . }}
3535
securityContext:
3636
{{- toYaml .Values.podSecurityContext | nindent 8 }}
37+
initContainers:
38+
- name: cptoken
39+
image: busybox
40+
command: ['sh', '-c', 'cp /var/run/secrets/kubernetes.io/serviceaccount/token /opt/token.txt ; chmod 644 /opt/token.txt']
41+
volumeMounts:
42+
- name: data
43+
mountPath: /opt
3744
containers:
3845
- name: {{ .Chart.Name }}
3946
securityContext:
@@ -104,6 +111,8 @@ spec:
104111
mountPath: /var/lib/postgresql
105112
- name: var-run-postgresql
106113
mountPath: /var/run/postgresql
114+
- name: data
115+
mountPath: /opt
107116
{{- with .Values.nodeSelector }}
108117
nodeSelector:
109118
{{- toYaml . | nindent 8 }}
@@ -123,4 +132,5 @@ spec:
123132
emptyDir: {}
124133
- name: var-run-postgresql
125134
emptyDir: {}
126-
135+
- name: data
136+
emptyDir: {}

0 commit comments

Comments
 (0)