-
Notifications
You must be signed in to change notification settings - Fork 1.9k
ci-operator/templates/e2e-metal: fix csr approval and bootstrap log gathering #3587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
openshift-merge-robot
merged 1 commit into
openshift:master
from
abhinavdahiya:metal-ci-template
Apr 25, 2019
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -299,16 +299,23 @@ objects: | |
echo "Removing bootstrap host from control plane api pool" | ||
(cd /tmp/artifacts/terraform && terraform apply -auto-approve=true -var=bootstrap_dns="false") | ||
|
||
echo "Approving any pending CSR requests" | ||
oc get csr -ojson | jq -r '.items[] | select(.status == {} ) | .metadata.name' | xargs oc adm certificate approve | ||
function approve_csrs() { | ||
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 | ||
} | ||
|
||
until oc get configs.imageregistry.operator.openshift.io cluster >/dev/null | ||
do | ||
echo "waiting for configs.imageregistry.operator.openshift.io cluster to exit failed. Retrying in 1 minute..." | ||
sleep 1m | ||
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":{}}}}' | ||
} | ||
|
||
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 & | ||
|
@@ -366,14 +373,9 @@ objects: | |
mkdir -p /tmp/artifacts/pods /tmp/artifacts/nodes /tmp/artifacts/metrics /tmp/artifacts/bootstrap /tmp/artifacts/network | ||
|
||
|
||
if [ -f /tmp/artifacts/installer/terraform.tfstate ] | ||
if [ -f /tmp/artifacts/terraform/terraform.tfstate ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Everyone else puts this under the installer directory: $ git grep -h terraform.tfstate origin/master -- ci-operator/templates/openshift/installer | grep -o '/tmp.*tfstate' | sort | uniq -c
12 /tmp/artifacts/installer/terraform.tfstate but I guess that's because they're running Terraform via the installer. So +1 to this, although I was initially confused ;). |
||
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 | ||
) | ||
bootstrap_ip=$(terraform output -json | jq -r '.bootstrap_ip.value') | ||
|
||
if [ -n "${bootstrap_ip}" ] | ||
then | ||
|
@@ -388,6 +390,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." | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the pattern is to echo some progress message before taking action, should we have
echo 'Updating image registry storage...'
or something similar before this line? I'm also fine just having the script silently do its job, but it feels odd to have thisupdate_image_registry
appear to happen under anApproving pending CSRs
header.