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
Original file line number Diff line number Diff line change
Expand Up @@ -427,17 +427,35 @@ objects:
terraform apply -auto-approve -var 'bootstrap_complete=true' -no-color &
wait "$!"

function approve_csrs() {
while true; do
if [[ ! -f /tmp/install-complete ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Am I reading this wrong or does this wait for the install-complete file to exist before approving the CSRs?

I was expecting something like the following.

function approve_csrs() {
  while [[ ! -f /tmp/install-complete ]]; do
    sleep 15;
    oc get csr -ojson | jq -r '.items[] | select(.status == {} ) | .metadata.name' | xargs --no-run-if-empty oc adm certificate approve
  done
}

Copy link
Contributor Author

@vrutkovs vrutkovs Apr 24, 2019

Choose a reason for hiding this comment

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

Oh, correct, this won't ever finish, as CSR should be approved earlier. Fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

What are we gaining by having an if statement that does a continue in one branch and a break in the other rather than moving the check up to the while statement?

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
done
}

function update_image_registry() {
while true; do
sleep 10;
oc get configs.imageregistry.operator.openshift.io/cluster > /dev/null && break
done
oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"storage":{"emptyDir":{}}}}'
}

echo "Approving pending CSRs"
export KUBECONFIG=/tmp/artifacts/installer/auth/kubeconfig
oc get csr -ojson | jq -r '.items[] | select(.status == {} ) | .metadata.name' | xargs oc adm certificate approve

echo "Set registry storage to emptyDir"
while true; do oc get configs.imageregistry.operator.openshift.io/cluster && break; done
oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"storage":{"emptyDir":{}}}}'
approve_csrs &
update_image_registry &

echo "Completing UPI setup"
openshift-install --dir=/tmp/artifacts/installer wait-for install-complete &
wait "$!"
touch /tmp/install-complete

# Performs cleanup of all created resources
- name: teardown
Expand Down