From 9aebae2f6a1a0fcb393dc8d3e17899800883d44a Mon Sep 17 00:00:00 2001 From: Chao Xu Date: Sat, 6 Feb 2021 19:55:26 +0000 Subject: [PATCH] make proxy Transport return metav1.Status error --- staging/src/k8s.io/apimachinery/pkg/util/proxy/transport.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/staging/src/k8s.io/apimachinery/pkg/util/proxy/transport.go b/staging/src/k8s.io/apimachinery/pkg/util/proxy/transport.go index cf8023da783..28c654676ee 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/proxy/transport.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/proxy/transport.go @@ -32,6 +32,7 @@ import ( "golang.org/x/net/html/atom" "k8s.io/klog/v2" + "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/util/net" "k8s.io/apimachinery/pkg/util/sets" ) @@ -101,7 +102,7 @@ func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) { resp, err := rt.RoundTrip(req) if err != nil { - return nil, fmt.Errorf("error trying to reach service: %w", err) + return nil, errors.NewServiceUnavailable(fmt.Sprintf("error trying to reach service: %v", err)) } if redirect := resp.Header.Get("Location"); redirect != "" {