Repository: istio/istio (go)

Issue:
istioctl x precheck yields Error
**Bug description**

The downloadIstio script was used to pull the 1.10-alpha.0 release. At the end of the script it says to:
```
Begin the Istio pre-installation check by running:
	 istioctl x precheck
```
which for me yields the error:
```
Error: Get "http://localhost:8080/version?timeout=32s": dial tcp [::1]:8080: connect: connection refused
```


[ ] Docs
[x] Installation
[ ] Networking
[ ] Performance and Scalability
[ ] Extensions and Telemetry
[ ] Security
[ ] Test and Release
[x] User Experience
[ ] Developer Infrastructure
[ ] Upgrade



**Expected behavior**

I should not receive an error when running the specified pre-installation check

**Steps to reproduce the bug**
- curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.10.0-alpha.0 sh -
- istio-1.10.0-alpha.0/bin/istioctl x precheck

**Version** (include the output of `istioctl version --remote` and `kubectl version --short` and `helm version --short` if you used Helm)

1.10.0-alpha.0

**How was Istio installed?**

At this point, it isn't.

**Environment where the bug was observed (cloud vendor, OS, etc)**

MacOS

Additionally, please consider running `istioctl bug-report` and attach the generated cluster-state tarball to this issue.
Refer [cluster state archive](http://istio.io/help/bugs/#generating-a-cluster-state-archive) for more details.

Pull request description:
Improve error msg of istioctl x precheck
Closes #32119
Improve error message when istioctl x precheck could not connect to K8s cluster.
Suggest reviewer: @howardjohn

[ ] Configuration Infrastructure
[ ] Docs
[ ] Installation
[ ] Networking
[ ] Performance and Scalability
[ ] Policies and Telemetry
[ ] Security
[ ] Test and Release
[X] User Experience
[ ] Developer Infrastructure


Patch:
diff --git a/common/.commonfiles.sha b/common/.commonfiles.sha
index a5c3077660..d437ce8978 100644
--- a/common/.commonfiles.sha
+++ b/common/.commonfiles.sha
@@ -1,1 +1,1 @@
-be84ab6f0e67d00b6a92d3497197b4ed9ba72ddc
+8e44206d196617bc0913cac55899d5ba48a0f719
diff --git a/common/scripts/setup_env.sh b/common/scripts/setup_env.sh
index c963ff0d2d..a83fc08a95 100755
--- a/common/scripts/setup_env.sh
+++ b/common/scripts/setup_env.sh
@@ -63,7 +63,7 @@ fi
 
 # Build image to use
 if [[ "${IMAGE_VERSION:-}" == "" ]]; then
-  export IMAGE_VERSION=master-2021-05-27T17-28-48
+  export IMAGE_VERSION=master-2021-05-28T13-51-57
 fi
 if [[ "${IMAGE_NAME:-}" == "" ]]; then
   export IMAGE_NAME=build-tools
diff --git a/go.mod b/go.mod
index 6ebc6fe02a..28643d66b9 100644
--- a/go.mod
+++ b/go.mod
@@ -91,10 +91,10 @@ require (
 	gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
 	helm.sh/helm/v3 v3.5.3
 	honnef.co/go/tools v0.0.1-2020.1.5 // indirect
-	istio.io/api v0.0.0-20210527204548-4c02bf77abb7
-	istio.io/client-go v0.0.0-20210527210318-b77fb2a4fb33
+	istio.io/api v0.0.0-20210528150623-6009ec604ea0
+	istio.io/client-go v0.0.0-20210528152307-34ae949107ac
 	istio.io/gogo-genproto v0.0.0-20210405163638-fcb891f20a5a
-	istio.io/pkg v0.0.0-20210526005301-f1296438339b
+	istio.io/pkg v0.0.0-20210528151021-2059ed14a0e6
 	k8s.io/api v0.21.0
 	k8s.io/apiextensions-apiserver v0.21.0
 	k8s.io/apimachinery v0.21.0
diff --git a/go.sum b/go.sum
index 59e42d2b5e..b6b56943f7 100644
--- a/go.sum
+++ b/go.sum
@@ -1584,15 +1584,15 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
 honnef.co/go/tools v0.0.1-2020.1.5 h1:nI5egYTGJakVyOryqLs1cQO5dO0ksin5XXs2pspk75k=
 honnef.co/go/tools v0.0.1-2020.1.5/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
-istio.io/api v0.0.0-20210527204548-4c02bf77abb7 h1:px4Ep5vFZAK2YR/HbrLfvlNjB7m9NaOrEELUHemWXug=
-istio.io/api v0.0.0-20210527204548-4c02bf77abb7/go.mod h1:nsSFw1LIMmGL7r/+6fJI6FxeG/UGlLxRK8bkojIvBVs=
-istio.io/client-go v0.0.0-20210527210318-b77fb2a4fb33 h1:l//rURUuB2QxeIaS1biL+mAJ/SCV0Wb0vPv0NYBRlIE=
-istio.io/client-go v0.0.0-20210527210318-b77fb2a4fb33/go.mod h1:qtnr+us+x+v7vnZ55AOXV1ERPnSiPRH6LzOaZoxlE34=
+istio.io/api v0.0.0-20210528150623-6009ec604ea0 h1:9aelNOfan4D/Ao2XfYxfihupZN0cr7lvpnZyguJnN1E=
+istio.io/api v0.0.0-20210528150623-6009ec604ea0/go.mod h1:nsSFw1LIMmGL7r/+6fJI6FxeG/UGlLxRK8bkojIvBVs=
+istio.io/client-go v0.0.0-20210528152307-34ae949107ac h1:sOZES5e6LCbVe94d6+8g1laxSUTLKR5FGNTwq0LmRic=
+istio.io/client-go v0.0.0-20210528152307-34ae949107ac/go.mod h1:r2VBMw9Bvx+ZWAUQ+KEJf017gs16uVYkqMkgVvyrBHY=
 istio.io/gogo-genproto v0.0.0-20210113155706-4daf5697332f/go.mod h1:6BwTZRNbWS570wHX/uR1Wqk5e0157TofTAUMzT7N4+s=
 istio.io/gogo-genproto v0.0.0-20210405163638-fcb891f20a5a h1:e3x86okAVbui7ddsCcuY9r3QjPI/Ulf31lVRfGiGFKM=
 istio.io/gogo-genproto v0.0.0-20210405163638-fcb891f20a5a/go.mod h1:6BwTZRNbWS570wHX/uR1Wqk5e0157TofTAUMzT7N4+s=
-istio.io/pkg v0.0.0-20210526005301-f1296438339b h1:Q8sKdu3ETP2D2IwK/cr0PIw2A59JM85SNnLJSV5pc30=
-istio.io/pkg v0.0.0-20210526005301-f1296438339b/go.mod h1:U14DF4p1AViKhOwpVv1UPEWtknGytJyfJw6hqVi0TmM=
+istio.io/pkg v0.0.0-20210528151021-2059ed14a0e6 h1:gWjGTG7Wz9FljejsOuqM8L+4ENRYPOdHtmN2Yz9Sj1k=
+istio.io/pkg v0.0.0-20210528151021-2059ed14a0e6/go.mod h1:U14DF4p1AViKhOwpVv1UPEWtknGytJyfJw6hqVi0TmM=
 k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78=
 k8s.io/api v0.18.3/go.mod h1:UOaMwERbqJMfeeeHc8XJKawj4P9TgDRnViIqqBeH2QA=
 k8s.io/api v0.18.4/go.mod h1:lOIQAKYgai1+vz9J7YcDZwC26Z0zQewYOGWdyIPUUQ4=
diff --git a/istio.deps b/istio.deps
index ebb9cdfd6f..f56f206965 100644
--- a/istio.deps
+++ b/istio.deps
@@ -4,6 +4,6 @@
     "name": "PROXY_REPO_SHA",
     "repoName": "proxy",
     "file": "",
-    "lastStableSHA": "939db9393f0347796314fd55b313c53625c6830e"
+    "lastStableSHA": "c0616fe7e0f278e3c8bf18eb6758b94d7ee3c237"
   }
 ]
