Step: ipi-conf-openstack-precheck

The ipi-conf-openstack-precheck verifies the OpenStack infrastructure is ready for deploying an OpenShift cluster on to it.

Container image used for this step: openstack-installer

openstack-installer resolves to an image built or imported by the ci-operator configuration (documentation).

Environment

In addition to the default environment, the step exposes the following:

Variable Name Type Variable Content
BASE_DOMAIN Parameter[?]
WAIT_TIME Parameter[?] number of seconds to wait before trying. (default: 60)
TRY_COUNT Parameter[?] number of times to retry (default: 5)

Source Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
set -o nounset
set -o errexit
set -o pipefail


set +e

CLUSTER_NAME=$(<"${SHARED_DIR}"/CLUSTER_NAME)

function check_ip_resolves() {
  lookup=$(nslookup $2)
  if [[ $? -eq 0 ]]; then
    if [[ ${lookup} =~ $1 ]]; then
      echo $2 resolves to $1
      return 0
    fi
  fi
  echo $2 does not resolv to $1
  return 1
}


API_IP=$(<"${SHARED_DIR}"/API_IP)
INGRESS_IP=$(<"${SHARED_DIR}"/INGRESS_IP)

SLEEP_TIME=${WAIT_TIME}
COUNT=$(seq ${TRY_COUNT})


declare -A ipmap
ipmap["api"]=${API_IP}
ipmap["ingress.apps"]=${INGRESS_IP}

for key in "${!ipmap[@]}"
do
    NAME=${key}
    IP=${ipmap[${key}]}
    for TRY in ${COUNT}
    do
        sleep ${SLEEP_TIME}
        echo Attempt ${TRY} to verify we can resolve ${NAME}.${CLUSTER_NAME}.${BASE_DOMAIN}
        check_ip_resolves "${IP}" "${NAME}.${CLUSTER_NAME}.${BASE_DOMAIN}"
        if [[ "$?" -eq "0" ]] ; then
            echo ${NAME}.${CLUSTER_NAME}.${BASE_DOMAIN} resolves correctly to ${IP}
            EXIT_CODE=0
            break
        fi
        EXIT_CODE=1
    done
    if [[ ${EXIT_CODE} -ne 0 ]]; then
        echo "FAILED: After ${TRY_COUNT} tries, ${NAME}.${CLUSTER_NAME}.${BASE_DOMAIN} did not resolve to ${IP}"
        exit ${EXIT_CODE}
    fi
done

Properties

Property Value Description
Resource requests (cpu) 10m Used in .resources.requests of the pod running this step.
Resource requests (memory) 100Mi Used in .resources.requests of the pod running this step.

GitHub Link:

https://github.com/openshift/release/blob/master/ci-operator/step-registry/ipi/conf/openstack/precheck/ipi-conf-openstack-precheck-ref.yaml

Owners:

Approvers:

Reviewers:

Source code for this page located on GitHub