This is an automated email from the ASF dual-hosted git repository. daisyguo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-deploy-kube.git
The following commit(s) were added to refs/heads/master by this push: new f3afbdf bug fix in wait-for-couchdb; improve logs of wait-for-X initContainers (#294) f3afbdf is described below commit f3afbdfdbc435007402c2f40da48138fc109ef51 Author: David Grove <dgrove-...@users.noreply.github.com> AuthorDate: Wed Sep 5 21:51:11 2018 -0400 bug fix in wait-for-couchdb; improve logs of wait-for-X initContainers (#294) Check for the presence of a synthetic marker database that is only created after the ansible init_db and wipe_db jobs complete to avoid deciding that CouchDB is ready while the wipe_db job is still actually running. More descriptive messages from wait-for-X jobs while running and always print a Success message when the job completes. --- helm/openwhisk/configMapFiles/initCouchDB/initdb.sh | 3 +++ helm/openwhisk/templates/_readiness.tpl | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/helm/openwhisk/configMapFiles/initCouchDB/initdb.sh b/helm/openwhisk/configMapFiles/initCouchDB/initdb.sh index 181239f..76157f8 100755 --- a/helm/openwhisk/configMapFiles/initCouchDB/initdb.sh +++ b/helm/openwhisk/configMapFiles/initCouchDB/initdb.sh @@ -60,4 +60,7 @@ pushd /openwhisk/ansible -e openwhisk_home=/openwhisk popd +echo "Creating ow_kube_couchdb_initialized_marker database" +curl --silent -X PUT $DB_PROTOCOL://$COUCHDB_USER:$COUCHDB_PASSWORD@$DB_HOST:$DB_PORT/ow_kube_couchdb_initialized_marker + echo "successfully initialized CouchDB for OpenWhisk" diff --git a/helm/openwhisk/templates/_readiness.tpl b/helm/openwhisk/templates/_readiness.tpl index 6e2029b..f95752b 100644 --- a/helm/openwhisk/templates/_readiness.tpl +++ b/helm/openwhisk/templates/_readiness.tpl @@ -11,8 +11,8 @@ imagePullPolicy: "IfNotPresent" env: - name: "READINESS_URL" - value: {{ .Values.db.protocol }}://{{ include "db_host" . }}:{{ .Values.db.port }}/{{ .Values.db.activationsTable }} - command: ["sh", "-c", "result=1; until [ $result -eq 0 ]; do echo verifying CouchDB readiness; wget -T 5 --spider $READINESS_URL --header=\"Authorization: Basic {{ include "db_authentication" . | b64enc }}\"; result=$?; sleep 1; done;"] + value: {{ .Values.db.protocol }}://{{ include "db_host" . }}:{{ .Values.db.port }}/ow_kube_couchdb_initialized_marker + command: ["sh", "-c", "while true; do echo 'checking CouchDB readiness'; wget -T 5 --spider $READINESS_URL --header=\"Authorization: Basic {{ include "db_authentication" . | b64enc }}\"; result=$?; if [ $result -eq 0 ]; then echo 'Success: CouchDB is ready!'; break; fi; echo '...not ready yet; sleeping 3 seconds before retry'; sleep 3; done;"] {{- end -}} {{- end -}} @@ -22,7 +22,7 @@ image: "busybox" imagePullPolicy: "IfNotPresent" # TODO: I haven't found an easy external test to determine that kafka is up, so as a hack we wait for zookeeper and then sleep for 10 seconds and cross our fingers! - command: ["sh", "-c", 'result=1; until [ $result -eq 0 ]; do OK=$(echo ruok | nc -w 1 {{ include "zookeeper_zero_host" . }} {{ .Values.zookeeper.port }}); if [ "$OK" == "imok" ]; then result=0; echo "zookeeper returned imok!"; fi; echo waiting for zookeeper to be ready; sleep 1; done; echo zookeeper is up, sleeping for 10 seconds; sleep 10;'] + command: ["sh", "-c", 'result=1; until [ $result -eq 0 ]; do OK=$(echo ruok | nc -w 1 {{ include "zookeeper_zero_host" . }} {{ .Values.zookeeper.port }}); if [ "$OK" == "imok" ]; then result=0; echo "zookeeper returned imok!"; else echo waiting for zookeeper to be ready; sleep 1; fi done; echo "Zookeeper is up; will wait for 10 seconds to give kafka time to initialize"; sleep 10;'] {{- end -}} {{/* Init container that waits for zookeeper to be ready */}} @@ -30,7 +30,7 @@ - name: "wait-for-zookeeper" image: "busybox" imagePullPolicy: "IfNotPresent" - command: ["sh", "-c", 'result=1; until [ $result -eq 0 ]; do OK=$(echo ruok | nc -w 1 {{ include "zookeeper_zero_host" . }} {{ .Values.zookeeper.port }}); if [ "$OK" == "imok" ]; then result=0; echo "zookeeper returned imok!"; fi; echo waiting for zookeeper to be ready; sleep 1; done;'] + command: ["sh", "-c", 'result=1; until [ $result -eq 0 ]; do OK=$(echo ruok | nc -w 1 {{ include "zookeeper_zero_host" . }} {{ .Values.zookeeper.port }}); if [ "$OK" == "imok" ]; then result=0; echo "zookeeper returned imok!"; else echo waiting for zookeeper to be ready; sleep 1; fi; done; echo "Success: zookeeper is up"'] {{- end -}} {{/* Init container that waits for controller to be ready */}} @@ -41,5 +41,5 @@ env: - name: "READINESS_URL" value: http://{{ include "controller_host" . }}:{{ .Values.controller.port }}/ping - command: ["sh", "-c", "result=1; until [ $result -eq 0 ]; do echo verifying controller readiness; wget -T 5 --spider $READINESS_URL; result=$?; sleep 1; done;"] + command: ["sh", "-c", "result=1; until [ $result -eq 0 ]; do echo 'Checking controller readiness'; wget -T 5 --spider $READINESS_URL; result=$?; sleep 1; done; echo 'Success: controller is ready'"] {{- end -}}