mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 05:03:09 +00:00
remove httpstream dependency on pkg/api
This commit is contained in:
parent
674d78b2ab
commit
7897ea8c28
@ -20,8 +20,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type responseWriter struct {
|
type responseWriter struct {
|
||||||
@ -120,7 +118,7 @@ func TestHandshake(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// verify response headers
|
// verify response headers
|
||||||
if e, a := []string{test.expectedProtocol}, w.Header()[HeaderProtocolVersion]; !api.Semantic.DeepEqual(e, a) {
|
if e, a := []string{test.expectedProtocol}, w.Header()[HeaderProtocolVersion]; !reflect.DeepEqual(e, a) {
|
||||||
t.Errorf("%s: protocol response header: expected %v, got %v", name, e, a)
|
t.Errorf("%s: protocol response header: expected %v, got %v", name, e, a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,10 @@ import (
|
|||||||
|
|
||||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||||
"k8s.io/apimachinery/pkg/util/httpstream"
|
"k8s.io/apimachinery/pkg/util/httpstream"
|
||||||
"k8s.io/apimachinery/third_party/forked/golang/netutil"
|
"k8s.io/apimachinery/third_party/forked/golang/netutil"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// SpdyRoundTripper knows how to upgrade an HTTP request to one that supports
|
// SpdyRoundTripper knows how to upgrade an HTTP request to one that supports
|
||||||
@ -251,7 +252,7 @@ func (s *SpdyRoundTripper) NewConnection(resp *http.Response) (httpstream.Connec
|
|||||||
responseError = "unable to read error from server response"
|
responseError = "unable to read error from server response"
|
||||||
} else {
|
} else {
|
||||||
// TODO: I don't belong here, I should be abstracted from this class
|
// TODO: I don't belong here, I should be abstracted from this class
|
||||||
if obj, _, err := api.Codecs.UniversalDecoder().Decode(responseErrorBytes, nil, &metav1.Status{}); err == nil {
|
if obj, _, err := statusCodecs.UniversalDecoder().Decode(responseErrorBytes, nil, &metav1.Status{}); err == nil {
|
||||||
if status, ok := obj.(*metav1.Status); ok {
|
if status, ok := obj.(*metav1.Status); ok {
|
||||||
return nil, &apierrors.StatusError{ErrStatus: *status}
|
return nil, &apierrors.StatusError{ErrStatus: *status}
|
||||||
}
|
}
|
||||||
@ -265,3 +266,15 @@ func (s *SpdyRoundTripper) NewConnection(resp *http.Response) (httpstream.Connec
|
|||||||
|
|
||||||
return NewClientConnection(s.conn)
|
return NewClientConnection(s.conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// statusScheme is private scheme for the decoding here until someone fixes the TODO in NewConnection
|
||||||
|
var statusScheme = runtime.NewScheme()
|
||||||
|
|
||||||
|
// ParameterCodec knows about query parameters used with the meta v1 API spec.
|
||||||
|
var statusCodecs = serializer.NewCodecFactory(statusScheme)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
statusScheme.AddUnversionedTypes(metav1.SchemeGroupVersion,
|
||||||
|
&metav1.Status{},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
4
vendor/BUILD
vendored
4
vendor/BUILD
vendored
@ -13827,7 +13827,6 @@ go_test(
|
|||||||
srcs = ["k8s.io/apimachinery/pkg/util/httpstream/httpstream_test.go"],
|
srcs = ["k8s.io/apimachinery/pkg/util/httpstream/httpstream_test.go"],
|
||||||
library = ":k8s.io/apimachinery/pkg/util/httpstream",
|
library = ":k8s.io/apimachinery/pkg/util/httpstream",
|
||||||
tags = ["automanaged"],
|
tags = ["automanaged"],
|
||||||
deps = ["//pkg/api:go_default_library"],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
@ -13863,11 +13862,12 @@ go_library(
|
|||||||
],
|
],
|
||||||
tags = ["automanaged"],
|
tags = ["automanaged"],
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/api:go_default_library",
|
|
||||||
"//vendor:github.com/docker/spdystream",
|
"//vendor:github.com/docker/spdystream",
|
||||||
"//vendor:github.com/golang/glog",
|
"//vendor:github.com/golang/glog",
|
||||||
"//vendor:k8s.io/apimachinery/pkg/api/errors",
|
"//vendor:k8s.io/apimachinery/pkg/api/errors",
|
||||||
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||||
|
"//vendor:k8s.io/apimachinery/pkg/runtime",
|
||||||
|
"//vendor:k8s.io/apimachinery/pkg/runtime/serializer",
|
||||||
"//vendor:k8s.io/apimachinery/pkg/util/httpstream",
|
"//vendor:k8s.io/apimachinery/pkg/util/httpstream",
|
||||||
"//vendor:k8s.io/apimachinery/pkg/util/runtime",
|
"//vendor:k8s.io/apimachinery/pkg/util/runtime",
|
||||||
"//vendor:k8s.io/apimachinery/third_party/forked/golang/netutil",
|
"//vendor:k8s.io/apimachinery/third_party/forked/golang/netutil",
|
||||||
|
Loading…
Reference in New Issue
Block a user