diff --git a/ci-operator/templates/openshift/installer/cluster-launch-installer-upi-e2e.yaml b/ci-operator/templates/openshift/installer/cluster-launch-installer-upi-e2e.yaml index d06fb53ed41b7..ef1341828a7ee 100644 --- a/ci-operator/templates/openshift/installer/cluster-launch-installer-upi-e2e.yaml +++ b/ci-operator/templates/openshift/installer/cluster-launch-installer-upi-e2e.yaml @@ -1700,16 +1700,16 @@ objects: popd elif [[ "${CLUSTER_TYPE}" == "vsphere" ]]; then - mkdir -p /tmp/tf + mkdir -p /tmp/artifacts/terraform # Copy sample UPI files - cp -r /var/lib/openshift-install/upi/${CLUSTER_TYPE}/* /tmp/tf + cp -r /var/lib/openshift-install/upi/${CLUSTER_TYPE}/* /tmp/artifacts/terraform # Create terraform.tfvars export MASTER_IGN=$(cat /tmp/artifacts/installer/master.ign) export WORKER_IGN=$(cat /tmp/artifacts/installer/worker.ign) - cat > /tmp/tf/terraform.tfvars <<-EOF + cat > /tmp/artifacts/terraform/terraform.tfvars <<-EOF machine_cidr = "139.178.87.128/25" vm_template = "${VM_TEMPLATE}" @@ -1744,9 +1744,9 @@ objects: EOF # Copy secret tfvars - cp ${TFVARS_PATH} /tmp/tf + cp ${TFVARS_PATH} /tmp/artifacts/terraform - cd /tmp/tf + cd /tmp/artifacts/terraform echo "Creating infra" terraform init -input=false -no-color & wait "$!" @@ -1789,19 +1789,14 @@ objects: fi function approve_csrs() { - while true; do - if [[ ! -f /tmp/install-complete ]]; then - oc get csr -ojson | jq -r '.items[] | select(.status == {} ) | .metadata.name' | xargs --no-run-if-empty oc adm certificate approve - sleep 15 & wait - continue - else - break - fi + while [[ ! -f /tmp/exit ]] && [[ ! -f /tmp/setup-success ]]; do + oc get csr -ojson | jq -r '.items[] | select(.status == {} ) | .metadata.name' | xargs --no-run-if-empty oc adm certificate approve + sleep 15 done } function update_image_registry() { - while true; do + while [[ ! -f /tmp/exit ]]; do sleep 10; oc get configs.imageregistry.operator.openshift.io/cluster > /dev/null && break done @@ -1895,13 +1890,13 @@ objects: mv /tmp/artifacts/installer/openshift_install_state_updated.json /tmp/artifacts/installer/.openshift_install_state.json fi - if [ -f /tmp/artifacts/installer/terraform.tfstate ] + if [ -f /tmp/artifacts/terraform/terraform.tfstate ] then # we don't have jq, so the python equivalent of # jq '.modules[].resources."aws_instance.bootstrap".primary.attributes."public_ip" | select(.)' bootstrap_ip=$(python -c \ 'import sys, json; d=reduce(lambda x,y: dict(x.items() + y.items()), map(lambda x: x["resources"], json.load(sys.stdin)["modules"])); k="aws_instance.bootstrap"; print d[k]["primary"]["attributes"]["public_ip"] if k in d else ""' \ - < /tmp/artifacts/installer/terraform.tfstate + < /tmp/artifacts/terraform/terraform.tfstate ) if [ -n "${bootstrap_ip}" ] @@ -1917,6 +1912,15 @@ objects: --key /tmp/artifacts/installer/tls/journal-gatewayd.key \ --url "https://${bootstrap_ip}:19531/entries?_SYSTEMD_UNIT=${service}.service" done + if ! whoami &> /dev/null; then + if [ -w /etc/passwd ]; then + echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd + fi + fi + eval $(ssh-agent) + ssh-add /etc/openshift-installer/ssh-privatekey + ssh -A -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null core@${bootstrap_ip} /bin/bash -x /usr/local/bin/installer-gather.sh + scp -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null core@${bootstrap_ip}:log-bundle.tar.gz /tmp/artifacts/installer/bootstrap-logs.tar.gz fi else echo "No terraform statefile found. Skipping collection of bootstrap logs." @@ -2032,7 +2036,7 @@ objects: openshift-install --dir ${HOME}/artifacts/installer destroy cluster gcloud deployment-manager deployments delete -q ${CLUSTER_NAME}-{worker,control-plane,bootstrap,security,infra,vpc} else - cd /tmp/shared/tf + cd /tmp/artifacts/terraform rm -rf .terraform terraform init -input=false -no-color terraform destroy -auto-approve -no-color