forked from kxr/ocp4_setup_upi_kvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openshift-libvirt.sh
executable file
·72 lines (51 loc) · 1.83 KB
/
openshift-libvirt.sh
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
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# OpenShift UPI installation script
# https://github.com/kxr/ocp4_setup_upi_kvm
# Force the script to run as root
if [[ "$EUID" -ne 0 ]]; then
echo "This script must be run as root. Restarting with sudo..."
exec sudo "$0" "$@"
fi
set -e
export START_TS=$(date +%s)
export SINV="${0} ${@}"
export SDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
export COLS="$(stty size | awk '{print $2}')"
# 'source' integrates scripts as part of the main environment without
# needing separate processes or subshells, providing an effective
# structure for complex workflows like the OpenShift UPI installation.
# Utility function err,ok,download etc.
source ${SDIR}/.install_scripts/utils.sh
# Checking if we are root
test "$(whoami)" = root || err "Not running as root"
# Process Arguments
source ${SDIR}/.defaults.sh
source ${SDIR}/.install_scripts/process_args.sh "${@}"
# Destroy
if [ "${DESTROY}" == "yes" ]; then
source ${SDIR}/.install_scripts/destroy.sh
exit 0
fi
# Connect to system via qemu driver in libvirt
# - avoids having to use export LIBGUESTFS_BACKEND=direct
virsh connect qemu:///system
# Dependencies & Sanity checks
source ${SDIR}/.install_scripts/sanity_check.sh
# Libvirt Network
source ${SDIR}/.install_scripts/libvirt_network.sh
# DNS Check
source ${SDIR}/.install_scripts/dns_check.sh
# Version check
source ${SDIR}/.install_scripts/version_check.sh
# Download & Prepare
source ${SDIR}/.install_scripts/download_prepare.sh
# Create LB VM
source ${SDIR}/.install_scripts/create_lb.sh
# Create Cluster Nodes
source ${SDIR}/.install_scripts/create_nodes.sh
# OpenShift Bootstrapping
source ${SDIR}/.install_scripts/bootstrap.sh
# OpenShift ClusterVersion
source ${SDIR}/.install_scripts/clusterversion.sh
# Generate env file and copy post scripts
source ${SDIR}/.install_scripts/post.sh