Skip to content

Commit

Permalink
Add wait for vault init container (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
unxnn authored Dec 15, 2021
1 parent 8759800 commit ef6c95d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions charts/operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,25 @@ Create the name of the service account to use
{{- end }}
{{- end }}

{{/*
Wait until vault is ready
*/}}
{{- define "vault-readiness" -}}
- name: vault-readiness
image: "{{ $.Values.initImageBusybox.repository }}:{{ $.Values.initImageBusybox.tag }}"
imagePullPolicy: {{ $.Values.initImageBusybox.pullPolicy }}
securityContext:
runAsUser: 0
command:
- /bin/sh
- -c
{{- if $.Values.vaultAddr }}
- "until nc -vz -w 2 {{ $.Values.vaultAddr | replace ":8200" "" | replace "http://" "" | replace "https://" "" }} 8200; do echo 'Waiting vault'; sleep 2; done"
{{- else }}
- "until nc -vz -w 2 {{ template "operator.fullname" $ }}-vault 8200; do echo 'Waiting vault'; sleep 2; done"
{{- end }}
{{- end }}

{{/*
Update permissions on files inside /data directory
*/}}
Expand Down
1 change: 1 addition & 0 deletions charts/operator/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ spec:
serviceAccountName: "validator{{.}}"
priorityClassName: {{ $root.Values.priorityClassName | quote }}
initContainers:
{{- include "vault-readiness" $root | nindent 8 }}
- name: init-validator
image: "{{ $root.Values.initImage.repository }}:{{ $root.Values.initImage.tag }}"
imagePullPolicy: {{ $root.Values.initImage.pullPolicy }}
Expand Down

0 comments on commit ef6c95d

Please sign in to comment.