diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 59804c7e..dc0e675a 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -404,207 +404,207 @@ }, { "ImportPath": "k8s.io/apimachinery/pkg/api/apitesting", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/fuzzer", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/roundtrip", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/api/equality", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/api/errors", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/api/meta", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/api/resource", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/conversion", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/fields", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/labels", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/runtime", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/runtime/schema", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/selection", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/types", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/cache", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/clock", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/diff", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/errors", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/framer", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/httpstream", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/intstr", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/json", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/naming", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/net", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/runtime", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/sets", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/validation", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/validation/field", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/wait", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/util/yaml", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/version", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/pkg/watch", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect", - "Rev": "f84a4639d8e87482a212fa1cb1fbec7f01bd780f" + "Rev": "5eb658cbe970c2fa8aaeeb343ab8f9a3cae0783a" }, { "ImportPath": "k8s.io/klog", diff --git a/discovery/cached_discovery.go b/discovery/cached/disk/cached_discovery.go similarity index 94% rename from discovery/cached_discovery.go rename to discovery/cached/disk/cached_discovery.go index d5cc7806..9ede5016 100644 --- a/discovery/cached_discovery.go +++ b/discovery/cached/disk/cached_discovery.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package discovery +package disk import ( "errors" @@ -31,6 +31,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/version" + "k8s.io/client-go/discovery" "k8s.io/client-go/kubernetes/scheme" restclient "k8s.io/client-go/rest" ) @@ -38,7 +39,7 @@ import ( // CachedDiscoveryClient implements the functions that discovery server-supported API groups, // versions and resources. type CachedDiscoveryClient struct { - delegate DiscoveryInterface + delegate discovery.DiscoveryInterface // cacheDirectory is the directory where discovery docs are held. It must be unique per host:port combination to work well. cacheDirectory string @@ -57,7 +58,7 @@ type CachedDiscoveryClient struct { fresh bool } -var _ CachedDiscoveryInterface = &CachedDiscoveryClient{} +var _ discovery.CachedDiscoveryInterface = &CachedDiscoveryClient{} // ServerResourcesForGroupVersion returns the supported resources for a group and version. func (d *CachedDiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error) { @@ -92,13 +93,13 @@ func (d *CachedDiscoveryClient) ServerResourcesForGroupVersion(groupVersion stri // ServerResources returns the supported resources for all groups and versions. // Deprecated: use ServerGroupsAndResources instead. func (d *CachedDiscoveryClient) ServerResources() ([]*metav1.APIResourceList, error) { - _, rs, err := ServerGroupsAndResources(d) + _, rs, err := discovery.ServerGroupsAndResources(d) return rs, err } // ServerGroupsAndResources returns the supported groups and resources for all groups and versions. func (d *CachedDiscoveryClient) ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) { - return ServerGroupsAndResources(d) + return discovery.ServerGroupsAndResources(d) } // ServerGroups returns the supported groups, with information like supported versions and the @@ -220,13 +221,13 @@ func (d *CachedDiscoveryClient) RESTClient() restclient.Interface { // ServerPreferredResources returns the supported resources with the version preferred by the // server. func (d *CachedDiscoveryClient) ServerPreferredResources() ([]*metav1.APIResourceList, error) { - return ServerPreferredResources(d) + return discovery.ServerPreferredResources(d) } // ServerPreferredNamespacedResources returns the supported namespaced resources with the // version preferred by the server. func (d *CachedDiscoveryClient) ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error) { - return ServerPreferredNamespacedResources(d) + return discovery.ServerPreferredNamespacedResources(d) } // ServerVersion retrieves and parses the server's version (git version). @@ -279,7 +280,7 @@ func NewCachedDiscoveryClientForConfig(config *restclient.Config, discoveryCache }) } - discoveryClient, err := NewDiscoveryClientForConfig(config) + discoveryClient, err := discovery.NewDiscoveryClientForConfig(config) if err != nil { return nil, err } @@ -288,7 +289,7 @@ func NewCachedDiscoveryClientForConfig(config *restclient.Config, discoveryCache } // NewCachedDiscoveryClient creates a new DiscoveryClient. cacheDirectory is the directory where discovery docs are held. It must be unique per host:port combination to work well. -func newCachedDiscoveryClient(delegate DiscoveryInterface, cacheDirectory string, ttl time.Duration) *CachedDiscoveryClient { +func newCachedDiscoveryClient(delegate discovery.DiscoveryInterface, cacheDirectory string, ttl time.Duration) *CachedDiscoveryClient { return &CachedDiscoveryClient{ delegate: delegate, cacheDirectory: cacheDirectory, diff --git a/discovery/cached_discovery_test.go b/discovery/cached/disk/cached_discovery_test.go similarity index 98% rename from discovery/cached_discovery_test.go rename to discovery/cached/disk/cached_discovery_test.go index 7dd704cb..3ddd4a98 100644 --- a/discovery/cached_discovery_test.go +++ b/discovery/cached/disk/cached_discovery_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package discovery +package disk import ( "io/ioutil" @@ -29,6 +29,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/version" + "k8s.io/client-go/discovery" restclient "k8s.io/client-go/rest" "k8s.io/client-go/rest/fake" ) @@ -104,7 +105,7 @@ type fakeDiscoveryClient struct { serverResourcesHandler func() ([]*metav1.APIResourceList, error) } -var _ DiscoveryInterface = &fakeDiscoveryClient{} +var _ discovery.DiscoveryInterface = &fakeDiscoveryClient{} func (c *fakeDiscoveryClient) RESTClient() restclient.Interface { return &fake.RESTClient{} diff --git a/discovery/round_tripper.go b/discovery/cached/disk/round_tripper.go similarity index 98% rename from discovery/round_tripper.go rename to discovery/cached/disk/round_tripper.go index 4e2bc24e..7e2a537a 100644 --- a/discovery/round_tripper.go +++ b/discovery/cached/disk/round_tripper.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package discovery +package disk import ( "net/http" diff --git a/discovery/round_tripper_test.go b/discovery/cached/disk/round_tripper_test.go similarity index 99% rename from discovery/round_tripper_test.go rename to discovery/cached/disk/round_tripper_test.go index b15e2e77..329be42a 100644 --- a/discovery/round_tripper_test.go +++ b/discovery/cached/disk/round_tripper_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package discovery +package disk import ( "bytes" diff --git a/discovery/cached/legacy.go b/discovery/cached/legacy.go new file mode 100644 index 00000000..725900a9 --- /dev/null +++ b/discovery/cached/legacy.go @@ -0,0 +1,30 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package memory + +import ( + "k8s.io/client-go/discovery" + "k8s.io/client-go/discovery/cached/memory" +) + +// NewMemCacheClient is DEPRECATED. Use memory.NewMemCacheClient directly. +func NewMemCacheClient(delegate discovery.DiscoveryInterface) discovery.CachedDiscoveryInterface { + return memory.NewMemCacheClient(delegate) +} + +// ErrCacheNotFound is DEPRECATED. Use memory.ErrCacheNotFound directly. +var ErrCacheNotFound = memory.ErrCacheNotFound diff --git a/discovery/cached/memcache.go b/discovery/cached/memory/memcache.go similarity index 99% rename from discovery/cached/memcache.go rename to discovery/cached/memory/memcache.go index 92fdaaf9..31e42156 100644 --- a/discovery/cached/memcache.go +++ b/discovery/cached/memory/memcache.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package cached +package memory import ( "errors" diff --git a/discovery/cached/memcache_test.go b/discovery/cached/memory/memcache_test.go similarity index 99% rename from discovery/cached/memcache_test.go rename to discovery/cached/memory/memcache_test.go index 680c68d8..3a9d60da 100644 --- a/discovery/cached/memcache_test.go +++ b/discovery/cached/memory/memcache_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package cached +package memory import ( "errors"