Dump all CP node logs to artifacts

This commit is contained in:
Ole Markus With 2021-05-27 22:08:44 +02:00
parent 26309f0016
commit 80d706b0c4
1 changed files with 11 additions and 1 deletions

View File

@ -46,10 +46,20 @@ KOPS="${FIRST_KOPS}"
# Always tear-down the cluster when we're done
function finish {
${KUBETEST2} --kops-binary-path="${KOPS}" --down || echo "kubetest2 down failed"
KOPS_LOG_DIR="${ARTIFACTS}/logs"
mkdir -p "${KOPS_LOG_DIR}"
KOPS_CP=$(${KOPS} toolbox dump -o json | jq -r '.instances[] | select( .roles | index("master" )) | .publicAddresses[0]')
ssh -i "${AWS_SSH_PRIVATE_KEY_FILE}" "ubuntu@${KOPS_CP}" sudo chmod -R a+r /var/log
scp -i "${AWS_SSH_PRIVATE_KEY_FILE}" -r "ubuntu@${KOPS_CP}:/var/log/" "${KOPS_LOG_DIR}"
${KUBETEST2} --kops-binary-path="${KOPS}" --down || echo "kubetest2 down failed"
}
trap finish EXIT
${KUBETEST2} \
--up \
--kubernetes-version="${K8S_VERSION}" \