Step: upi-conf-vsphere-ova

vSphere OVA checks if appropriate template exists. If it does not exist download the ova and upload to vCenter.

Container image used for this step: upi-installer

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

Environment

Step exposes no environmental variables except the defaults.

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
56
57
58
59
60
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

trap 'CHILDREN=$(jobs -p); if test -n "${CHILDREN}"; then kill ${CHILDREN} && wait; fi' TERM

HOME=/tmp
export HOME

echo "$(date -u --rfc-3339=seconds) - Locating RHCOS image for release..."

ova_url=$(<"${SHARED_DIR}"/ova_url.txt)
vm_template="${ova_url##*/}"

# Troubleshooting UPI OVA import issue
echo "$(date -u --rfc-3339=seconds) - vm_template: ${vm_template}"

echo "$(date -u --rfc-3339=seconds) - Configuring govc exports..."
# shellcheck source=/dev/null
source "${SHARED_DIR}/govc.sh"

cat > /tmp/rhcos.json << EOF
{
   "DiskProvisioning": "thin",
   "MarkAsTemplate": false,
   "PowerOn": false,
   "InjectOvfEnv": false,
   "WaitForIP": false,
   "Name": "${vm_template}",
   "NetworkMapping":[{"Name":"VM Network","Network":"${LEASED_RESOURCE}"}]
}
EOF

echo "$(date -u --rfc-3339=seconds) - Checking if RHCOS OVA needs to be downloaded from ${ova_url}..."

# Troubleshooting UPI OVA import issue
export GOVC_DEBUG_PATH="${ARTIFACT_DIR}/govc"
mkdir -p "${GOVC_DEBUG_PATH}"
govc vm.info -debug "${vm_template}" || true
unset GOVC_DEBUG_PATH

if [[ "$(govc vm.info "${vm_template}" | wc -c)" -eq 0 ]]
then
    echo "$(date -u --rfc-3339=seconds) - Creating a template for the VMs from ${ova_url}..."
    curl -L -o /tmp/rhcos.ova "${ova_url}"
    govc import.ova -options=/tmp/rhcos.json /tmp/rhcos.ova &
    wait "$!"
fi

hw_versions=(13 15 17)
for hw_version in "${hw_versions[@]}"; do
    if [[ "$(govc vm.info "${vm_template}-hw${hw_version}" | wc -c)" -eq 0 ]]
    then
        echo "$(date -u --rfc-3339=seconds) - Cloning and upgrading ${vm_template} to hw version ${hw_version}..."
        govc vm.clone -on=false -vm="${vm_template}" "${vm_template}-hw${hw_version}"
        govc vm.upgrade -vm="${vm_template}-hw${hw_version}" -version=${hw_version}
    fi
done

Properties

Property Value Description
Termination grace period[?] 10m0s Period of time until SIGKILL signal is sent to the test pod (after SIGTERM signal is sent).
Resource requests (cpu) 1000m Used in .resources.requests of the pod running this step.
Resource requests (memory) 512Mi Used in .resources.requests of the pod running this step.

GitHub Link:

https://github.com/openshift/release/blob/master/ci-operator/step-registry/upi/conf/vsphere/ova/upi-conf-vsphere-ova-ref.yaml

Owners:

Approvers:

Source code for this page located on GitHub