Skip to content

Commit b2550ae

Browse files
AGENT-1207: automate OVE cluster installation (#1796)
Automates OVE cluster installation using the Go-based library `go-rod` in headless mode. The workflow fills in cluster details, captures screenshots for each step, downloads credentials, and triggers the install action without requiring a visible browser. Verification steps include: - Confirming cluster installation completion - Running `oc get nodes`, `oc get clusterversion`, `oc get packagemanifests` and `oc wait clusterversion version --for=condition=Available=True --timeout=60m` - Ensuring the number of nodes matches values defined in dev-scripts
1 parent 3943338 commit b2550ae

File tree

7 files changed

+406
-38
lines changed

7 files changed

+406
-38
lines changed

agent/01_agent_requirements.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,6 @@ if [[ "${AGENT_E2E_TEST_BOOT_MODE}" == "ISCSI" ]]; then
5555
fi
5656

5757
if [[ "${AGENT_E2E_TEST_BOOT_MODE}" == "ISO_NO_REGISTRY" ]]; then
58-
sudo dnf -y install xorriso coreos-installer syslinux skopeo
58+
sudo dnf -y install epel-release
59+
sudo dnf -y install chromium skopeo
5960
fi

agent/06_agent_create_cluster.sh

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -646,41 +646,15 @@ case "${AGENT_E2E_TEST_BOOT_MODE}" in
646646

647647
check_assisted_install_UI
648648

649-
# Temporarily create a dummy kubeconfig and kubeadmin-password file for the CI
650-
auth_dir=$SCRIPTDIR/$OCP_DIR/auth
651-
mkdir -p $auth_dir
652-
cfg=$auth_dir/kubeconfig
653-
cat << EOF >> ${cfg}
654-
clusters:
655-
- cluster:
656-
certificate-authority-data: LS0tLS1CRUdJTiBGSUNBVLS0tLQo=
657-
server: https://api.test.redhat.com:6443
658-
name: test
659-
contexts:
660-
- context:
661-
cluster: test
662-
user: admin
663-
name: admin
664-
current-context: admin
665-
preferences: {}
666-
users:
667-
- name: admin
668-
user:
669-
client-certificate-data: LS0tLS1CRUdJTiBNBVEUtLS0tLQo=
670-
client-key-data: LS0tLS1CRUdJTiURSBVktLS0tLQo=
671-
EOF
672-
echo "dummy-kubeadmin-password" > $auth_dir/kubeadmin-password
649+
mkdir -p $OCP_DIR/auth
650+
rendezvousIP=$(getRendezvousIP)
651+
get_vips
652+
# Simulate user actions as done on the webUI and start cluster installation
653+
CLUSTER_NAME=$CLUSTER_NAME BASE_DOMAIN=$BASE_DOMAIN RENDEZVOUS_IP=$rendezvousIP OCP_DIR=$OCP_DIR INGRESS_VIP=$INGRESS_VIPS API_VIP=$API_VIPS go run agent/isobuilder/ui_driven_cluster_installation/main.go
654+
exit 0
673655
;;
674656
esac
675657

676-
if [[ "${AGENT_E2E_TEST_BOOT_MODE}" == "ISO_NO_REGISTRY" ]]; then
677-
# Current goal is to only verify if the nodes are booted fine,
678-
# TUI sets the rendezvous IP correctly and UI is accessible.
679-
# The next goal is to simulate adding the cluster details via UI
680-
# and complete the cluster installation.
681-
exit 0
682-
fi
683-
684658
if [ ! -z "${AGENT_TEST_CASES:-}" ]; then
685659
run_agent_test_cases
686660
fi

agent/agent_post_install_validation.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
55

66
source $SCRIPTDIR/common.sh
77

8-
# Temp code skip the execution flow as cluster is not really installed
98
if [[ "${AGENT_E2E_TEST_BOOT_MODE}" == "ISO_NO_REGISTRY" ]]; then
10-
exit 0
9+
oc wait clusterversion version --for=condition=Available=True --timeout=60m
10+
oc get csv -A
11+
oc get packagemanifests -n openshift-marketplace
1112
fi
1213

1314
installed_control_plane_nodes=$(oc get nodes --selector=node-role.kubernetes.io/master | grep -v AGE | wc -l)
@@ -18,3 +19,5 @@ if (( $NUM_MASTERS != $installed_control_plane_nodes )); then
1819
echo "Post install validation failed. Expected $NUM_MASTERS control plane nodes but found $installed_control_plane_nodes."
1920
exit 1
2021
fi
22+
23+
oc get clusterversion

agent/gather.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ done < "${OCP_DIR}"/hosts
2424
num_screenshots=$(find "${OCP_DIR}" -type f -name "*.ppm" | wc -l)
2525
if [[ "$num_screenshots" -gt 0 ]]; then
2626
archive_name="agent-gather-console-screenshots.tar.xz"
27-
echo "Gathering console screenshots to $archive_name"
28-
tar -cJf $archive_name ${OCP_DIR}/*.ppm
27+
echo "Gathering screenshots to $archive_name"
28+
tar -cJf $archive_name ${OCP_DIR}/*.ppm ${OCP_DIR}/*.png
2929
else
30-
echo "No console screenshots found. Skipping screenshot gather."
30+
echo "No screenshots found. Skipping screenshot gather."
3131
fi
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module github.com/openshift-metal3/dev-scripts/ui-driven-cluster-installation
2+
3+
go 1.22.3
4+
5+
require (
6+
github.com/go-resty/resty/v2 v2.16.5
7+
github.com/go-rod/rod v0.116.2
8+
github.com/pkg/errors v0.9.1
9+
github.com/sirupsen/logrus v1.9.3
10+
)
11+
12+
require (
13+
github.com/ysmood/fetchup v0.2.3 // indirect
14+
github.com/ysmood/goob v0.4.0 // indirect
15+
github.com/ysmood/got v0.40.0 // indirect
16+
github.com/ysmood/gson v0.7.3 // indirect
17+
github.com/ysmood/leakless v0.9.0 // indirect
18+
golang.org/x/net v0.33.0 // indirect
19+
golang.org/x/sys v0.28.0 // indirect
20+
)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4+
github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=
5+
github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
6+
github.com/go-rod/rod v0.116.2 h1:A5t2Ky2A+5eD/ZJQr1EfsQSe5rms5Xof/qj296e+ZqA=
7+
github.com/go-rod/rod v0.116.2/go.mod h1:H+CMO9SCNc2TJ2WfrG+pKhITz57uGNYU43qYHh438Mg=
8+
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
9+
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
10+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
11+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
12+
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
13+
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
14+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
15+
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
16+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
17+
github.com/ysmood/fetchup v0.2.3 h1:ulX+SonA0Vma5zUFXtv52Kzip/xe7aj4vqT5AJwQ+ZQ=
18+
github.com/ysmood/fetchup v0.2.3/go.mod h1:xhibcRKziSvol0H1/pj33dnKrYyI2ebIvz5cOOkYGns=
19+
github.com/ysmood/goob v0.4.0 h1:HsxXhyLBeGzWXnqVKtmT9qM7EuVs/XOgkX7T6r1o1AQ=
20+
github.com/ysmood/goob v0.4.0/go.mod h1:u6yx7ZhS4Exf2MwciFr6nIM8knHQIE22lFpWHnfql18=
21+
github.com/ysmood/gop v0.2.0 h1:+tFrG0TWPxT6p9ZaZs+VY+opCvHU8/3Fk6BaNv6kqKg=
22+
github.com/ysmood/gop v0.2.0/go.mod h1:rr5z2z27oGEbyB787hpEcx4ab8cCiPnKxn0SUHt6xzk=
23+
github.com/ysmood/got v0.40.0 h1:ZQk1B55zIvS7zflRrkGfPDrPG3d7+JOza1ZkNxcc74Q=
24+
github.com/ysmood/got v0.40.0/go.mod h1:W7DdpuX6skL3NszLmAsC5hT7JAhuLZhByVzHTq874Qg=
25+
github.com/ysmood/gotrace v0.6.0 h1:SyI1d4jclswLhg7SWTL6os3L1WOKeNn/ZtzVQF8QmdY=
26+
github.com/ysmood/gotrace v0.6.0/go.mod h1:TzhIG7nHDry5//eYZDYcTzuJLYQIkykJzCRIo4/dzQM=
27+
github.com/ysmood/gson v0.7.3 h1:QFkWbTH8MxyUTKPkVWAENJhxqdBa4lYTQWqZCiLG6kE=
28+
github.com/ysmood/gson v0.7.3/go.mod h1:3Kzs5zDl21g5F/BlLTNcuAGAYLKt2lV5G8D1zF3RNmg=
29+
github.com/ysmood/leakless v0.9.0 h1:qxCG5VirSBvmi3uynXFkcnLMzkphdh3xx5FtrORwDCU=
30+
github.com/ysmood/leakless v0.9.0/go.mod h1:R8iAXPRaG97QJwqxs74RdwzcRHT1SWCGTNqY8q0JvMQ=
31+
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
32+
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
33+
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
34+
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
35+
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
36+
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
37+
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
38+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
39+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
40+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)