From 98d6b454f309d1b22cf5f0791d91970ef49e15a0 Mon Sep 17 00:00:00 2001 From: deads2k Date: Wed, 15 Jul 2015 15:53:29 -0400 Subject: [PATCH] pass along status errors for upgrades --- pkg/util/httpstream/spdy/roundtripper.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/util/httpstream/spdy/roundtripper.go b/pkg/util/httpstream/spdy/roundtripper.go index e5954b1712e..44b5aa0b36e 100644 --- a/pkg/util/httpstream/spdy/roundtripper.go +++ b/pkg/util/httpstream/spdy/roundtripper.go @@ -25,6 +25,8 @@ import ( "net/http" "strings" + "github.com/GoogleCloudPlatform/kubernetes/pkg/api" + apierrors "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" "github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream" "github.com/GoogleCloudPlatform/kubernetes/third_party/golang/netutil" ) @@ -137,6 +139,11 @@ func (s *SpdyRoundTripper) NewConnection(resp *http.Response) (httpstream.Connec if err != nil { responseError = "Unable to read error from server response" } else { + if obj, err := api.Scheme.Decode(responseErrorBytes); err == nil { + if status, ok := obj.(*api.Status); ok { + return nil, &apierrors.StatusError{*status} + } + } responseError = string(responseErrorBytes) }