Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save the master logs to separate files rather than dumping to stdout. #21183

Merged
merged 1 commit into from
Feb 16, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 18 additions & 9 deletions cluster/gce/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -745,16 +745,25 @@ function check-cluster() {
if [[ ${elapsed} -gt ${KUBE_CLUSTER_INITIALIZATION_TIMEOUT} ]]; then
echo -e "${color_red}Cluster failed to initialize within ${KUBE_CLUSTER_INITIALIZATION_TIMEOUT} seconds.${color_norm}" >&2
if [[ ${KUBE_TEST_DEBUG-} =~ ^[yY]$ ]]; then
local tmp_log="$(mktemp)"
local file
for file in /var/log/startupscript.log /var/log/kube-apiserver.log; do
echo "${MASTER_NAME}:${file} contents:"
if gcloud compute copy-files --project "${PROJECT}" \
--zone "${ZONE}" "${MASTER_NAME}:${file}" "${tmp_log}"; then
cat "${tmp_log}"
fi
local savedir="${E2E_REPORT_DIR-}"
if [[ -z "${savedir}" ]]; then
savedir="$(mktemp -t -d k8s-e2e.XXX)"
fi
echo "Preserving master logs in ${savedir}"
local logdir=/var/log
local basename
for basename in startupscript kube-apiserver; do
# TODO(mml): Perhaps revisit how we name logs for preservation and
# centralize an implementation. Options include putting basename
# before hostname and including a timestamp.
local src="${logdir}/${basename}.log"
local dst="${savedir}/${MASTER_NAME}-${basename}.log"
echo "Copying ${MASTER_NAME}:${src}"
gcloud compute copy-files \
--project "${PROJECT}" --zone "${ZONE}" \
"${MASTER_NAME}:${src}" "${dst}" \
|| true
done
rm -f "${tmp_log}"
fi
exit 2
fi
Expand Down