From ed033153ea4eb15ed0452d7a5f35a72665e05cc6 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Mon, 23 Nov 2020 15:44:39 +0100 Subject: [PATCH] ci: gather logs when deploying Rook fails Log a few commands that help troubleshooting Rook deployment issues. This might need to get extended with more commands. Updates: #1636 Signed-off-by: Niels de Vos --- scripts/rook.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/scripts/rook.sh b/scripts/rook.sh index 9791cd191..7ee117002 100755 --- a/scripts/rook.sh +++ b/scripts/rook.sh @@ -1,4 +1,4 @@ -#!/bin/bash -e +#!/bin/bash -E ROOK_VERSION=${ROOK_VERSION:-"v1.2.7"} ROOK_DEPLOY_TIMEOUT=${ROOK_DEPLOY_TIMEOUT:-300} @@ -8,6 +8,25 @@ ROOK_CEPH_CLUSTER_VERSION="v14.2.10" KUBECTL_RETRY=5 KUBECTL_RETRY_DELAY=10 +trap log_errors ERR + +# log_errors is called on exit (see 'trap' above) and tries to provide +# sufficient information to debug deployment problems +function log_errors() { + # enable verbose execution + set -x + kubectl get nodes + kubectl -n rook-ceph get events + kubectl -n rook-ceph describe pods + kubectl -n rook-ceph logs -l app=rook-ceph-operator + kubectl -n rook-ceph get CephClusters -oyaml + kubectl -n rook-ceph get CephFilesystems -oyaml + kubectl -n rook-ceph get CephBlockPools -oyaml + + # this function should not return, a fatal error was caught! + exit 1 +} + rook_version() { echo "${ROOK_VERSION#v}" | cut -d'.' -f"${1}" }