@@ -299,16 +299,23 @@ objects:
299
299
echo "Removing bootstrap host from control plane api pool"
300
300
(cd /tmp/artifacts/terraform && terraform apply -auto-approve=true -var=bootstrap_dns="false")
301
301
302
- echo "Approving any pending CSR requests"
303
- oc get csr -ojson | jq -r '.items[] | select(.status == {} ) | .metadata.name' | xargs oc adm certificate approve
302
+ function approve_csrs() {
303
+ while [[ ! -f /tmp/exit ]] && [[ ! -f /tmp/setup-success ]]; do
304
+ oc get csr -ojson | jq -r '.items[] | select(.status == {} ) | .metadata.name' | xargs --no-run-if-empty oc adm certificate approve
305
+ sleep 15
306
+ done
307
+ }
304
308
305
- until oc get configs.imageregistry.operator.openshift.io cluster >/dev/null
306
- do
307
- echo "waiting for configs.imageregistry.operator.openshift.io cluster to exit failed. Retrying in 1 minute..."
308
- sleep 1m
309
- done
309
+ function update_image_registry() {
310
+ while true; do
311
+ sleep 10;
312
+ oc get configs.imageregistry.operator.openshift.io/cluster > /dev/null && break
313
+ done
314
+ oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"storage":{"emptyDir":{}}}}'
315
+ }
310
316
311
- oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"storage":{"emptyDir":{}}}}'
317
+ approve_csrs &
318
+ update_image_registry &
312
319
313
320
echo "Completing UPI setup"
314
321
openshift-install --dir=/tmp/artifacts/installer wait-for install-complete &
@@ -366,14 +373,9 @@ objects:
366
373
mkdir -p /tmp/artifacts/pods /tmp/artifacts/nodes /tmp/artifacts/metrics /tmp/artifacts/bootstrap /tmp/artifacts/network
367
374
368
375
369
- if [ -f /tmp/artifacts/installer /terraform.tfstate ]
376
+ if [ -f /tmp/artifacts/terraform /terraform.tfstate ]
370
377
then
371
- # we don't have jq, so the python equivalent of
372
- # jq '.modules[].resources."aws_instance.bootstrap".primary.attributes."public_ip" | select(.)'
373
- bootstrap_ip=$(python -c \
374
- '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 ""' \
375
- < /tmp/artifacts/installer/terraform.tfstate
376
- )
378
+ bootstrap_ip=$(terraform output -json | jq -r '.bootstrap_ip.value')
377
379
378
380
if [ -n "${bootstrap_ip}" ]
379
381
then
@@ -388,6 +390,15 @@ objects:
388
390
--key /tmp/artifacts/installer/tls/journal-gatewayd.key \
389
391
--url "https://${bootstrap_ip}:19531/entries?_SYSTEMD_UNIT=${service}.service"
390
392
done
393
+ if ! whoami &> /dev/null; then
394
+ if [ -w /etc/passwd ]; then
395
+ echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd
396
+ fi
397
+ fi
398
+ eval $(ssh-agent)
399
+ ssh-add /etc/openshift-installer/ssh-privatekey
400
+ ssh -A -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null core@${bootstrap_ip} /bin/bash -x /usr/local/bin/installer-gather.sh
401
+ 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
391
402
fi
392
403
else
393
404
echo "No terraform statefile found. Skipping collection of bootstrap logs."
0 commit comments