d06c3fbc2b
Move kubectl calls to phases. These phases call KRM toolbox with prepared shell scripts. Relates-To: #517 Change-Id: If5125ddac23b33c88d4d3d195ee1021d15b5598f
45 lines
1.5 KiB
Bash
45 lines
1.5 KiB
Bash
#!/bin/sh
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
set -xe
|
|
|
|
export TIMEOUT=${TIMEOUT:-3600}
|
|
|
|
end=$(($(date +%s) + $TIMEOUT))
|
|
echo "Waiting $TIMEOUT seconds for cluster to reach controlPlaneReady condition" 1>&2
|
|
while true; do
|
|
# TODO(vkuzmin): Add ability to wait for multiple clusters
|
|
if [ "$(kubectl \
|
|
--request-timeout 20s \
|
|
--context $KCTL_CONTEXT \
|
|
get -f $RENDERED_BUNDLE_PATH \
|
|
-o jsonpath='{.status.controlPlaneReady}')" == "true" ]
|
|
then
|
|
echo "Getting information about cluster" 1>&2
|
|
kubectl \
|
|
--request-timeout 20s \
|
|
--context $KCTL_CONTEXT \
|
|
get -f $RENDERED_BUNDLE_PATH 1>&2
|
|
echo "Cluster successfully reach controlPlaneReady condition" 1>&2
|
|
break
|
|
else
|
|
now=$(date +%s)
|
|
if [ $now -gt $end ]; then
|
|
echo "Cluster didn't reach controlPlaneReady condition before TIMEOUT=$TIMEOUT, exiting" 1>&2
|
|
exit 1
|
|
fi
|
|
sleep 15
|
|
fi
|
|
done
|