From 8303cf22a3f61f501b6fc45a4e47835b47691951 Mon Sep 17 00:00:00 2001 From: Alex Crawford Date: Mon, 14 Jan 2019 12:18:55 -0800 Subject: [PATCH] templates/openshift: grab bootstrap log on failure This uses the Terraform state to discover the IP address of the bootstrap node (ideally, the installer will provide this information in a form which easier to consume in the future). It then connects to the gatewayd instance on that machine and pulls the logs for various services. Hopefully, these logs will be useful when diagnosing installation failures. --- .../cluster-launch-installer-e2e.yaml | 23 +++++++++++++++++-- .../cluster-launch-installer-src.yaml | 23 +++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/ci-operator/templates/openshift/installer/cluster-launch-installer-e2e.yaml b/ci-operator/templates/openshift/installer/cluster-launch-installer-e2e.yaml index 2b3f830d85f58..5a15d747c0aa6 100644 --- a/ci-operator/templates/openshift/installer/cluster-launch-installer-e2e.yaml +++ b/ci-operator/templates/openshift/installer/cluster-launch-installer-e2e.yaml @@ -373,8 +373,27 @@ objects: exit 1 fi - /bin/openshift-install --dir=/tmp/artifacts/installer create cluster & - wait "$!" + if ! /bin/openshift-install --dir=/tmp/artifacts/installer create cluster + then + rc=$? + + bootstrap_ip=$(jq \ + '.modules[].resources."aws_instance.bootstrap".primary.attributes."public_ip" | select(.)' \ + /tmp/artifacts/installer/terraform.tfstate) + + for service in bootkube openshift kubelet crio + do + curl \ + --insecure \ + --silent \ + --cert=/tmp/artifacts/tls/journal-gatewayd.crt \ + --key=/tmp/artifacts/tls/journal-gatewayd.key \ + --url="https://${bootstrap_ip}:19531/entries?_SYSTEMD_UNIT=${service}.service" \ + --output="/tmp/artifacts/installer/${service}.service" + done + + exit "${rc}" + fi # Performs cleanup of all created resources - name: teardown diff --git a/ci-operator/templates/openshift/installer/cluster-launch-installer-src.yaml b/ci-operator/templates/openshift/installer/cluster-launch-installer-src.yaml index bd6b90ab4e16d..ddfc533909875 100644 --- a/ci-operator/templates/openshift/installer/cluster-launch-installer-src.yaml +++ b/ci-operator/templates/openshift/installer/cluster-launch-installer-src.yaml @@ -338,8 +338,27 @@ objects: exit 1 fi - /bin/openshift-install --dir=/tmp/artifacts/installer create cluster & - wait "$!" + if ! /bin/openshift-install --dir=/tmp/artifacts/installer create cluster + then + rc=$? + + bootstrap_ip=$(jq \ + '.modules[].resources."aws_instance.bootstrap".primary.attributes."public_ip" | select(.)' \ + /tmp/artifacts/installer/terraform.tfstate) + + for service in bootkube openshift kubelet crio + do + curl \ + --insecure \ + --silent \ + --cert=/tmp/artifacts/tls/journal-gatewayd.crt \ + --key=/tmp/artifacts/tls/journal-gatewayd.key \ + --url="https://${bootstrap_ip}:19531/entries?_SYSTEMD_UNIT=${service}.service" \ + --output="/tmp/artifacts/installer/${service}.service" + done + + exit "${rc}" + fi # Performs cleanup of all created resources - name: teardown