File tree Expand file tree Collapse file tree 3 files changed +53
-0
lines changed Expand file tree Collapse file tree 3 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 33# shellcheck disable=SC1091 # using path on bootstrap machine
44. /usr/local/bin/bootstrap-service-record.sh
55
6+ # shellcheck disable=SC1091 # using path on bootstrap machine
7+ . /usr/local/bin/wait-for-ha-api.sh
8+
69KUBECONFIG=" ${1} "
710
811wait_for_existence () {
@@ -17,6 +20,9 @@ echo "Waiting for bootstrap to complete..."
1720wait_for_existence /opt/openshift/.bootkube.done
1821record_service_stage_success
1922
23+ # # wait for API to be available
24+ wait_for_ha_api
25+
2026record_service_stage_start " report-bootstrap-complete"
2127echo " Reporting install progress..."
2228while ! oc --kubeconfig=" $KUBECONFIG " create -f - << -EOF
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ wait_for_ha_api () {
4+ if [ " $BOOTSTRAP_INPLACE " = true ]
5+ then
6+ return 0
7+ fi
8+
9+ echo " Waiting for at least 2 available IP addresses for the default/kubernetes service"
10+ while ! is_api_available
11+ do
12+ sleep 5
13+ done
14+ }
15+
16+ # #
17+ # # for HA cluster, we mark the bootstrap process as complete when there
18+ # # are at least two IP addresses available to the endpoints
19+ # # of the default/kubernetes service object.
20+ # # TODO: move this to kas operator as a subcommand of the render command
21+ is_api_available () {
22+ output=$( oc --kubeconfig=" $KUBECONFIG " get endpoints kubernetes --namespace=default -o jsonpath=' {range @.subsets[*]}{range @.addresses[*]}{.ip}{" "}' 2>&1 )
23+ # shellcheck disable=SC2124
24+ status=$?
25+ if [[ $status -ne 0 ]]
26+ then
27+ echo " The following error happened while retrieving the default/kubernetes endpoint object"
28+ echo " $output "
29+ return 1
30+ fi
31+
32+ echo " Got the following addresses for the default/kubernetes endpoint object: $output "
33+ count=$( echo " $output " | wc -w)
34+ if [[ ! $count -gt 1 ]]
35+ then
36+ return 1
37+ fi
38+
39+ echo " Got at least 2 available addresses for the default/kubernetes service"
40+ return 0
41+ }
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3+ # shellcheck disable=SC1091 # using path on bootstrap machine
4+ . /usr/local/bin/wait-for-ha-api.sh
5+
36KUBECONFIG=" ${1} "
47
58wait_for_existance () {
@@ -18,6 +21,9 @@ systemctl stop gcp-routes.service
1821echo " Waiting for bootstrap to complete..."
1922wait_for_existance /opt/openshift/.bootkube.done
2023
24+ # # wait for API to be available
25+ wait_for_ha_api
26+
2127echo " Reporting install progress..."
2228while ! oc --kubeconfig=" $KUBECONFIG " create -f - << -EOF
2329 apiVersion: v1
You can’t perform that action at this time.
0 commit comments