From 5e3eb38791b25fca62290111b3936325958f1a56 Mon Sep 17 00:00:00 2001 From: Antoine Pelisse Date: Thu, 28 Sep 2017 15:58:53 -0700 Subject: [PATCH] kubectl: Remove swagger 1.2 entirely. Kubernetes-commit: d1ce36371e637f159256f1f43e3590926ff906d5 --- Godeps/Godeps.json | 154 ++++++++++++++--------------- discovery/BUILD | 3 - discovery/cached/BUILD | 2 - discovery/cached/memcache.go | 6 -- discovery/discovery_client.go | 44 --------- discovery/discovery_client_test.go | 64 ------------ discovery/fake/BUILD | 2 - discovery/fake/discovery.go | 15 --- discovery/restmapper_test.go | 5 - 9 files changed, 75 insertions(+), 220 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 2c78409bcf..8216e65bdd 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -90,10 +90,6 @@ "ImportPath": "github.com/emicklei/go-restful", "Rev": "ff4f55a206334ef123e4f79bbf348980da81ca46" }, - { - "ImportPath": "github.com/emicklei/go-restful-swagger12", - "Rev": "dcef7f55730566d41eae5db10e7d6981829720f6" - }, { "ImportPath": "github.com/emicklei/go-restful/log", "Rev": "ff4f55a206334ef123e4f79bbf348980da81ca46" @@ -376,303 +372,303 @@ }, { "ImportPath": "k8s.io/api/admissionregistration/v1alpha1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/apps/v1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/apps/v1beta1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/apps/v1beta2", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/authentication/v1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/authentication/v1beta1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/authorization/v1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/authorization/v1beta1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/autoscaling/v1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/autoscaling/v2beta1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/batch/v1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/batch/v1beta1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/batch/v2alpha1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/certificates/v1beta1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/core/v1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/extensions/v1beta1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/imagepolicy/v1alpha1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/networking/v1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/policy/v1beta1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/rbac/v1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/rbac/v1alpha1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/rbac/v1beta1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/scheduling/v1alpha1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/settings/v1alpha1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/storage/v1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/api/storage/v1beta1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/api/equality", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/api/errors", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/api/meta", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/api/resource", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/apimachinery", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/apimachinery/registered", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1alpha1", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/conversion", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/conversion/unstructured", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/fields", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/labels", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/runtime", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/runtime/schema", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/selection", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/types", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/cache", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/clock", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/diff", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/errors", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/framer", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/httpstream", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/intstr", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/json", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/net", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/runtime", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/sets", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/validation", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/validation/field", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/wait", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/yaml", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/version", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/pkg/watch", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect", - "Rev": "8d40e6005e31a17866bebd03144e825f9e61bd52" + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "ImportPath": "k8s.io/kube-openapi/pkg/common", diff --git a/discovery/BUILD b/discovery/BUILD index 81135dded8..1092826968 100644 --- a/discovery/BUILD +++ b/discovery/BUILD @@ -15,11 +15,9 @@ go_library( "unstructured.go", ], deps = [ - "//vendor/github.com/emicklei/go-restful-swagger12:go_default_library", "//vendor/github.com/golang/glog:go_default_library", "//vendor/github.com/golang/protobuf/proto:go_default_library", "//vendor/github.com/googleapis/gnostic/OpenAPIv2:go_default_library", - "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", @@ -41,7 +39,6 @@ go_test( "restmapper_test.go", ], deps = [ - "//vendor/github.com/emicklei/go-restful-swagger12:go_default_library", "//vendor/github.com/gogo/protobuf/proto:go_default_library", "//vendor/github.com/googleapis/gnostic/OpenAPIv2:go_default_library", "//vendor/github.com/stretchr/testify/assert:go_default_library", diff --git a/discovery/cached/BUILD b/discovery/cached/BUILD index a1d030d4de..0e35f4223b 100644 --- a/discovery/cached/BUILD +++ b/discovery/cached/BUILD @@ -20,10 +20,8 @@ go_library( name = "go_default_library", srcs = ["memcache.go"], deps = [ - "//vendor/github.com/emicklei/go-restful-swagger12:go_default_library", "//vendor/github.com/googleapis/gnostic/OpenAPIv2:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", - "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/version:go_default_library", "//vendor/k8s.io/client-go/discovery:go_default_library", diff --git a/discovery/cached/memcache.go b/discovery/cached/memcache.go index 7489a5bbf1..585b4c80da 100644 --- a/discovery/cached/memcache.go +++ b/discovery/cached/memcache.go @@ -21,11 +21,9 @@ import ( "fmt" "sync" - "github.com/emicklei/go-restful-swagger12" "github.com/googleapis/gnostic/OpenAPIv2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/version" "k8s.io/client-go/discovery" @@ -116,10 +114,6 @@ func (d *memCacheClient) ServerVersion() (*version.Info, error) { return d.delegate.ServerVersion() } -func (d *memCacheClient) SwaggerSchema(version schema.GroupVersion) (*swagger.ApiDeclaration, error) { - return d.delegate.SwaggerSchema(version) -} - func (d *memCacheClient) OpenAPISchema() (*openapi_v2.Document, error) { return d.delegate.OpenAPISchema() } diff --git a/discovery/discovery_client.go b/discovery/discovery_client.go index 59c6968098..26319f4946 100644 --- a/discovery/discovery_client.go +++ b/discovery/discovery_client.go @@ -23,11 +23,9 @@ import ( "sort" "strings" - "github.com/emicklei/go-restful-swagger12" "github.com/golang/protobuf/proto" "github.com/googleapis/gnostic/OpenAPIv2" - "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -48,7 +46,6 @@ type DiscoveryInterface interface { ServerGroupsInterface ServerResourcesInterface ServerVersionInterface - SwaggerSchemaInterface OpenAPISchemaInterface } @@ -92,12 +89,6 @@ type ServerVersionInterface interface { ServerVersion() (*version.Info, error) } -// SwaggerSchemaInterface has a method to retrieve the swagger schema. -type SwaggerSchemaInterface interface { - // SwaggerSchema retrieves and parses the swagger API schema the server supports. - SwaggerSchema(version schema.GroupVersion) (*swagger.ApiDeclaration, error) -} - // OpenAPISchemaInterface has a method to retrieve the open API schema. type OpenAPISchemaInterface interface { // OpenAPISchema retrieves and parses the swagger API schema the server supports. @@ -336,41 +327,6 @@ func (d *DiscoveryClient) ServerVersion() (*version.Info, error) { return &info, nil } -// SwaggerSchema retrieves and parses the swagger API schema the server supports. -// TODO: Replace usages with Open API. Tracked in https://github.com/kubernetes/kubernetes/issues/44589 -func (d *DiscoveryClient) SwaggerSchema(version schema.GroupVersion) (*swagger.ApiDeclaration, error) { - if version.Empty() { - return nil, fmt.Errorf("groupVersion cannot be empty") - } - - groupList, err := d.ServerGroups() - if err != nil { - return nil, err - } - groupVersions := metav1.ExtractGroupVersions(groupList) - // This check also takes care the case that kubectl is newer than the running endpoint - if stringDoesntExistIn(version.String(), groupVersions) { - return nil, fmt.Errorf("API version: %v is not supported by the server. Use one of: %v", version, groupVersions) - } - var path string - if len(d.LegacyPrefix) > 0 && version == v1.SchemeGroupVersion { - path = "/swaggerapi" + d.LegacyPrefix + "/" + version.Version - } else { - path = "/swaggerapi/apis/" + version.Group + "/" + version.Version - } - - body, err := d.restClient.Get().AbsPath(path).Do().Raw() - if err != nil { - return nil, err - } - var schema swagger.ApiDeclaration - err = json.Unmarshal(body, &schema) - if err != nil { - return nil, fmt.Errorf("got '%s': %v", string(body), err) - } - return &schema, nil -} - // OpenAPISchema fetches the open api schema using a rest client and parses the proto. func (d *DiscoveryClient) OpenAPISchema() (*openapi_v2.Document, error) { data, err := d.restClient.Get().AbsPath("/swagger-2.0.0.pb-v1").Do().Raw() diff --git a/discovery/discovery_client_test.go b/discovery/discovery_client_test.go index e0c908ee39..409add2bf7 100644 --- a/discovery/discovery_client_test.go +++ b/discovery/discovery_client_test.go @@ -25,11 +25,9 @@ import ( "reflect" "testing" - "github.com/emicklei/go-restful-swagger12" "github.com/gogo/protobuf/proto" "github.com/googleapis/gnostic/OpenAPIv2" - "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/sets" @@ -267,68 +265,6 @@ func TestGetServerResources(t *testing.T) { } } -func swaggerSchemaFakeServer() (*httptest.Server, error) { - request := 1 - var sErr error - - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - var resp interface{} - if request == 1 { - resp = metav1.APIVersions{Versions: []string{"v1", "v2", "v3"}} - request++ - } else { - resp = swagger.ApiDeclaration{} - } - output, err := json.Marshal(resp) - if err != nil { - sErr = err - return - } - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - w.Write(output) - })) - return server, sErr -} - -func TestGetSwaggerSchema(t *testing.T) { - expect := swagger.ApiDeclaration{} - - server, err := swaggerSchemaFakeServer() - if err != nil { - t.Errorf("unexpected encoding error: %v", err) - } - defer server.Close() - - client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL}) - got, err := client.SwaggerSchema(v1.SchemeGroupVersion) - if err != nil { - t.Fatalf("unexpected encoding error: %v", err) - } - if e, a := expect, *got; !reflect.DeepEqual(e, a) { - t.Errorf("expected %v, got %v", e, a) - } -} - -func TestGetSwaggerSchemaFail(t *testing.T) { - expErr := "API version: api.group/v4 is not supported by the server. Use one of: [v1 v2 v3]" - - server, err := swaggerSchemaFakeServer() - if err != nil { - t.Errorf("unexpected encoding error: %v", err) - } - defer server.Close() - - client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL}) - got, err := client.SwaggerSchema(schema.GroupVersion{Group: "api.group", Version: "v4"}) - if got != nil { - t.Fatalf("unexpected response: %v", got) - } - if err.Error() != expErr { - t.Errorf("expected an error, got %v", err) - } -} - var returnedOpenAPI = openapi_v2.Document{ Definitions: &openapi_v2.Definitions{ AdditionalProperties: []*openapi_v2.NamedSchema{ diff --git a/discovery/fake/BUILD b/discovery/fake/BUILD index b467202e84..8c190f86f0 100644 --- a/discovery/fake/BUILD +++ b/discovery/fake/BUILD @@ -10,9 +10,7 @@ go_library( name = "go_default_library", srcs = ["discovery.go"], deps = [ - "//vendor/github.com/emicklei/go-restful-swagger12:go_default_library", "//vendor/github.com/googleapis/gnostic/OpenAPIv2:go_default_library", - "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", "//vendor/k8s.io/apimachinery/pkg/version:go_default_library", diff --git a/discovery/fake/discovery.go b/discovery/fake/discovery.go index 0b757ad4ee..13ccebfa74 100644 --- a/discovery/fake/discovery.go +++ b/discovery/fake/discovery.go @@ -19,10 +19,8 @@ package fake import ( "fmt" - "github.com/emicklei/go-restful-swagger12" "github.com/googleapis/gnostic/OpenAPIv2" - "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/version" @@ -87,19 +85,6 @@ func (c *FakeDiscovery) ServerVersion() (*version.Info, error) { return &versionInfo, nil } -func (c *FakeDiscovery) SwaggerSchema(version schema.GroupVersion) (*swagger.ApiDeclaration, error) { - action := testing.ActionImpl{} - action.Verb = "get" - if version == v1.SchemeGroupVersion { - action.Resource = schema.GroupVersionResource{Resource: "/swaggerapi/api/" + version.Version} - } else { - action.Resource = schema.GroupVersionResource{Resource: "/swaggerapi/apis/" + version.Group + "/" + version.Version} - } - - c.Invokes(action, nil) - return &swagger.ApiDeclaration{}, nil -} - func (c *FakeDiscovery) OpenAPISchema() (*openapi_v2.Document, error) { return &openapi_v2.Document{}, nil } diff --git a/discovery/restmapper_test.go b/discovery/restmapper_test.go index f2956be3bc..69ee7e6864 100644 --- a/discovery/restmapper_test.go +++ b/discovery/restmapper_test.go @@ -28,7 +28,6 @@ import ( restclient "k8s.io/client-go/rest" "k8s.io/client-go/rest/fake" - "github.com/emicklei/go-restful-swagger12" "github.com/googleapis/gnostic/OpenAPIv2" "github.com/stretchr/testify/assert" ) @@ -380,10 +379,6 @@ func (c *fakeCachedDiscoveryInterface) ServerVersion() (*version.Info, error) { return &version.Info{}, nil } -func (c *fakeCachedDiscoveryInterface) SwaggerSchema(version schema.GroupVersion) (*swagger.ApiDeclaration, error) { - return &swagger.ApiDeclaration{}, nil -} - func (c *fakeCachedDiscoveryInterface) OpenAPISchema() (*openapi_v2.Document, error) { return &openapi_v2.Document{}, nil }