diff --git a/istioctl/cmd/precheck.go b/istioctl/cmd/precheck.go
index e88ae55b59..c3b2dd37e1 100644
--- a/istioctl/cmd/precheck.go
+++ b/istioctl/cmd/precheck.go
@@ -227,7 +227,7 @@ func checkCanCreateResources(c kube.ExtendedClient, namespace, group, version, n
 func checkServerVersion(cli kube.ExtendedClient) (diag.Messages, error) {
 	v, err := cli.GetKubernetesVersion()
 	if err != nil {
-		return nil, err
+		return nil, fmt.Errorf("failed to get the Kubernetes version: %v", err)
 	}
 	compatible, err := k8sversion.CheckKubernetesVersion(v)
 	if err != nil {


Test patch:
diff --git a/pilot/pkg/dns/dns_test.go b/pilot/pkg/dns/dns_test.go
index 03c8d2e89d..4e8261ee1c 100644
--- a/pilot/pkg/dns/dns_test.go
+++ b/pilot/pkg/dns/dns_test.go
@@ -247,8 +247,9 @@ func TestDNS(t *testing.T) {
 							t.Errorf("upstream dns resolution for %s failed: %v", tt.host, res)
 						}
 					} else {
-						if tt.expectResolutionFailure != res.Rcode {
-							t.Errorf("expected resolution failure but it succeeded for %s: %v", tt.host, res)
+						if tt.expectResolutionFailure > 0 && tt.expectResolutionFailure != res.Rcode {
+							t.Errorf("expected resolution failure does not match with response code for %s: expected: %v, got: %v",
+								tt.host, tt.expectResolutionFailure, res.Rcode)
 						}
 						if !equalsDNSrecords(res.Answer, tt.expected) {
 							t.Log(res)