mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-11 14:11:14 +00:00
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.
This commit is contained in:
@@ -147,15 +147,15 @@ function clear-kubeconfig() {
|
||||
fi
|
||||
|
||||
local kubectl="${KUBE_ROOT}/cluster/kubectl.sh"
|
||||
"${kubectl}" config unset "clusters.${CONTEXT}"
|
||||
"${kubectl}" config unset "users.${CONTEXT}"
|
||||
"${kubectl}" config unset "users.${CONTEXT}-basic-auth"
|
||||
"${kubectl}" config unset "contexts.${CONTEXT}"
|
||||
|
||||
# Unset the current-context before we delete it, as otherwise kubectl errors.
|
||||
local cc=$("${kubectl}" config view -o jsonpath='{.current-context}')
|
||||
if [[ "${cc}" == "${CONTEXT}" ]]; then
|
||||
"${kubectl}" config unset current-context
|
||||
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}"
|
||||
}
|
||||
|
Reference in New Issue
Block a user