mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
Merge pull request #11333 from deads2k/passthrough-errors
pass along status errors for upgrades
This commit is contained in:
commit
d6796ecd38
@ -25,6 +25,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"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/pkg/util/httpstream"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/third_party/golang/netutil"
|
"github.com/GoogleCloudPlatform/kubernetes/third_party/golang/netutil"
|
||||||
)
|
)
|
||||||
@ -137,6 +139,11 @@ func (s *SpdyRoundTripper) NewConnection(resp *http.Response) (httpstream.Connec
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
responseError = "unable to read error from server response"
|
responseError = "unable to read error from server response"
|
||||||
} else {
|
} 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)
|
responseError = string(responseErrorBytes)
|
||||||
responseError = strings.TrimSpace(responseError)
|
responseError = strings.TrimSpace(responseError)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user