mirror of https://github.com/k3s-io/k3s
Merge pull request #52489 from verb/e2e-gce-master
Automatic merge from submit-queue (batch tested with PRs 53051, 52489, 53920). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Test gcloud exit status when detecting master for GCE e2e test e2e tests exit on error, so without testing the exit status of a command its scripted error message will never be printed. **What this PR does / why we need it**: This prints the intended "could not detect Kubernetes master" error message instead of a stack trace from e2e test **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #52474 **Special notes for your reviewer**: **Release note**: ```release-note NONE ```pull/6/head
commit
f816e75b53
|
@ -401,12 +401,12 @@ function detect-master() {
|
|||
if [[ -z "${KUBE_MASTER_IP-}" ]]; then
|
||||
local master_address_name="${MASTER_NAME}-ip"
|
||||
echo "Looking for address '${master_address_name}'" >&2
|
||||
KUBE_MASTER_IP=$(gcloud compute addresses describe "${master_address_name}" \
|
||||
--project "${PROJECT}" --region "${REGION}" -q --format='value(address)')
|
||||
fi
|
||||
if [[ -z "${KUBE_MASTER_IP-}" ]]; then
|
||||
echo "Could not detect Kubernetes master node. Make sure you've launched a cluster with 'kube-up.sh'" >&2
|
||||
exit 1
|
||||
if ! KUBE_MASTER_IP=$(gcloud compute addresses describe "${master_address_name}" \
|
||||
--project "${PROJECT}" --region "${REGION}" -q --format='value(address)') || \
|
||||
[[ -z "${KUBE_MASTER_IP-}" ]]; then
|
||||
echo "Could not detect Kubernetes master node. Make sure you've launched a cluster with 'kube-up.sh'" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo "Using master: $KUBE_MASTER (external IP: $KUBE_MASTER_IP)" >&2
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue