Merge pull request #35081 from ixdy/cluster-gce-red-herrings

Automatic merge from submit-queue

Remove several red herring error messages in GCE cluster scripts

This fixes things like

```
I1018 15:57:53.524] Bringing down cluster
W1018 15:57:53.524] NODE_NAMES=
W1018 15:57:55.995] ERROR: (gcloud.compute.ssh) could not parse resource: []
W1018 15:57:56.392] ERROR: (gcloud.compute.ssh) could not parse resource: []
```

and

```
I1018 16:32:34.947] property "clusters.kubernetes-pr-cri-validation_cri-e2e-gce-agent-pr-25-0" unset.
I1018 16:32:35.079] property "users.kubernetes-pr-cri-validation_cri-e2e-gce-agent-pr-25-0" unset.
I1018 16:32:35.195] property "users.kubernetes-pr-cri-validation_cri-e2e-gce-agent-pr-25-0-basic-auth" unset.
I1018 16:32:35.307] property "contexts.kubernetes-pr-cri-validation_cri-e2e-gce-agent-pr-25-0" unset.
W1018 16:32:35.420] failed to get client config: Error in configuration: context was not found for specified context: kubernetes-pr-cri-validation_cri-e2e-gce-agent-pr-25-0
```

It seems like the `kubectl` behavior was introduced in #29236: if `current-context` is set to something invalid, it now complains.
pull/6/head
Kubernetes Submit Queue 2016-11-04 07:04:04 -07:00 committed by GitHub
commit 921245c828
2 changed files with 7 additions and 6 deletions

View File

@ -147,15 +147,15 @@ function clear-kubeconfig() {
fi fi
local kubectl="${KUBE_ROOT}/cluster/kubectl.sh" local kubectl="${KUBE_ROOT}/cluster/kubectl.sh"
"${kubectl}" config unset "clusters.${CONTEXT}" # Unset the current-context before we delete it, as otherwise kubectl errors.
"${kubectl}" config unset "users.${CONTEXT}"
"${kubectl}" config unset "users.${CONTEXT}-basic-auth"
"${kubectl}" config unset "contexts.${CONTEXT}"
local cc=$("${kubectl}" config view -o jsonpath='{.current-context}') local cc=$("${kubectl}" config view -o jsonpath='{.current-context}')
if [[ "${cc}" == "${CONTEXT}" ]]; then if [[ "${cc}" == "${CONTEXT}" ]]; then
"${kubectl}" config unset current-context "${kubectl}" config unset current-context
fi fi
"${kubectl}" config unset "clusters.${CONTEXT}"
"${kubectl}" config unset "users.${CONTEXT}"
"${kubectl}" config unset "users.${CONTEXT}-basic-auth"
"${kubectl}" config unset "contexts.${CONTEXT}"
echo "Cleared config for ${CONTEXT} from ${KUBECONFIG}" echo "Cleared config for ${CONTEXT} from ${KUBECONFIG}"
} }

View File

@ -277,7 +277,7 @@ function upload-server-tars() {
local staging_bucket="gs://kubernetes-staging-${project_hash}${suffix}" local staging_bucket="gs://kubernetes-staging-${project_hash}${suffix}"
# Ensure the buckets are created # Ensure the buckets are created
if ! gsutil ls "${staging_bucket}" ; then if ! gsutil ls "${staging_bucket}" >/dev/null; then
echo "Creating ${staging_bucket}" echo "Creating ${staging_bucket}"
gsutil mb -l "${region}" "${staging_bucket}" gsutil mb -l "${region}" "${staging_bucket}"
fi fi
@ -1167,6 +1167,7 @@ function check-cluster() {
# returns the result of ssh command which removes replica # returns the result of ssh command which removes replica
function remove-replica-from-etcd() { function remove-replica-from-etcd() {
local -r port="${1}" local -r port="${1}"
[[ -n "${EXISTING_MASTER_NAME}" ]] || return
gcloud compute ssh "${EXISTING_MASTER_NAME}" \ gcloud compute ssh "${EXISTING_MASTER_NAME}" \
--project "${PROJECT}" \ --project "${PROJECT}" \
--zone "${EXISTING_MASTER_ZONE}" \ --zone "${EXISTING_MASTER_ZONE}" \