-
Notifications
You must be signed in to change notification settings - Fork 2k
e2e-aws: stream bootkube and 'kubectl get all' to artifacts #2064
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -368,6 +368,77 @@ objects: | |
| /bin/openshift-install --dir=/tmp/artifacts/installer create cluster & | ||
| wait "$!" | ||
|
|
||
| # Stream "journalctl -u bootkube" and "kubectl get all -a --all-namespaces -w" into artifact | ||
| - name: stream-bootstrapping | ||
| image: ${IMAGE_INSTALLER} | ||
| volumeMounts: | ||
| - name: shared-tmp | ||
| mountPath: /tmp/shared | ||
| - name: cluster-profile | ||
| mountPath: /etc/openshift-installer | ||
| - name: artifacts | ||
| mountPath: /tmp/artifacts | ||
| command: | ||
| - /bin/bash | ||
| - -c | ||
| - | | ||
| #!/bin/bash | ||
| trap 'kill $(jobs -p); exit 0' TERM | ||
|
|
||
| mkdir -p .ssh | ||
| chmod 700 .ssh | ||
| cp /etc/openshift-installer/ssh-privatekey .ssh/id_rsa | ||
| cp /etc/openshift-installer/ssh-publickey .ssh/id_rsa.pub | ||
|
|
||
| function stream-bootkube () { | ||
| ip=${1} | ||
| while true; do | ||
| ssh -o "StrictHostKeyChecking=no" core@${ip} sudo journalctl -u bootkube.service -f --no-tail 2>&1 | ||
| echo "=================== journalctl terminated ===================" | ||
| date | ||
|
Member
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. Can we embed this in the termination marker? It feels like it might be associated with the next iteration's logs if it comes after a big banner. Something like: echo "========== journalctl terminated $(date --iso=s --utc) =========="would do it. |
||
| sleep 5 | ||
| done > /tmp/artifacts/bootstrap/bootkube.log | ||
| } | ||
|
|
||
| function stream-kubectl-get-all () { | ||
| ip=${1} | ||
| while true; do | ||
| ssh -o "StrictHostKeyChecking=no" core@${ip} sudo kubectl get all --kubeconfig=/var/opt/tectonic/auth/kubeconfig -a --all-namespaces -w 2>&1 | ||
| echo "=================== kubectl get all ... -w terminated ===================" | ||
| date | ||
| sleep 5 | ||
| done > /tmp/artifacts/bootstrap/kubectl-get-all.log | ||
| } | ||
|
|
||
| function start-streams () { | ||
| # wait for terraform to start up | ||
| while [ ! -f /tmp/artifacts/installer/terraform.tfstate ]; do sleep 5; done | ||
|
|
||
| # wait for the bootstrap node to show up with an IP | ||
| ip="" | ||
| while [ -z "${ip}" ]; do | ||
| ip=$(terraform state show -state=terraform.tfstate module.bootstrap.aws_instance.bootstrap | sed -n 's/^public_ip *= *//p') | ||
|
||
| done | ||
|
|
||
| # try to login | ||
| while ! ssh -o "StrictHostKeyChecking=no" core@${ip} /bin/true; do | ||
| sleep 5 | ||
| done | ||
|
|
||
| # start streaming | ||
| mkdir -p /tmp/artifacts/bootstrap | ||
| stream-bootkube ${ip} & | ||
| stream-kubectl-get-all ${ip} & | ||
| } | ||
|
|
||
| start-streams | ||
| for i in `seq 1 180`; do | ||
| if [[ -f /tmp/shared/exit ]]; then | ||
| exit 0 | ||
| fi | ||
| sleep 60 & wait | ||
|
||
| done | ||
|
|
||
| # Performs cleanup of all created resources | ||
| - name: teardown | ||
| image: ${IMAGE_INSTALLER} | ||
|
|
||
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.
This is super complicated. Why isn't the installer fetching the bootkube logs if anything fails?