Collect k8s data on post job

Change-Id: Iee1be3ed424e76645ec0606cd33bee5f8a47a569
This commit is contained in:
Flavio Percoco 2017-11-02 15:32:11 +01:00
parent 2ce041d884
commit c4e0bb20ce
1 changed files with 13 additions and 3 deletions

View File

@ -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