Block build requests until environment builder is ready (#437)

* Add readiness probe
* Remove builder manager http api interface since we don’t use/need it
* Check environment builder status and block build requests until builder is ready
* Replace deprecated api extension interface
* Add healthy check to python env
This commit is contained in:
Ta-Ching Chen
2018-01-26 01:13:36 +08:00
committed by GitHub
parent b7c97cec8c
commit 0a733b20c3
18 changed files with 260 additions and 416 deletions
+19 -4
View File
@@ -8,8 +8,8 @@ set -euo pipefail
# able to work.
ROOT=$(dirname $0)/../..
PYTHON_RUNTIME_IMAGE=gcr.io/fission-ci/python3-env:test
PYTHON_BUILDER_IMAGE=gcr.io/fission-ci/python3-env-builder:test
PYTHON_RUNTIME_IMAGE=gcr.io/fission-ci/python-env:test
PYTHON_BUILDER_IMAGE=gcr.io/fission-ci/python-env-builder:test
fn=python-srcbuild-$(date +%s)
@@ -34,6 +34,22 @@ checkFunctionResponse() {
echo $response | grep -i "$2"
}
waitEnvBuilder() {
env=$1
envRV=$(kubectl -n default get environments ${env} -o jsonpath='{.metadata.resourceVersion}')
echo "Waiting for env builder to catch up"
while true; do
kubectl -n fission-builder get pod -l envName=${env},envResourceVersion=${envRV} \
-o jsonpath='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}' | grep "Ready=True" | grep -i "$1"
if [[ $? -eq 0 ]]; then
break
fi
done
}
export -f waitEnvBuilder
echo "Pre-test cleanup"
fission env delete --name python || true
@@ -41,8 +57,7 @@ echo "Creating python env"
fission env create --name python --image $PYTHON_RUNTIME_IMAGE --builder $PYTHON_BUILDER_IMAGE
trap "fission env delete --name python" EXIT
echo "Waiting for env builder to catch up"
sleep 30
timeout 180s bash -c "waitEnvBuilder python"
echo "Creating pacakage with source archive"
zip -jr demo-src-pkg.zip $ROOT/examples/python/sourcepkg/