Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions agent/05_agent_create_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,32 @@ function attach_agent_iso() {
done
}

function force_mirror_disconnect() {

# Set a bogus entry in /etc/hosts on all masters to force the local mirror to be used
node0_name=$(printf ${MASTER_HOSTNAME_FORMAT} 0)
node0_ip=$(sudo virsh net-dumpxml ostestbm | xmllint --xpath "string(//dns[*]/host/hostname[. = '${node0_name}']/../@ip)" -)
ssh_opts=(-o 'StrictHostKeyChecking=no' -q core@${node0_ip})

for (( n=0; n<${NUM_MASTERS}; n++ ))
do
node_name=$(printf ${MASTER_HOSTNAME_FORMAT} $n)
node_ip=$(sudo virsh net-dumpxml ostestbm | xmllint --xpath "string(//dns[*]/host/hostname[. = '${node_name}']/../@ip)" -)
ssh_opts=(-o 'StrictHostKeyChecking=no' -q core@${node_ip})

until ssh "${ssh_opts[@]}" "[[ -f /etc/hosts ]]"
do
echo "Waiting for $node_name to set remote host disconnect "
sleep 30s;
done

# Set a bogus entry in /etc/hosts to break remote access
ssh "${ssh_opts[@]}" "echo '125.12.15.15 quay.io' | sudo tee -a /etc/hosts "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mirroring command I see from dev-scripts is:
oc adm release mirror --insecure=true -a /opt/dev-scripts/pull_secret.json --from registry.ci.openshift.org/ocp/release:4.11.0-0.nightly-2022-07-13-131410 --to-release-image virthost.ostest.test.metalkube.org:5000/localimages/local-release-image:4.11.0-0.nightly-2022-07-13-131410 --to virthost.ostest.test.metalkube.org:5000/localimages/local-release-image
Shouldn't there be an entry for registry.ci.openshift.org?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes there should be an entry for registry also, added it.

ssh "${ssh_opts[@]}" "echo '125.12.15.16 registry.ci.openshift.org' | sudo tee -a /etc/hosts "
done

}

function wait_for_cluster_ready() {

node0_name=$(printf ${MASTER_HOSTNAME_FORMAT} 0)
Expand Down Expand Up @@ -66,6 +92,10 @@ create_image
attach_agent_iso master $NUM_MASTERS
attach_agent_iso worker $NUM_WORKERS

if [ ! -z "${MIRROR_IMAGES}" ]; then
force_mirror_disconnect
fi

wait_for_cluster_ready
# Temporary fix for the CI. To be removed once we'll
# be able to generate the cluster credentials
Expand Down