Skip to content

Commit

Permalink
Adds option for post install delay (fixes #22) (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdmars authored Aug 21, 2020
1 parent 39dd7f7 commit 963fef4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion charts/stardog/files/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ function wait_for_start {
(
HOST=${1}
PORT=${2}
DELAY=${3}
# Wait for stardog to be running
RC=1
COUNT=0
set +e
while [[ ${RC} -ne 0 ]];
do
if [[ ${COUNT} -gt 600 ]]; then
if [[ ${COUNT} -gt ${DELAY} ]]; then
return 1;
fi
COUNT=$(expr 1 + ${COUNT} )
Expand Down
4 changes: 3 additions & 1 deletion charts/stardog/templates/post-install-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ spec:
value: "{{ .Values.ports.server }}"
- name: HOST
value: "{{ include "stardog.fullname" . }}.{{ .Release.Namespace }}"
- name: DELAY
value: "{{ .Values.waitForStartSeconds }}"
command:
- /bin/sh
- -c
- |
set -ex
{{ .Files.Get "files/utils.sh" | indent 10 }}
wait_for_start ${HOST} ${PORT}
wait_for_start ${HOST} ${PORT} ${DELAY}
change_pw ${HOST} ${PORT}
imagePullSecrets:
- name: {{ .Release.Name }}-image-pull-secret
Expand Down
6 changes: 6 additions & 0 deletions charts/stardog/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
# The number of Stardog replicas to deploy in the cluster
replicaCount: 3

# The number of seconds the post install job will wait for Stardog to
# start. This includes the total time to launch the cluster in k8s,
# including ZooKeeper. Consider increasing it for k8s providers that
# have slower resource provisioning.
waitForStartSeconds: 600

cluster:
# Start Stardog as a cluster
enabled: true
Expand Down

0 comments on commit 963fef4

Please sign in to comment.