Skip to content

Commit 439aca6

Browse files
committed
feat: add extra "bare cluster" wrapper script
Signed-off-by: Chris Butler <chris.butler@redhat.com>
1 parent 3cefc16 commit 439aca6

3 files changed

Lines changed: 115 additions & 6 deletions

File tree

rhdp/wrapper-cluster-only.sh

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
2+
#!/usr/bin/env bash
3+
set -e
4+
5+
# Function to detect available python binary
6+
get_python_cmd() {
7+
if command -v python &> /dev/null; then
8+
echo "python"
9+
elif command -v python3 &> /dev/null; then
10+
echo "python3"
11+
else
12+
echo "ERROR: Neither python3 nor python is available" >&2
13+
exit 1
14+
fi
15+
}
16+
17+
if [ "$#" -ne 1 ]; then
18+
echo "Error: Exactly one argument is required."
19+
echo "Usage: $0 {azure-region-code}"
20+
echo "Example: $0 eastasia"
21+
exit 1
22+
fi
23+
AZUREREGION=$1
24+
25+
echo "---------------------"
26+
echo "Validating configuration"
27+
echo "---------------------"
28+
29+
# Check if values-global.yaml exists
30+
if [ ! -f "values-global.yaml" ]; then
31+
echo "ERROR: values-global.yaml file not found in current directory"
32+
echo "Please run this script from the root directory of the project"
33+
exit 1
34+
fi
35+
36+
37+
# Extract clusterGroupName from values-global.yaml using yq
38+
CLUSTER_GROUP_NAME=$(yq eval '.main.clusterGroupName' values-global.yaml)
39+
40+
41+
echo "Check your cluster group name makes sense: clusterGroupName = $CLUSTER_GROUP_NAME"
42+
43+
echo "Run from the root directory of the project"
44+
echo "\n"
45+
echo "Ensuring azure environment is installed"
46+
47+
if [ ! -n "${GUID}" ]; then
48+
echo "RHDP GUID environmental variable does not exist"
49+
exit 1
50+
fi
51+
if [ ! -n "${CLIENT_ID}" ]; then
52+
echo "RHDP AZURE 'CLIENT_ID' environmental variable does not exist"
53+
exit 1
54+
fi
55+
if [ ! -n "${PASSWORD}" ]; then
56+
echo "RHDP AZURE 'PASSWORD' environmental variable aka client secret does not exist"
57+
exit 1
58+
fi
59+
if [ ! -n "${TENANT}" ]; then
60+
echo "RHDP AZURE 'TENANT' environmental variable does not exist"
61+
exit 1
62+
fi
63+
if [ ! -n "${SUBSCRIPTION}" ]; then
64+
echo "RHDP AZURE 'SUBSCRIPTION' environmental variable does not exist"
65+
exit 1
66+
fi
67+
if [ ! -n "${RESOURCEGROUP}" ]; then
68+
echo "RHDP AZURE 'RESOURCEGROUP' environmental variable does not exist"
69+
exit 1
70+
fi
71+
72+
73+
sleep 10
74+
echo "---------------------"
75+
echo "Installing python dependencies"
76+
echo "---------------------"
77+
pip install -r rhdp/requirements.txt
78+
echo "---------------------"
79+
echo "requirements installed"
80+
echo "---------------------"
81+
sleep 5
82+
83+
if [ ! -f "${HOME}/pull-secret.json" ]; then
84+
echo "A OpenShift pull secret is required at ~/pull-secret.json"
85+
exit 1
86+
fi
87+
88+
if [ ! -f "${HOME}/.ssh/id_rsa" ]; then
89+
echo "An rsa ssh key is required at ~/.ssh/id_rsa"
90+
echo "e.g. ssh-keygen -t rsa -b 4096"
91+
echo "TBC: Update to support other key types"
92+
exit 1
93+
fi
94+
95+
96+
echo "---------------------"
97+
echo "defining cluster"
98+
echo "---------------------"
99+
PYTHON_CMD=$(get_python_cmd)
100+
$PYTHON_CMD rhdp/rhdp-cluster-define.py ${AZUREREGION}
101+
echo "---------------------"
102+
echo "cluster defined"
103+
echo "---------------------"
104+
sleep 10
105+
echo "---------------------"
106+
echo "openshift-install"
107+
echo "---------------------"
108+
openshift-install create cluster --dir=./openshift-install
109+
echo "openshift-install done"

rhdp/wrapper-multicluster.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ set -e
33

44
# Function to detect available python binary
55
get_python_cmd() {
6-
if command -v python3 &> /dev/null; then
7-
echo "python3"
8-
elif command -v python &> /dev/null; then
6+
if command -v python &> /dev/null; then
97
echo "python"
8+
elif command -v python3 &> /dev/null; then
9+
echo "python3"
1010
else
1111
echo "ERROR: Neither python3 nor python is available" >&2
1212
exit 1

rhdp/wrapper.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ set -e
44

55
# Function to detect available python binary
66
get_python_cmd() {
7-
if command -v python3 &> /dev/null; then
8-
echo "python3"
9-
elif command -v python &> /dev/null; then
7+
if command -v python &> /dev/null; then
108
echo "python"
9+
elif command -v python3 &> /dev/null; then
10+
echo "python3"
1111
else
1212
echo "ERROR: Neither python3 nor python is available" >&2
1313
exit 1

0 commit comments

Comments
 (0)