From c4e0bb20ce52900a0e1726ec2f52aeacab7fc892 Mon Sep 17 00:00:00 2001 From: Flavio Percoco Date: Thu, 2 Nov 2017 15:32:11 +0100 Subject: [PATCH] Collect k8s data on post job Change-Id: Iee1be3ed424e76645ec0606cd33bee5f8a47a569 --- tests/get_logs.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/get_logs.sh b/tests/get_logs.sh index beea391..6eb2079 100644 --- a/tests/get_logs.sh +++ b/tests/get_logs.sh @@ -25,7 +25,10 @@ copy_logs() { cp -rvnL $HOME/.ansible/* ${LOG_DIR}/ansible/ fi + # Backup etc cp -rvnL /etc ${LOG_DIR}/ + cp /etc/sudoers ${LOG_DIR}/etc/sudoers.txt + cp -rvnL /var/log/* ${LOG_DIR}/system_logs/ cp -rvnL /tmp/kubespray ${LOG_DIR}/ @@ -37,9 +40,6 @@ copy_logs() { cp /var/log/upstart/docker.log ${LOG_DIR}/system_logs/docker.log fi - cp -r /etc/sudoers.d ${LOG_DIR}/system_logs/ - cp /etc/sudoers ${LOG_DIR}/system_logs/sudoers.txt - df -h > ${LOG_DIR}/system_logs/df.txt free > ${LOG_DIR}/system_logs/free.txt parted -l > ${LOG_DIR}/system_logs/parted-l.txt @@ -65,6 +65,16 @@ copy_logs() { done fi + + if [ `command -v kubectl` ]; then + if [ `command -v oc` ]; then + oc login -u system:admin + fi + + (kubectl version && kubectl cluster-info dump && kubectl config view) > ${LOG_DIR}/system_logs/k8s-info.txt 2>&1 + kubectl describe all --all-namespaces > ${LOG_DIR}/system_logs/k8s-describe-all.txt 2>&1 + fi + # Rename files to .txt; this is so that when displayed via # logs.openstack.org clicking results in the browser shows the # files, rather than trying to send it to another app or make you