From af2c52085d97f65f99a1e87867096e40fc54f151 Mon Sep 17 00:00:00 2001 From: deads2k Date: Thu, 19 Jan 2017 15:00:15 -0500 Subject: [PATCH] update staging --- BUILD.bazel | 1 - .../client-go/discovery/discovery_client.go | 20 +-- .../discovery/discovery_client_test.go | 22 +-- .../client-go/discovery/fake/discovery.go | 4 +- .../discovery/helper_blackbox_test.go | 6 +- .../client-go/discovery/restmapper_test.go | 4 +- .../src/k8s.io/client-go/dynamic/client.go | 18 +- .../k8s.io/client-go/dynamic/client_pool.go | 6 +- .../k8s.io/client-go/dynamic/client_test.go | 6 +- .../typed/core/v1/fake/fake_pod_expansion.go | 6 +- .../core/v1/fake/fake_service_expansion.go | 4 +- .../kubernetes/typed/core/v1/pod_expansion.go | 6 +- .../typed/core/v1/service_expansion.go | 6 +- .../kubernetes/typed/policy/v1alpha1/doc.go | 20 --- .../typed/policy/v1alpha1/fake/doc.go | 20 --- .../v1alpha1/fake/fake_poddisruptionbudget.go | 128 ------------- .../v1alpha1/fake/fake_policy_client.go | 38 ---- .../policy/v1alpha1/generated_expansion.go | 19 -- .../policy/v1alpha1/poddisruptionbudget.go | 168 ------------------ .../typed/policy/v1alpha1/policy_client.go | 98 ---------- .../client-go/pkg/api/validation/path/name.go | 68 ------- .../client-go/pkg/apis/policy/v1alpha1/doc.go | 20 --- .../pkg/apis/policy/v1alpha1/register.go | 56 ------ .../pkg/apis/policy/v1alpha1/types.go | 93 ---------- .../client-go/pkg/util/cert/triple/BUILD | 18 -- .../plugin/pkg/client/auth/gcp/gcp.go | 12 +- .../plugin/pkg/client/auth/oidc/oidc.go | 14 +- .../src/k8s.io/client-go/rest/fake/fake.go | 22 +-- staging/src/k8s.io/client-go/testing/fake.go | 8 +- .../src/k8s.io/client-go/testing/fixture.go | 4 +- .../k8s.io/client-go/tools/auth/clientauth.go | 6 +- .../k8s.io/client-go/tools/cache/listwatch.go | 4 +- .../tools/clientcmd/client_config.go | 52 +++--- .../tools/clientcmd/client_config_test.go | 8 +- .../client-go/tools/clientcmd/config.go | 4 +- .../client-go/tools/clientcmd/loader.go | 8 +- .../tools/clientcmd/merged_client_builder.go | 4 +- .../clientcmd/merged_client_builder_test.go | 10 +- .../k8s.io/client-go/tools/record/event.go | 4 +- .../client-go/tools/record/event_test.go | 4 +- vendor/BUILD | 66 ------- 41 files changed, 136 insertions(+), 949 deletions(-) delete mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/doc.go delete mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/fake/doc.go delete mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/fake/fake_poddisruptionbudget.go delete mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/fake/fake_policy_client.go delete mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/generated_expansion.go delete mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/poddisruptionbudget.go delete mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/policy_client.go delete mode 100644 staging/src/k8s.io/client-go/pkg/api/validation/path/name.go delete mode 100644 staging/src/k8s.io/client-go/pkg/apis/policy/v1alpha1/doc.go delete mode 100644 staging/src/k8s.io/client-go/pkg/apis/policy/v1alpha1/register.go delete mode 100644 staging/src/k8s.io/client-go/pkg/apis/policy/v1alpha1/types.go delete mode 100644 staging/src/k8s.io/client-go/pkg/util/cert/triple/BUILD diff --git a/BUILD.bazel b/BUILD.bazel index 8d9ce2fab5f..339affffa45 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -46,7 +46,6 @@ filegroup( "//hack:all-srcs", "//pkg:all-srcs", "//plugin:all-srcs", - "//staging/src/k8s.io/client-go/pkg/util/cert/triple:all-srcs", "//test:all-srcs", "//third_party:all-srcs", "//vendor:all-srcs", diff --git a/staging/src/k8s.io/client-go/discovery/discovery_client.go b/staging/src/k8s.io/client-go/discovery/discovery_client.go index 8031ce21226..25fa2cfa030 100644 --- a/staging/src/k8s.io/client-go/discovery/discovery_client.go +++ b/staging/src/k8s.io/client-go/discovery/discovery_client.go @@ -33,7 +33,7 @@ import ( "k8s.io/apimachinery/pkg/version" "k8s.io/client-go/pkg/api" "k8s.io/client-go/pkg/api/v1" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" ) // defaultRetries is the number of times a resource discovery is repeated if an api group disappears on the fly (e.g. ThirdPartyResources). @@ -42,7 +42,7 @@ const defaultRetries = 2 // DiscoveryInterface holds the methods that discover server-supported API groups, // versions and resources. type DiscoveryInterface interface { - RESTClient() rest.Interface + RESTClient() restclient.Interface ServerGroupsInterface ServerResourcesInterface ServerVersionInterface @@ -94,7 +94,7 @@ type SwaggerSchemaInterface interface { // DiscoveryClient implements the functions that discover server-supported API groups, // versions and resources. type DiscoveryClient struct { - restClient rest.Interface + restClient restclient.Interface LegacyPrefix string } @@ -380,31 +380,31 @@ func withRetries(maxRetries int, f func(failEarly bool) ([]*metav1.APIResourceLi return result, err } -func setDiscoveryDefaults(config *rest.Config) error { +func setDiscoveryDefaults(config *restclient.Config) error { config.APIPath = "" config.GroupVersion = nil codec := runtime.NoopEncoder{Decoder: api.Codecs.UniversalDecoder()} config.NegotiatedSerializer = serializer.NegotiatedSerializerWrapper(runtime.SerializerInfo{Serializer: codec}) if len(config.UserAgent) == 0 { - config.UserAgent = rest.DefaultKubernetesUserAgent() + config.UserAgent = restclient.DefaultKubernetesUserAgent() } return nil } // NewDiscoveryClientForConfig creates a new DiscoveryClient for the given config. This client // can be used to discover supported resources in the API server. -func NewDiscoveryClientForConfig(c *rest.Config) (*DiscoveryClient, error) { +func NewDiscoveryClientForConfig(c *restclient.Config) (*DiscoveryClient, error) { config := *c if err := setDiscoveryDefaults(&config); err != nil { return nil, err } - client, err := rest.UnversionedRESTClientFor(&config) + client, err := restclient.UnversionedRESTClientFor(&config) return &DiscoveryClient{restClient: client, LegacyPrefix: "/api"}, err } // NewDiscoveryClientForConfig creates a new DiscoveryClient for the given config. If // there is an error, it panics. -func NewDiscoveryClientForConfigOrDie(c *rest.Config) *DiscoveryClient { +func NewDiscoveryClientForConfigOrDie(c *restclient.Config) *DiscoveryClient { client, err := NewDiscoveryClientForConfig(c) if err != nil { panic(err) @@ -414,7 +414,7 @@ func NewDiscoveryClientForConfigOrDie(c *rest.Config) *DiscoveryClient { } // New creates a new DiscoveryClient for the given RESTClient. -func NewDiscoveryClient(c rest.Interface) *DiscoveryClient { +func NewDiscoveryClient(c restclient.Interface) *DiscoveryClient { return &DiscoveryClient{restClient: c, LegacyPrefix: "/api"} } @@ -429,7 +429,7 @@ func stringDoesntExistIn(str string, slice []string) bool { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *DiscoveryClient) RESTClient() rest.Interface { +func (c *DiscoveryClient) RESTClient() restclient.Interface { if c == nil { return nil } diff --git a/staging/src/k8s.io/client-go/discovery/discovery_client_test.go b/staging/src/k8s.io/client-go/discovery/discovery_client_test.go index e1350615808..6f5a2ecf6ca 100644 --- a/staging/src/k8s.io/client-go/discovery/discovery_client_test.go +++ b/staging/src/k8s.io/client-go/discovery/discovery_client_test.go @@ -30,7 +30,7 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/version" "k8s.io/client-go/pkg/api/v1" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" ) func TestGetServerVersion(t *testing.T) { @@ -50,7 +50,7 @@ func TestGetServerVersion(t *testing.T) { w.Write(output) })) defer server.Close() - client := NewDiscoveryClientForConfigOrDie(&rest.Config{Host: server.URL}) + client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL}) got, err := client.ServerVersion() if err != nil { @@ -85,7 +85,7 @@ func TestGetServerGroupsWithV1Server(t *testing.T) { w.Write(output) })) defer server.Close() - client := NewDiscoveryClientForConfigOrDie(&rest.Config{Host: server.URL}) + client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL}) // ServerGroups should not return an error even if server returns error at /api and /apis apiGroupList, err := client.ServerGroups() if err != nil { @@ -103,7 +103,7 @@ func TestGetServerGroupsWithBrokenServer(t *testing.T) { w.WriteHeader(statusCode) })) defer server.Close() - client := NewDiscoveryClientForConfigOrDie(&rest.Config{Host: server.URL}) + client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL}) // ServerGroups should not return an error even if server returns Not Found or Forbidden error at all end points apiGroupList, err := client.ServerGroups() if err != nil { @@ -140,7 +140,7 @@ func TestGetServerResourcesWithV1Server(t *testing.T) { w.Write(output) })) defer server.Close() - client := NewDiscoveryClientForConfigOrDie(&rest.Config{Host: server.URL}) + client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL}) // ServerResources should not return an error even if server returns error at /api/v1. serverResources, err := client.ServerResources() if err != nil { @@ -232,7 +232,7 @@ func TestGetServerResources(t *testing.T) { w.Write(output) })) defer server.Close() - client := NewDiscoveryClientForConfigOrDie(&rest.Config{Host: server.URL}) + client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL}) for _, test := range tests { got, err := client.ServerResourcesForGroupVersion(test.request) if test.expectErr { @@ -295,7 +295,7 @@ func TestGetSwaggerSchema(t *testing.T) { } defer server.Close() - client := NewDiscoveryClientForConfigOrDie(&rest.Config{Host: server.URL}) + client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL}) got, err := client.SwaggerSchema(v1.SchemeGroupVersion) if err != nil { t.Fatalf("unexpected encoding error: %v", err) @@ -314,7 +314,7 @@ func TestGetSwaggerSchemaFail(t *testing.T) { } defer server.Close() - client := NewDiscoveryClientForConfigOrDie(&rest.Config{Host: server.URL}) + 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) @@ -427,7 +427,7 @@ func TestServerPreferredResources(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(test.response)) defer server.Close() - client := NewDiscoveryClientForConfigOrDie(&rest.Config{Host: server.URL}) + client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL}) resources, err := client.ServerPreferredResources() if test.expectErr != nil { if err == nil { @@ -540,7 +540,7 @@ func TestServerPreferredResourcesRetries(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(response(tc.responseErrors))) defer server.Close() - client := NewDiscoveryClientForConfigOrDie(&rest.Config{Host: server.URL}) + client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL}) resources, err := client.ServerPreferredResources() if !tc.expectedError(err) { t.Errorf("case %d: unexpected error: %v", i, err) @@ -711,7 +711,7 @@ func TestServerPreferredNamespacedResources(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(test.response)) defer server.Close() - client := NewDiscoveryClientForConfigOrDie(&rest.Config{Host: server.URL}) + client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL}) resources, err := client.ServerPreferredNamespacedResources() if err != nil { t.Errorf("[%d] unexpected error: %v", i, err) diff --git a/staging/src/k8s.io/client-go/discovery/fake/discovery.go b/staging/src/k8s.io/client-go/discovery/fake/discovery.go index 534fa23ede7..8fbed28d978 100644 --- a/staging/src/k8s.io/client-go/discovery/fake/discovery.go +++ b/staging/src/k8s.io/client-go/discovery/fake/discovery.go @@ -26,7 +26,7 @@ import ( "k8s.io/apimachinery/pkg/version" "k8s.io/client-go/pkg/api/v1" kubeversion "k8s.io/client-go/pkg/version" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" "k8s.io/client-go/testing" ) @@ -92,6 +92,6 @@ func (c *FakeDiscovery) SwaggerSchema(version schema.GroupVersion) (*swagger.Api return &swagger.ApiDeclaration{}, nil } -func (c *FakeDiscovery) RESTClient() rest.Interface { +func (c *FakeDiscovery) RESTClient() restclient.Interface { return nil } diff --git a/staging/src/k8s.io/client-go/discovery/helper_blackbox_test.go b/staging/src/k8s.io/client-go/discovery/helper_blackbox_test.go index 1253732b2aa..8731658a255 100644 --- a/staging/src/k8s.io/client-go/discovery/helper_blackbox_test.go +++ b/staging/src/k8s.io/client-go/discovery/helper_blackbox_test.go @@ -34,7 +34,7 @@ import ( "k8s.io/client-go/discovery" "k8s.io/client-go/pkg/api" "k8s.io/client-go/pkg/api/testapi" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" "k8s.io/client-go/rest/fake" ) @@ -139,8 +139,8 @@ func TestNegotiateVersion(t *testing.T) { return &http.Response{StatusCode: test.statusCode, Header: header, Body: objBody(&uapi.APIVersions{Versions: test.serverVersions})}, nil }), } - c := discovery.NewDiscoveryClientForConfigOrDie(&rest.Config{}) - c.RESTClient().(*rest.RESTClient).Client = fakeClient.Client + c := discovery.NewDiscoveryClientForConfigOrDie(&restclient.Config{}) + c.RESTClient().(*restclient.RESTClient).Client = fakeClient.Client response, err := discovery.NegotiateVersion(c, test.requiredVersion, test.clientVersions) if err == nil && test.expectErr != nil { t.Errorf("expected error, got nil for [%s].", test.name) diff --git a/staging/src/k8s.io/client-go/discovery/restmapper_test.go b/staging/src/k8s.io/client-go/discovery/restmapper_test.go index deb619e1772..3961ab6f29a 100644 --- a/staging/src/k8s.io/client-go/discovery/restmapper_test.go +++ b/staging/src/k8s.io/client-go/discovery/restmapper_test.go @@ -25,7 +25,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/version" "k8s.io/client-go/pkg/api" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" "k8s.io/client-go/rest/fake" "github.com/emicklei/go-restful/swagger" @@ -246,7 +246,7 @@ func (c *fakeCachedDiscoveryInterface) Invalidate() { c.enabledA = true } -func (c *fakeCachedDiscoveryInterface) RESTClient() rest.Interface { +func (c *fakeCachedDiscoveryInterface) RESTClient() restclient.Interface { return &fake.RESTClient{} } diff --git a/staging/src/k8s.io/client-go/dynamic/client.go b/staging/src/k8s.io/client-go/dynamic/client.go index bf3929ed20e..75771dfa438 100644 --- a/staging/src/k8s.io/client-go/dynamic/client.go +++ b/staging/src/k8s.io/client-go/dynamic/client.go @@ -37,19 +37,19 @@ import ( "k8s.io/client-go/pkg/api" "k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/pkg/util/flowcontrol" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" ) // Client is a Kubernetes client that allows you to access metadata // and manipulate metadata of a Kubernetes API group. type Client struct { - cl *rest.RESTClient + cl *restclient.RESTClient parameterCodec runtime.ParameterCodec } // NewClient returns a new client based on the passed in config. The // codec is ignored, as the dynamic client uses it's own codec. -func NewClient(conf *rest.Config) (*Client, error) { +func NewClient(conf *restclient.Config) (*Client, error) { // avoid changing the original config confCopy := *conf conf = &confCopy @@ -66,10 +66,10 @@ func NewClient(conf *rest.Config) (*Client, error) { } if len(conf.UserAgent) == 0 { - conf.UserAgent = rest.DefaultKubernetesUserAgent() + conf.UserAgent = restclient.DefaultKubernetesUserAgent() } - cl, err := rest.RESTClientFor(conf) + cl, err := restclient.RESTClientFor(conf) if err != nil { return nil, err } @@ -105,7 +105,7 @@ func (c *Client) ParameterCodec(parameterCodec runtime.ParameterCodec) *Client { // ResourceClient is an API interface to a specific resource under a // dynamic client. type ResourceClient struct { - cl *rest.RESTClient + cl *restclient.RESTClient resource *metav1.APIResource ns string parameterCodec runtime.ParameterCodec @@ -242,8 +242,8 @@ func (dynamicCodec) Encode(obj runtime.Object, w io.Writer) error { return unstructured.UnstructuredJSONScheme.Encode(obj, w) } -// ContentConfig returns a rest.ContentConfig for dynamic types. -func ContentConfig() rest.ContentConfig { +// ContentConfig returns a restclient.ContentConfig for dynamic types. +func ContentConfig() restclient.ContentConfig { var jsonInfo runtime.SerializerInfo // TODO: api.Codecs here should become "pkg/apis/server/scheme" which is the minimal core you need // to talk to a kubernetes server @@ -256,7 +256,7 @@ func ContentConfig() rest.ContentConfig { jsonInfo.Serializer = dynamicCodec{} jsonInfo.PrettySerializer = nil - return rest.ContentConfig{ + return restclient.ContentConfig{ AcceptContentTypes: runtime.ContentTypeJSON, ContentType: runtime.ContentTypeJSON, NegotiatedSerializer: serializer.NegotiatedSerializerWrapper(jsonInfo), diff --git a/staging/src/k8s.io/client-go/dynamic/client_pool.go b/staging/src/k8s.io/client-go/dynamic/client_pool.go index a5ff7f04332..205d8a0d518 100644 --- a/staging/src/k8s.io/client-go/dynamic/client_pool.go +++ b/staging/src/k8s.io/client-go/dynamic/client_pool.go @@ -21,7 +21,7 @@ import ( "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" ) // ClientPool manages a pool of dynamic clients. @@ -50,7 +50,7 @@ func LegacyAPIPathResolverFunc(kind schema.GroupVersionKind) string { // is asked to retrieve. This type is thread safe. type clientPoolImpl struct { lock sync.RWMutex - config *rest.Config + config *restclient.Config clients map[schema.GroupVersion]*Client apiPathResolverFunc APIPathResolverFunc mapper meta.RESTMapper @@ -59,7 +59,7 @@ type clientPoolImpl struct { // NewClientPool returns a ClientPool from the specified config. It reuses clients for the the same // group version. It is expected this type may be wrapped by specific logic that special cases certain // resources or groups. -func NewClientPool(config *rest.Config, mapper meta.RESTMapper, apiPathResolverFunc APIPathResolverFunc) ClientPool { +func NewClientPool(config *restclient.Config, mapper meta.RESTMapper, apiPathResolverFunc APIPathResolverFunc) ClientPool { confCopy := *config return &clientPoolImpl{ diff --git a/staging/src/k8s.io/client-go/dynamic/client_test.go b/staging/src/k8s.io/client-go/dynamic/client_test.go index 3499e43ea45..418aecbaf2f 100644 --- a/staging/src/k8s.io/client-go/dynamic/client_test.go +++ b/staging/src/k8s.io/client-go/dynamic/client_test.go @@ -33,7 +33,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/pkg/api/v1" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" restclientwatch "k8s.io/client-go/rest/watch" ) @@ -61,9 +61,9 @@ func getObject(version, kind, name string) *unstructured.Unstructured { func getClientServer(gv *schema.GroupVersion, h func(http.ResponseWriter, *http.Request)) (*Client, *httptest.Server, error) { srv := httptest.NewServer(http.HandlerFunc(h)) - cl, err := NewClient(&rest.Config{ + cl, err := NewClient(&restclient.Config{ Host: srv.URL, - ContentConfig: rest.ContentConfig{GroupVersion: gv}, + ContentConfig: restclient.ContentConfig{GroupVersion: gv}, }) if err != nil { srv.Close() diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_pod_expansion.go b/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_pod_expansion.go index 4fe2a05b263..c54c1658312 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_pod_expansion.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_pod_expansion.go @@ -19,7 +19,7 @@ package fake import ( "k8s.io/client-go/pkg/api/v1" policy "k8s.io/client-go/pkg/apis/policy/v1beta1" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" "k8s.io/client-go/testing" ) @@ -34,7 +34,7 @@ func (c *FakePods) Bind(binding *v1.Binding) error { return err } -func (c *FakePods) GetLogs(name string, opts *v1.PodLogOptions) *rest.Request { +func (c *FakePods) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request { action := testing.GenericActionImpl{} action.Verb = "get" action.Namespace = c.ns @@ -43,7 +43,7 @@ func (c *FakePods) GetLogs(name string, opts *v1.PodLogOptions) *rest.Request { action.Value = opts _, _ = c.Fake.Invokes(action, &v1.Pod{}) - return &rest.Request{} + return &restclient.Request{} } func (c *FakePods) Evict(eviction *policy.Eviction) error { diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_service_expansion.go b/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_service_expansion.go index f3128b8f8f8..59fa8e51241 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_service_expansion.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_service_expansion.go @@ -17,10 +17,10 @@ limitations under the License. package fake import ( - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" "k8s.io/client-go/testing" ) -func (c *FakeServices) ProxyGet(scheme, name, port, path string, params map[string]string) rest.ResponseWrapper { +func (c *FakeServices) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper { return c.Fake.InvokesProxy(testing.NewProxyGetAction(servicesResource, c.ns, scheme, name, port, path, params)) } diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/pod_expansion.go b/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/pod_expansion.go index c54ba6a7afe..82f3b7fba34 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/pod_expansion.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/pod_expansion.go @@ -20,14 +20,14 @@ import ( "k8s.io/client-go/pkg/api" "k8s.io/client-go/pkg/api/v1" policy "k8s.io/client-go/pkg/apis/policy/v1beta1" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" ) // The PodExpansion interface allows manually adding extra methods to the PodInterface. type PodExpansion interface { Bind(binding *v1.Binding) error Evict(eviction *policy.Eviction) error - GetLogs(name string, opts *v1.PodLogOptions) *rest.Request + GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request } // Bind applies the provided binding to the named pod in the current namespace (binding.Namespace is ignored). @@ -40,6 +40,6 @@ func (c *pods) Evict(eviction *policy.Eviction) error { } // Get constructs a request for getting the logs for a pod -func (c *pods) GetLogs(name string, opts *v1.PodLogOptions) *rest.Request { +func (c *pods) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request { return c.client.Get().Namespace(c.ns).Name(name).Resource("pods").SubResource("log").VersionedParams(opts, api.ParameterCodec) } diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/service_expansion.go b/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/service_expansion.go index 07b212bbfa0..d2bb531d765 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/service_expansion.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/service_expansion.go @@ -18,16 +18,16 @@ package v1 import ( "k8s.io/apimachinery/pkg/util/net" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" ) // The ServiceExpansion interface allows manually adding extra methods to the ServiceInterface. type ServiceExpansion interface { - ProxyGet(scheme, name, port, path string, params map[string]string) rest.ResponseWrapper + ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper } // ProxyGet returns a response of the service by calling it through the proxy. -func (c *services) ProxyGet(scheme, name, port, path string, params map[string]string) rest.ResponseWrapper { +func (c *services) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper { request := c.client.Get(). Prefix("proxy"). Namespace(c.ns). diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/doc.go deleted file mode 100644 index bc5df818d9e..00000000000 --- a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2016 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. -*/ - -// This package is generated by client-gen with arguments: --clientset-name=release_1_5 --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1alpha1,rbac/v1alpha1,storage/v1beta1] - -// This package has the automatically generated typed clients. -package v1alpha1 diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/fake/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/fake/doc.go deleted file mode 100644 index b320cb63658..00000000000 --- a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2016 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. -*/ - -// This package is generated by client-gen with arguments: --clientset-name=release_1_5 --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1alpha1,rbac/v1alpha1,storage/v1beta1] - -// Package fake has the automatically generated clients. -package fake diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/fake/fake_poddisruptionbudget.go b/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/fake/fake_poddisruptionbudget.go deleted file mode 100644 index e10dc904c32..00000000000 --- a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/fake/fake_poddisruptionbudget.go +++ /dev/null @@ -1,128 +0,0 @@ -/* -Copyright 2016 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 fake - -import ( - labels "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - v1 "k8s.io/client-go/pkg/api/v1" - v1alpha1 "k8s.io/client-go/pkg/apis/policy/v1alpha1" - testing "k8s.io/client-go/testing" -) - -// FakePodDisruptionBudgets implements PodDisruptionBudgetInterface -type FakePodDisruptionBudgets struct { - Fake *FakePolicyV1alpha1 - ns string -} - -var poddisruptionbudgetsResource = schema.GroupVersionResource{Group: "policy", Version: "v1alpha1", Resource: "poddisruptionbudgets"} - -func (c *FakePodDisruptionBudgets) Create(podDisruptionBudget *v1alpha1.PodDisruptionBudget) (result *v1alpha1.PodDisruptionBudget, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(poddisruptionbudgetsResource, c.ns, podDisruptionBudget), &v1alpha1.PodDisruptionBudget{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PodDisruptionBudget), err -} - -func (c *FakePodDisruptionBudgets) Update(podDisruptionBudget *v1alpha1.PodDisruptionBudget) (result *v1alpha1.PodDisruptionBudget, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(poddisruptionbudgetsResource, c.ns, podDisruptionBudget), &v1alpha1.PodDisruptionBudget{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PodDisruptionBudget), err -} - -func (c *FakePodDisruptionBudgets) UpdateStatus(podDisruptionBudget *v1alpha1.PodDisruptionBudget) (*v1alpha1.PodDisruptionBudget, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(poddisruptionbudgetsResource, "status", c.ns, podDisruptionBudget), &v1alpha1.PodDisruptionBudget{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PodDisruptionBudget), err -} - -func (c *FakePodDisruptionBudgets) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(poddisruptionbudgetsResource, c.ns, name), &v1alpha1.PodDisruptionBudget{}) - - return err -} - -func (c *FakePodDisruptionBudgets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(poddisruptionbudgetsResource, c.ns, listOptions) - - _, err := c.Fake.Invokes(action, &v1alpha1.PodDisruptionBudgetList{}) - return err -} - -func (c *FakePodDisruptionBudgets) Get(name string) (result *v1alpha1.PodDisruptionBudget, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(poddisruptionbudgetsResource, c.ns, name), &v1alpha1.PodDisruptionBudget{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PodDisruptionBudget), err -} - -func (c *FakePodDisruptionBudgets) List(opts v1.ListOptions) (result *v1alpha1.PodDisruptionBudgetList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(poddisruptionbudgetsResource, c.ns, opts), &v1alpha1.PodDisruptionBudgetList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.PodDisruptionBudgetList{} - for _, item := range obj.(*v1alpha1.PodDisruptionBudgetList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested podDisruptionBudgets. -func (c *FakePodDisruptionBudgets) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(poddisruptionbudgetsResource, c.ns, opts)) - -} - -// Patch applies the patch and returns the patched podDisruptionBudget. -func (c *FakePodDisruptionBudgets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.PodDisruptionBudget, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(poddisruptionbudgetsResource, c.ns, name, data, subresources...), &v1alpha1.PodDisruptionBudget{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PodDisruptionBudget), err -} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/fake/fake_policy_client.go b/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/fake/fake_policy_client.go deleted file mode 100644 index 8b233265925..00000000000 --- a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/fake/fake_policy_client.go +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright 2016 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 fake - -import ( - v1alpha1 "k8s.io/client-go/kubernetes/typed/policy/v1alpha1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakePolicyV1alpha1 struct { - *testing.Fake -} - -func (c *FakePolicyV1alpha1) PodDisruptionBudgets(namespace string) v1alpha1.PodDisruptionBudgetInterface { - return &FakePodDisruptionBudgets{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakePolicyV1alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/generated_expansion.go b/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/generated_expansion.go deleted file mode 100644 index a2e74c84dff..00000000000 --- a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/generated_expansion.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2016 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 v1alpha1 - -type PodDisruptionBudgetExpansion interface{} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/poddisruptionbudget.go b/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/poddisruptionbudget.go deleted file mode 100644 index f29ae41a906..00000000000 --- a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/poddisruptionbudget.go +++ /dev/null @@ -1,168 +0,0 @@ -/* -Copyright 2016 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 v1alpha1 - -import ( - "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - api "k8s.io/client-go/pkg/api" - v1 "k8s.io/client-go/pkg/api/v1" - v1alpha1 "k8s.io/client-go/pkg/apis/policy/v1alpha1" - rest "k8s.io/client-go/rest" -) - -// PodDisruptionBudgetsGetter has a method to return a PodDisruptionBudgetInterface. -// A group's client should implement this interface. -type PodDisruptionBudgetsGetter interface { - PodDisruptionBudgets(namespace string) PodDisruptionBudgetInterface -} - -// PodDisruptionBudgetInterface has methods to work with PodDisruptionBudget resources. -type PodDisruptionBudgetInterface interface { - Create(*v1alpha1.PodDisruptionBudget) (*v1alpha1.PodDisruptionBudget, error) - Update(*v1alpha1.PodDisruptionBudget) (*v1alpha1.PodDisruptionBudget, error) - UpdateStatus(*v1alpha1.PodDisruptionBudget) (*v1alpha1.PodDisruptionBudget, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string) (*v1alpha1.PodDisruptionBudget, error) - List(opts v1.ListOptions) (*v1alpha1.PodDisruptionBudgetList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.PodDisruptionBudget, err error) - PodDisruptionBudgetExpansion -} - -// podDisruptionBudgets implements PodDisruptionBudgetInterface -type podDisruptionBudgets struct { - client rest.Interface - ns string -} - -// newPodDisruptionBudgets returns a PodDisruptionBudgets -func newPodDisruptionBudgets(c *PolicyV1alpha1Client, namespace string) *podDisruptionBudgets { - return &podDisruptionBudgets{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Create takes the representation of a podDisruptionBudget and creates it. Returns the server's representation of the podDisruptionBudget, and an error, if there is any. -func (c *podDisruptionBudgets) Create(podDisruptionBudget *v1alpha1.PodDisruptionBudget) (result *v1alpha1.PodDisruptionBudget, err error) { - result = &v1alpha1.PodDisruptionBudget{} - err = c.client.Post(). - Namespace(c.ns). - Resource("poddisruptionbudgets"). - Body(podDisruptionBudget). - Do(). - Into(result) - return -} - -// Update takes the representation of a podDisruptionBudget and updates it. Returns the server's representation of the podDisruptionBudget, and an error, if there is any. -func (c *podDisruptionBudgets) Update(podDisruptionBudget *v1alpha1.PodDisruptionBudget) (result *v1alpha1.PodDisruptionBudget, err error) { - result = &v1alpha1.PodDisruptionBudget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("poddisruptionbudgets"). - Name(podDisruptionBudget.Name). - Body(podDisruptionBudget). - Do(). - Into(result) - return -} - -func (c *podDisruptionBudgets) UpdateStatus(podDisruptionBudget *v1alpha1.PodDisruptionBudget) (result *v1alpha1.PodDisruptionBudget, err error) { - result = &v1alpha1.PodDisruptionBudget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("poddisruptionbudgets"). - Name(podDisruptionBudget.Name). - SubResource("status"). - Body(podDisruptionBudget). - Do(). - Into(result) - return -} - -// Delete takes name of the podDisruptionBudget and deletes it. Returns an error if one occurs. -func (c *podDisruptionBudgets) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("poddisruptionbudgets"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *podDisruptionBudgets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("poddisruptionbudgets"). - VersionedParams(&listOptions, api.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Get takes name of the podDisruptionBudget, and returns the corresponding podDisruptionBudget object, and an error if there is any. -func (c *podDisruptionBudgets) Get(name string) (result *v1alpha1.PodDisruptionBudget, err error) { - result = &v1alpha1.PodDisruptionBudget{} - err = c.client.Get(). - Namespace(c.ns). - Resource("poddisruptionbudgets"). - Name(name). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of PodDisruptionBudgets that match those selectors. -func (c *podDisruptionBudgets) List(opts v1.ListOptions) (result *v1alpha1.PodDisruptionBudgetList, err error) { - result = &v1alpha1.PodDisruptionBudgetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("poddisruptionbudgets"). - VersionedParams(&opts, api.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested podDisruptionBudgets. -func (c *podDisruptionBudgets) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.client.Get(). - Prefix("watch"). - Namespace(c.ns). - Resource("poddisruptionbudgets"). - VersionedParams(&opts, api.ParameterCodec). - Watch() -} - -// Patch applies the patch and returns the patched podDisruptionBudget. -func (c *podDisruptionBudgets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.PodDisruptionBudget, err error) { - result = &v1alpha1.PodDisruptionBudget{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("poddisruptionbudgets"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/policy_client.go b/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/policy_client.go deleted file mode 100644 index 353a8e6fa61..00000000000 --- a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1alpha1/policy_client.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2016 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 v1alpha1 - -import ( - fmt "fmt" - - "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - api "k8s.io/client-go/pkg/api" - rest "k8s.io/client-go/rest" -) - -type PolicyV1alpha1Interface interface { - RESTClient() rest.Interface - PodDisruptionBudgetsGetter -} - -// PolicyV1alpha1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. -type PolicyV1alpha1Client struct { - restClient rest.Interface -} - -func (c *PolicyV1alpha1Client) PodDisruptionBudgets(namespace string) PodDisruptionBudgetInterface { - return newPodDisruptionBudgets(c, namespace) -} - -// NewForConfig creates a new PolicyV1alpha1Client for the given config. -func NewForConfig(c *rest.Config) (*PolicyV1alpha1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &PolicyV1alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new PolicyV1alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *PolicyV1alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new PolicyV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *PolicyV1alpha1Client { - return &PolicyV1alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv, err := schema.ParseGroupVersion("policy/v1alpha1") - if err != nil { - return err - } - // if policy/v1alpha1 is not enabled, return an error - if !api.Registry.IsEnabledVersion(gv) { - return fmt.Errorf("policy/v1alpha1 is not enabled") - } - config.APIPath = "/apis" - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - copyGroupVersion := gv - config.GroupVersion = ©GroupVersion - - config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs} - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *PolicyV1alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/staging/src/k8s.io/client-go/pkg/api/validation/path/name.go b/staging/src/k8s.io/client-go/pkg/api/validation/path/name.go deleted file mode 100644 index a50cd089dfb..00000000000 --- a/staging/src/k8s.io/client-go/pkg/api/validation/path/name.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2015 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 path - -import ( - "fmt" - "strings" -) - -// NameMayNotBe specifies strings that cannot be used as names specified as path segments (like the REST API or etcd store) -var NameMayNotBe = []string{".", ".."} - -// NameMayNotContain specifies substrings that cannot be used in names specified as path segments (like the REST API or etcd store) -var NameMayNotContain = []string{"/", "%"} - -// IsValidPathSegmentName validates the name can be safely encoded as a path segment -func IsValidPathSegmentName(name string) []string { - for _, illegalName := range NameMayNotBe { - if name == illegalName { - return []string{fmt.Sprintf(`may not be '%s'`, illegalName)} - } - } - - var errors []string - for _, illegalContent := range NameMayNotContain { - if strings.Contains(name, illegalContent) { - errors = append(errors, fmt.Sprintf(`may not contain '%s'`, illegalContent)) - } - } - - return errors -} - -// IsValidPathSegmentPrefix validates the name can be used as a prefix for a name which will be encoded as a path segment -// It does not check for exact matches with disallowed names, since an arbitrary suffix might make the name valid -func IsValidPathSegmentPrefix(name string) []string { - var errors []string - for _, illegalContent := range NameMayNotContain { - if strings.Contains(name, illegalContent) { - errors = append(errors, fmt.Sprintf(`may not contain '%s'`, illegalContent)) - } - } - - return errors -} - -// ValidatePathSegmentName validates the name can be safely encoded as a path segment -func ValidatePathSegmentName(name string, prefix bool) []string { - if prefix { - return IsValidPathSegmentPrefix(name) - } else { - return IsValidPathSegmentName(name) - } -} diff --git a/staging/src/k8s.io/client-go/pkg/apis/policy/v1alpha1/doc.go b/staging/src/k8s.io/client-go/pkg/apis/policy/v1alpha1/doc.go deleted file mode 100644 index 65d58233ee1..00000000000 --- a/staging/src/k8s.io/client-go/pkg/apis/policy/v1alpha1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2016 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 policy is for any kind of policy object. Suitable examples, even if -// they aren't all here, are PodDisruptionBudget, PodSecurityPolicy, -// NetworkPolicy, etc. -package v1alpha1 diff --git a/staging/src/k8s.io/client-go/pkg/apis/policy/v1alpha1/register.go b/staging/src/k8s.io/client-go/pkg/apis/policy/v1alpha1/register.go deleted file mode 100644 index ac924635a30..00000000000 --- a/staging/src/k8s.io/client-go/pkg/apis/policy/v1alpha1/register.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2015 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 v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/pkg/api/v1" -) - -// GroupName is the group name use in this package -const GroupName = "policy" - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme -) - -// Adds the list of known types to api.Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &PodDisruptionBudget{}, - &PodDisruptionBudgetList{}, - &Eviction{}, - &v1.ListOptions{}, - &v1.DeleteOptions{}, - &metav1.ExportOptions{}, - &metav1.GetOptions{}, - ) - // Add the watch version that applies - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/staging/src/k8s.io/client-go/pkg/apis/policy/v1alpha1/types.go b/staging/src/k8s.io/client-go/pkg/apis/policy/v1alpha1/types.go deleted file mode 100644 index 6c875028477..00000000000 --- a/staging/src/k8s.io/client-go/pkg/apis/policy/v1alpha1/types.go +++ /dev/null @@ -1,93 +0,0 @@ -/* -Copyright 2016 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 v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/pkg/api/v1" - "k8s.io/client-go/pkg/util/intstr" -) - -// PodDisruptionBudgetSpec is a description of a PodDisruptionBudget. -type PodDisruptionBudgetSpec struct { - // An eviction is allowed if at least "minAvailable" pods selected by - // "selector" will still be available after the eviction, i.e. even in the - // absence of the evicted pod. So for example you can prevent all voluntary - // evictions by specifying "100%". - // +optional - MinAvailable intstr.IntOrString `json:"minAvailable,omitempty" protobuf:"bytes,1,opt,name=minAvailable"` - - // Label query over pods whose evictions are managed by the disruption - // budget. - // +optional - Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"` -} - -// PodDisruptionBudgetStatus represents information about the status of a -// PodDisruptionBudget. Status may trail the actual state of a system. -type PodDisruptionBudgetStatus struct { - // Whether or not a disruption is currently allowed. - PodDisruptionAllowed bool `json:"disruptionAllowed" protobuf:"varint,1,opt,name=disruptionAllowed"` - - // current number of healthy pods - CurrentHealthy int32 `json:"currentHealthy" protobuf:"varint,2,opt,name=currentHealthy"` - - // minimum desired number of healthy pods - DesiredHealthy int32 `json:"desiredHealthy" protobuf:"varint,3,opt,name=desiredHealthy"` - - // total number of pods counted by this disruption budget - ExpectedPods int32 `json:"expectedPods" protobuf:"varint,4,opt,name=expectedPods"` -} - -// +genclient=true - -// PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods -type PodDisruptionBudget struct { - metav1.TypeMeta `json:",inline"` - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Specification of the desired behavior of the PodDisruptionBudget. - // +optional - Spec PodDisruptionBudgetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - // Most recently observed status of the PodDisruptionBudget. - // +optional - Status PodDisruptionBudgetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// PodDisruptionBudgetList is a collection of PodDisruptionBudgets. -type PodDisruptionBudgetList struct { - metav1.TypeMeta `json:",inline"` - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []PodDisruptionBudget `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// Eviction evicts a pod from its node subject to certain policies and safety constraints. -// This is a subresource of Pod. A request to cause such an eviction is -// created by POSTing to .../pods//eviction. -type Eviction struct { - metav1.TypeMeta `json:",inline"` - - // ObjectMeta describes the pod that is being evicted. - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // DeleteOptions may be provided - // +optional - DeleteOptions *v1.DeleteOptions `json:"deleteOptions,omitempty" protobuf:"bytes,2,opt,name=deleteOptions"` -} diff --git a/staging/src/k8s.io/client-go/pkg/util/cert/triple/BUILD b/staging/src/k8s.io/client-go/pkg/util/cert/triple/BUILD deleted file mode 100644 index a7403fd473c..00000000000 --- a/staging/src/k8s.io/client-go/pkg/util/cert/triple/BUILD +++ /dev/null @@ -1,18 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -load("@io_bazel_rules_go//go:def.bzl") - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/staging/src/k8s.io/client-go/plugin/pkg/client/auth/gcp/gcp.go b/staging/src/k8s.io/client-go/plugin/pkg/client/auth/gcp/gcp.go index 84a957675f0..a891fd575c1 100644 --- a/staging/src/k8s.io/client-go/plugin/pkg/client/auth/gcp/gcp.go +++ b/staging/src/k8s.io/client-go/plugin/pkg/client/auth/gcp/gcp.go @@ -32,11 +32,11 @@ import ( "golang.org/x/oauth2/google" "k8s.io/apimachinery/pkg/util/yaml" "k8s.io/client-go/pkg/util/jsonpath" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" ) func init() { - if err := rest.RegisterAuthProviderPlugin("gcp", newGCPAuthProvider); err != nil { + if err := restclient.RegisterAuthProviderPlugin("gcp", newGCPAuthProvider); err != nil { glog.Fatalf("Failed to register gcp auth plugin: %v", err) } } @@ -85,10 +85,10 @@ func init() { // type gcpAuthProvider struct { tokenSource oauth2.TokenSource - persister rest.AuthProviderConfigPersister + persister restclient.AuthProviderConfigPersister } -func newGCPAuthProvider(_ string, gcpConfig map[string]string, persister rest.AuthProviderConfigPersister) (rest.AuthProvider, error) { +func newGCPAuthProvider(_ string, gcpConfig map[string]string, persister restclient.AuthProviderConfigPersister) (restclient.AuthProvider, error) { cmd, useCmd := gcpConfig["cmd-path"] var ts oauth2.TokenSource var err error @@ -121,11 +121,11 @@ type cachedTokenSource struct { source oauth2.TokenSource accessToken string expiry time.Time - persister rest.AuthProviderConfigPersister + persister restclient.AuthProviderConfigPersister cache map[string]string } -func newCachedTokenSource(accessToken, expiry string, persister rest.AuthProviderConfigPersister, ts oauth2.TokenSource, cache map[string]string) (*cachedTokenSource, error) { +func newCachedTokenSource(accessToken, expiry string, persister restclient.AuthProviderConfigPersister, ts oauth2.TokenSource, cache map[string]string) (*cachedTokenSource, error) { var expiryTime time.Time if parsedTime, err := time.Parse(time.RFC3339Nano, expiry); err == nil { expiryTime = parsedTime diff --git a/staging/src/k8s.io/client-go/plugin/pkg/client/auth/oidc/oidc.go b/staging/src/k8s.io/client-go/plugin/pkg/client/auth/oidc/oidc.go index 606be4538d2..ca5b72cbd60 100644 --- a/staging/src/k8s.io/client-go/plugin/pkg/client/auth/oidc/oidc.go +++ b/staging/src/k8s.io/client-go/plugin/pkg/client/auth/oidc/oidc.go @@ -30,7 +30,7 @@ import ( "github.com/coreos/go-oidc/oidc" "github.com/golang/glog" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" ) const ( @@ -45,7 +45,7 @@ const ( ) func init() { - if err := rest.RegisterAuthProviderPlugin("oidc", newOIDCAuthProvider); err != nil { + if err := restclient.RegisterAuthProviderPlugin("oidc", newOIDCAuthProvider); err != nil { glog.Fatalf("Failed to register oidc auth plugin: %v", err) } } @@ -106,7 +106,7 @@ func (c *clientCache) setClient(issuer, clientID, clientSecret string, client *o return client } -func newOIDCAuthProvider(_ string, cfg map[string]string, persister rest.AuthProviderConfigPersister) (rest.AuthProvider, error) { +func newOIDCAuthProvider(_ string, cfg map[string]string, persister restclient.AuthProviderConfigPersister) (restclient.AuthProvider, error) { issuer := cfg[cfgIssuerUrl] if issuer == "" { return nil, fmt.Errorf("Must provide %s", cfgIssuerUrl) @@ -136,14 +136,14 @@ func newOIDCAuthProvider(_ string, cfg map[string]string, persister rest.AuthPro } } - clientConfig := rest.Config{ - TLSClientConfig: rest.TLSClientConfig{ + clientConfig := restclient.Config{ + TLSClientConfig: restclient.TLSClientConfig{ CAFile: cfg[cfgCertificateAuthority], CAData: certAuthData, }, } - trans, err := rest.TransportFor(&clientConfig) + trans, err := restclient.TransportFor(&clientConfig) if err != nil { return nil, err } @@ -191,7 +191,7 @@ type oidcAuthProvider struct { // the RoundTripper only trigger a single refresh request. mu sync.Mutex cfg map[string]string - persister rest.AuthProviderConfigPersister + persister restclient.AuthProviderConfigPersister } func (p *oidcAuthProvider) WrapTransport(rt http.RoundTripper) http.RoundTripper { diff --git a/staging/src/k8s.io/client-go/rest/fake/fake.go b/staging/src/k8s.io/client-go/rest/fake/fake.go index 7882006fe79..f3447f44721 100644 --- a/staging/src/k8s.io/client-go/rest/fake/fake.go +++ b/staging/src/k8s.io/client-go/rest/fake/fake.go @@ -28,7 +28,7 @@ import ( "k8s.io/client-go/pkg/api" "k8s.io/client-go/pkg/api/testapi" "k8s.io/client-go/pkg/util/flowcontrol" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" ) func CreateHTTPClient(roundTripper func(*http.Request) (*http.Response, error)) *http.Client { @@ -54,27 +54,27 @@ type RESTClient struct { Err error } -func (c *RESTClient) Get() *rest.Request { +func (c *RESTClient) Get() *restclient.Request { return c.request("GET") } -func (c *RESTClient) Put() *rest.Request { +func (c *RESTClient) Put() *restclient.Request { return c.request("PUT") } -func (c *RESTClient) Patch(_ types.PatchType) *rest.Request { +func (c *RESTClient) Patch(_ types.PatchType) *restclient.Request { return c.request("PATCH") } -func (c *RESTClient) Post() *rest.Request { +func (c *RESTClient) Post() *restclient.Request { return c.request("POST") } -func (c *RESTClient) Delete() *rest.Request { +func (c *RESTClient) Delete() *restclient.Request { return c.request("DELETE") } -func (c *RESTClient) Verb(verb string) *rest.Request { +func (c *RESTClient) Verb(verb string) *restclient.Request { return c.request(verb) } @@ -86,8 +86,8 @@ func (c *RESTClient) GetRateLimiter() flowcontrol.RateLimiter { return nil } -func (c *RESTClient) request(verb string) *rest.Request { - config := rest.ContentConfig{ +func (c *RESTClient) request(verb string) *restclient.Request { + config := restclient.ContentConfig{ ContentType: runtime.ContentTypeJSON, GroupVersion: &api.Registry.GroupOrDie(api.GroupName).GroupVersion, NegotiatedSerializer: c.NegotiatedSerializer, @@ -104,7 +104,7 @@ func (c *RESTClient) request(verb string) *rest.Request { Version: runtime.APIVersionInternal, } internalVersion.Version = runtime.APIVersionInternal - serializers := rest.Serializers{ + serializers := restclient.Serializers{ Encoder: ns.EncoderForVersion(info.Serializer, api.Registry.GroupOrDie(api.GroupName).GroupVersion), Decoder: ns.DecoderToVersion(info.Serializer, internalVersion), } @@ -112,7 +112,7 @@ func (c *RESTClient) request(verb string) *rest.Request { serializers.StreamingSerializer = info.StreamSerializer.Serializer serializers.Framer = info.StreamSerializer.Framer } - return rest.NewRequest(c, verb, &url.URL{Host: "localhost"}, "", config, serializers, nil, nil) + return restclient.NewRequest(c, verb, &url.URL{Host: "localhost"}, "", config, serializers, nil, nil) } func (c *RESTClient) Do(req *http.Request) (*http.Response, error) { diff --git a/staging/src/k8s.io/client-go/testing/fake.go b/staging/src/k8s.io/client-go/testing/fake.go index 32a860f8e35..da47b23b952 100644 --- a/staging/src/k8s.io/client-go/testing/fake.go +++ b/staging/src/k8s.io/client-go/testing/fake.go @@ -26,7 +26,7 @@ import ( "k8s.io/apimachinery/pkg/version" "k8s.io/apimachinery/pkg/watch" kubeversion "k8s.io/client-go/pkg/version" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" ) // Fake implements client.Interface. Meant to be embedded into a struct to get @@ -77,7 +77,7 @@ type ProxyReactor interface { Handles(action Action) bool // React handles a watch action and returns results. It may choose to // delegate by indicating handled=false. - React(action Action) (handled bool, ret rest.ResponseWrapper, err error) + React(action Action) (handled bool, ret restclient.ResponseWrapper, err error) } // ReactionFunc is a function that returns an object or error for a given @@ -95,7 +95,7 @@ type WatchReactionFunc func(action Action) (handled bool, ret watch.Interface, e // ProxyReactionFunc is a function that returns a ResponseWrapper interface // for a given Action. If "handled" is false, then the test client will // ignore the results and continue to the next ProxyReactionFunc. -type ProxyReactionFunc func(action Action) (handled bool, ret rest.ResponseWrapper, err error) +type ProxyReactionFunc func(action Action) (handled bool, ret restclient.ResponseWrapper, err error) // AddReactor appends a reactor to the end of the chain. func (c *Fake) AddReactor(verb, resource string, reaction ReactionFunc) { @@ -176,7 +176,7 @@ func (c *Fake) InvokesWatch(action Action) (watch.Interface, error) { // InvokesProxy records the provided Action and then invokes the ReactionFunc // that handles the action if one exists. -func (c *Fake) InvokesProxy(action Action) rest.ResponseWrapper { +func (c *Fake) InvokesProxy(action Action) restclient.ResponseWrapper { c.Lock() defer c.Unlock() diff --git a/staging/src/k8s.io/client-go/testing/fixture.go b/staging/src/k8s.io/client-go/testing/fixture.go index 065022183c1..64a617cf854 100644 --- a/staging/src/k8s.io/client-go/testing/fixture.go +++ b/staging/src/k8s.io/client-go/testing/fixture.go @@ -27,7 +27,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/pkg/api" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" ) // ObjectTracker keeps track of objects. It is intended to be used to @@ -511,6 +511,6 @@ func (r *SimpleProxyReactor) Handles(action Action) bool { return true } -func (r *SimpleProxyReactor) React(action Action) (bool, rest.ResponseWrapper, error) { +func (r *SimpleProxyReactor) React(action Action) (bool, restclient.ResponseWrapper, error) { return r.Reaction(action) } diff --git a/staging/src/k8s.io/client-go/tools/auth/clientauth.go b/staging/src/k8s.io/client-go/tools/auth/clientauth.go index d820adcafe2..2213b987816 100644 --- a/staging/src/k8s.io/client-go/tools/auth/clientauth.go +++ b/staging/src/k8s.io/client-go/tools/auth/clientauth.go @@ -68,7 +68,7 @@ import ( "io/ioutil" "os" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" ) // Info holds Kubernetes API authorization config. It is intended @@ -104,8 +104,8 @@ func LoadFromFile(path string) (*Info, error) { // MergeWithConfig returns a copy of a client.Config with values from the Info. // The fields of client.Config with a corresponding field in the Info are set // with the value from the Info. -func (info Info) MergeWithConfig(c rest.Config) (rest.Config, error) { - var config rest.Config = c +func (info Info) MergeWithConfig(c restclient.Config) (restclient.Config, error) { + var config restclient.Config = c config.Username = info.User config.Password = info.Password config.CAFile = info.CAFile diff --git a/staging/src/k8s.io/client-go/tools/cache/listwatch.go b/staging/src/k8s.io/client-go/tools/cache/listwatch.go index c1270060a0a..c3d1eeceafd 100644 --- a/staging/src/k8s.io/client-go/tools/cache/listwatch.go +++ b/staging/src/k8s.io/client-go/tools/cache/listwatch.go @@ -25,7 +25,7 @@ import ( "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/pkg/api" "k8s.io/client-go/pkg/api/v1" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" ) // ListerWatcher is any object that knows how to perform an initial list and start a watch on a resource. @@ -53,7 +53,7 @@ type ListWatch struct { // Getter interface knows how to access Get method from RESTClient. type Getter interface { - Get() *rest.Request + Get() *restclient.Request } // NewListWatchFromClient creates a new ListWatch from the specified client, resource, namespace and field selector. diff --git a/staging/src/k8s.io/client-go/tools/clientcmd/client_config.go b/staging/src/k8s.io/client-go/tools/clientcmd/client_config.go index 66206879884..39e923ea00a 100644 --- a/staging/src/k8s.io/client-go/tools/clientcmd/client_config.go +++ b/staging/src/k8s.io/client-go/tools/clientcmd/client_config.go @@ -28,7 +28,7 @@ import ( "github.com/imdario/mergo" "k8s.io/client-go/pkg/api" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" clientauth "k8s.io/client-go/tools/auth" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ) @@ -58,7 +58,7 @@ type ClientConfig interface { // RawConfig returns the merged result of all overrides RawConfig() (clientcmdapi.Config, error) // ClientConfig returns a complete client config - ClientConfig() (*rest.Config, error) + ClientConfig() (*restclient.Config, error) // Namespace returns the namespace resulting from the merged // result of all overrides and a boolean indicating if it was // overridden @@ -67,7 +67,7 @@ type ClientConfig interface { ConfigAccess() ConfigAccess } -type PersistAuthProviderConfigForUser func(user string) rest.AuthProviderConfigPersister +type PersistAuthProviderConfigForUser func(user string) restclient.AuthProviderConfigPersister type promptedCredentials struct { username string @@ -105,7 +105,7 @@ func (config *DirectClientConfig) RawConfig() (clientcmdapi.Config, error) { } // ClientConfig implements ClientConfig -func (config *DirectClientConfig) ClientConfig() (*rest.Config, error) { +func (config *DirectClientConfig) ClientConfig() (*restclient.Config, error) { // check that getAuthInfo, getContext, and getCluster do not return an error. // Do this before checking if the curent config is usable in the event that an // AuthInfo, Context, or Cluster config with user-defined names are not found. @@ -129,7 +129,7 @@ func (config *DirectClientConfig) ClientConfig() (*rest.Config, error) { return nil, err } - clientConfig := &rest.Config{} + clientConfig := &restclient.Config{} clientConfig.Host = configClusterInfo.Server if len(config.overrides.Timeout) > 0 { @@ -146,17 +146,17 @@ func (config *DirectClientConfig) ClientConfig() (*rest.Config, error) { clientConfig.Host = u.String() } if len(configAuthInfo.Impersonate) > 0 { - clientConfig.Impersonate = rest.ImpersonationConfig{UserName: configAuthInfo.Impersonate} + clientConfig.Impersonate = restclient.ImpersonationConfig{UserName: configAuthInfo.Impersonate} } // only try to read the auth information if we are secure - if rest.IsConfigTransportTLS(*clientConfig) { + if restclient.IsConfigTransportTLS(*clientConfig) { var err error // mergo is a first write wins for map value and a last writing wins for interface values // NOTE: This behavior changed with https://github.com/imdario/mergo/commit/d304790b2ed594794496464fadd89d2bb266600a. // Our mergo.Merge version is older than this change. - var persister rest.AuthProviderConfigPersister + var persister restclient.AuthProviderConfigPersister if config.configAccess != nil { authInfoName, _ := config.getAuthInfoName() persister = PersisterForUser(config.configAccess, authInfoName) @@ -183,11 +183,11 @@ func (config *DirectClientConfig) ClientConfig() (*rest.Config, error) { // 1. configClusterInfo (the final result of command line flags and merged .kubeconfig files) // 2. configAuthInfo.auth-path (this file can contain information that conflicts with #1, and we want #1 to win the priority) // 3. load the ~/.kubernetes_auth file as a default -func getServerIdentificationPartialConfig(configAuthInfo clientcmdapi.AuthInfo, configClusterInfo clientcmdapi.Cluster) (*rest.Config, error) { - mergedConfig := &rest.Config{} +func getServerIdentificationPartialConfig(configAuthInfo clientcmdapi.AuthInfo, configClusterInfo clientcmdapi.Cluster) (*restclient.Config, error) { + mergedConfig := &restclient.Config{} // configClusterInfo holds the information identify the server provided by .kubeconfig - configClientConfig := &rest.Config{} + configClientConfig := &restclient.Config{} configClientConfig.CAFile = configClusterInfo.CertificateAuthority configClientConfig.CAData = configClusterInfo.CertificateAuthorityData configClientConfig.Insecure = configClusterInfo.InsecureSkipTLSVerify @@ -203,8 +203,8 @@ func getServerIdentificationPartialConfig(configAuthInfo clientcmdapi.AuthInfo, // 2. configAuthInfo.auth-path (this file can contain information that conflicts with #1, and we want #1 to win the priority) // 3. if there is not enough information to idenfity the user, load try the ~/.kubernetes_auth file // 4. if there is not enough information to identify the user, prompt if possible -func (config *DirectClientConfig) getUserIdentificationPartialConfig(configAuthInfo clientcmdapi.AuthInfo, fallbackReader io.Reader, persistAuthConfig rest.AuthProviderConfigPersister) (*rest.Config, error) { - mergedConfig := &rest.Config{} +func (config *DirectClientConfig) getUserIdentificationPartialConfig(configAuthInfo clientcmdapi.AuthInfo, fallbackReader io.Reader, persistAuthConfig restclient.AuthProviderConfigPersister) (*restclient.Config, error) { + mergedConfig := &restclient.Config{} // blindly overwrite existing values based on precedence if len(configAuthInfo.Token) > 0 { @@ -217,7 +217,7 @@ func (config *DirectClientConfig) getUserIdentificationPartialConfig(configAuthI mergedConfig.BearerToken = string(tokenBytes) } if len(configAuthInfo.Impersonate) > 0 { - mergedConfig.Impersonate = rest.ImpersonationConfig{UserName: configAuthInfo.Impersonate} + mergedConfig.Impersonate = restclient.ImpersonationConfig{UserName: configAuthInfo.Impersonate} } if len(configAuthInfo.ClientCertificate) > 0 || len(configAuthInfo.ClientCertificateData) > 0 { mergedConfig.CertFile = configAuthInfo.ClientCertificate @@ -248,7 +248,7 @@ func (config *DirectClientConfig) getUserIdentificationPartialConfig(configAuthI } promptedConfig := makeUserIdentificationConfig(*promptedAuthInfo) previouslyMergedConfig := mergedConfig - mergedConfig = &rest.Config{} + mergedConfig = &restclient.Config{} mergo.Merge(mergedConfig, promptedConfig) mergo.Merge(mergedConfig, previouslyMergedConfig) config.promptedCredentials.username = mergedConfig.Username @@ -259,8 +259,8 @@ func (config *DirectClientConfig) getUserIdentificationPartialConfig(configAuthI } // makeUserIdentificationFieldsConfig returns a client.Config capable of being merged using mergo for only user identification information -func makeUserIdentificationConfig(info clientauth.Info) *rest.Config { - config := &rest.Config{} +func makeUserIdentificationConfig(info clientauth.Info) *restclient.Config { + config := &restclient.Config{} config.Username = info.User config.Password = info.Password config.CertFile = info.CertFile @@ -270,8 +270,8 @@ func makeUserIdentificationConfig(info clientauth.Info) *rest.Config { } // makeUserIdentificationFieldsConfig returns a client.Config capable of being merged using mergo for only server identification information -func makeServerIdentificationConfig(info clientauth.Info) rest.Config { - config := rest.Config{} +func makeServerIdentificationConfig(info clientauth.Info) restclient.Config { + config := restclient.Config{} config.CAFile = info.CAFile if info.Insecure != nil { config.Insecure = *info.Insecure @@ -279,7 +279,7 @@ func makeServerIdentificationConfig(info clientauth.Info) rest.Config { return config } -func canIdentifyUser(config rest.Config) bool { +func canIdentifyUser(config restclient.Config) bool { return len(config.Username) > 0 || (len(config.CertFile) > 0 || len(config.CertData) > 0) || len(config.BearerToken) > 0 || @@ -442,7 +442,7 @@ func (config *DirectClientConfig) getCluster() (clientcmdapi.Cluster, error) { // Can take options overrides for flags explicitly provided to the command inside the cluster container. type inClusterClientConfig struct { overrides *ConfigOverrides - inClusterConfigProvider func() (*rest.Config, error) + inClusterConfigProvider func() (*restclient.Config, error) } var _ ClientConfig = &inClusterClientConfig{} @@ -451,9 +451,9 @@ func (config *inClusterClientConfig) RawConfig() (clientcmdapi.Config, error) { return clientcmdapi.Config{}, fmt.Errorf("inCluster environment config doesn't support multiple clusters") } -func (config *inClusterClientConfig) ClientConfig() (*rest.Config, error) { +func (config *inClusterClientConfig) ClientConfig() (*restclient.Config, error) { if config.inClusterConfigProvider == nil { - config.inClusterConfigProvider = rest.InClusterConfig + config.inClusterConfigProvider = restclient.InClusterConfig } icc, err := config.inClusterConfigProvider() @@ -512,10 +512,10 @@ func (config *inClusterClientConfig) Possible() bool { // components. Warnings should reflect this usage. If neither masterUrl or kubeconfigPath // are passed in we fallback to inClusterConfig. If inClusterConfig fails, we fallback // to the default config. -func BuildConfigFromFlags(masterUrl, kubeconfigPath string) (*rest.Config, error) { +func BuildConfigFromFlags(masterUrl, kubeconfigPath string) (*restclient.Config, error) { if kubeconfigPath == "" && masterUrl == "" { glog.Warningf("Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.") - kubeconfig, err := rest.InClusterConfig() + kubeconfig, err := restclient.InClusterConfig() if err == nil { return kubeconfig, nil } @@ -528,7 +528,7 @@ func BuildConfigFromFlags(masterUrl, kubeconfigPath string) (*rest.Config, error // BuildConfigFromKubeconfigGetter is a helper function that builds configs from a master // url and a kubeconfigGetter. -func BuildConfigFromKubeconfigGetter(masterUrl string, kubeconfigGetter KubeconfigGetter) (*rest.Config, error) { +func BuildConfigFromKubeconfigGetter(masterUrl string, kubeconfigGetter KubeconfigGetter) (*restclient.Config, error) { // TODO: We do not need a DeferredLoader here. Refactor code and see if we can use DirectClientConfig here. cc := NewNonInteractiveDeferredLoadingClientConfig( &ClientConfigGetter{kubeconfigGetter: kubeconfigGetter}, diff --git a/staging/src/k8s.io/client-go/tools/clientcmd/client_config_test.go b/staging/src/k8s.io/client-go/tools/clientcmd/client_config_test.go index c78cca276f5..0cbff3f8efa 100644 --- a/staging/src/k8s.io/client-go/tools/clientcmd/client_config_test.go +++ b/staging/src/k8s.io/client-go/tools/clientcmd/client_config_test.go @@ -24,7 +24,7 @@ import ( "testing" "github.com/imdario/mergo" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ) @@ -448,11 +448,11 @@ func TestInClusterClientConfigPrecedence(t *testing.T) { expectedCAFile := "/path/to/ca-from-cluster.crt" icc := &inClusterClientConfig{ - inClusterConfigProvider: func() (*rest.Config, error) { - return &rest.Config{ + inClusterConfigProvider: func() (*restclient.Config, error) { + return &restclient.Config{ Host: expectedServer, BearerToken: expectedToken, - TLSClientConfig: rest.TLSClientConfig{ + TLSClientConfig: restclient.TLSClientConfig{ CAFile: expectedCAFile, }, }, nil diff --git a/staging/src/k8s.io/client-go/tools/clientcmd/config.go b/staging/src/k8s.io/client-go/tools/clientcmd/config.go index 3e5aa49a38f..16ccdaf20a2 100644 --- a/staging/src/k8s.io/client-go/tools/clientcmd/config.go +++ b/staging/src/k8s.io/client-go/tools/clientcmd/config.go @@ -26,7 +26,7 @@ import ( "github.com/golang/glog" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ) @@ -325,7 +325,7 @@ func ModifyConfig(configAccess ConfigAccess, newConfig clientcmdapi.Config, rela return nil } -func PersisterForUser(configAccess ConfigAccess, user string) rest.AuthProviderConfigPersister { +func PersisterForUser(configAccess ConfigAccess, user string) restclient.AuthProviderConfigPersister { return &persister{configAccess, user} } diff --git a/staging/src/k8s.io/client-go/tools/clientcmd/loader.go b/staging/src/k8s.io/client-go/tools/clientcmd/loader.go index 5fcc0ad5f7c..9d8b6592c54 100644 --- a/staging/src/k8s.io/client-go/tools/clientcmd/loader.go +++ b/staging/src/k8s.io/client-go/tools/clientcmd/loader.go @@ -34,7 +34,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" utilerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/client-go/pkg/util/homedir" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" clientcmdlatest "k8s.io/client-go/tools/clientcmd/api/latest" ) @@ -68,7 +68,7 @@ func currentMigrationRules() map[string]string { type ClientConfigLoader interface { ConfigAccess // IsDefaultConfig returns true if the returned config matches the defaults. - IsDefaultConfig(*rest.Config) bool + IsDefaultConfig(*restclient.Config) bool // Load returns the latest config Load() (*clientcmdapi.Config, error) } @@ -101,7 +101,7 @@ func (g *ClientConfigGetter) IsExplicitFile() bool { func (g *ClientConfigGetter) GetExplicitFile() string { return "" } -func (g *ClientConfigGetter) IsDefaultConfig(config *rest.Config) bool { +func (g *ClientConfigGetter) IsDefaultConfig(config *restclient.Config) bool { return false } @@ -330,7 +330,7 @@ func (rules *ClientConfigLoadingRules) GetExplicitFile() string { } // IsDefaultConfig returns true if the provided configuration matches the default -func (rules *ClientConfigLoadingRules) IsDefaultConfig(config *rest.Config) bool { +func (rules *ClientConfigLoadingRules) IsDefaultConfig(config *restclient.Config) bool { if rules.DefaultClientConfig == nil { return false } diff --git a/staging/src/k8s.io/client-go/tools/clientcmd/merged_client_builder.go b/staging/src/k8s.io/client-go/tools/clientcmd/merged_client_builder.go index ef15deed25f..92c1a5a0061 100644 --- a/staging/src/k8s.io/client-go/tools/clientcmd/merged_client_builder.go +++ b/staging/src/k8s.io/client-go/tools/clientcmd/merged_client_builder.go @@ -22,7 +22,7 @@ import ( "github.com/golang/glog" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ) @@ -94,7 +94,7 @@ func (config *DeferredLoadingClientConfig) RawConfig() (clientcmdapi.Config, err } // ClientConfig implements ClientConfig -func (config *DeferredLoadingClientConfig) ClientConfig() (*rest.Config, error) { +func (config *DeferredLoadingClientConfig) ClientConfig() (*restclient.Config, error) { mergedClientConfig, err := config.createClientConfig() if err != nil { return nil, err diff --git a/staging/src/k8s.io/client-go/tools/clientcmd/merged_client_builder_test.go b/staging/src/k8s.io/client-go/tools/clientcmd/merged_client_builder_test.go index e73fc93b117..8b0386764d5 100644 --- a/staging/src/k8s.io/client-go/tools/clientcmd/merged_client_builder_test.go +++ b/staging/src/k8s.io/client-go/tools/clientcmd/merged_client_builder_test.go @@ -20,7 +20,7 @@ import ( "fmt" "testing" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ) @@ -38,7 +38,7 @@ func (l *testLoader) Load() (*clientcmdapi.Config, error) { } type testClientConfig struct { - config *rest.Config + config *restclient.Config namespace string namespaceSpecified bool err error @@ -47,7 +47,7 @@ type testClientConfig struct { func (c *testClientConfig) RawConfig() (clientcmdapi.Config, error) { return clientcmdapi.Config{}, fmt.Errorf("unexpected call") } -func (c *testClientConfig) ClientConfig() (*rest.Config, error) { +func (c *testClientConfig) ClientConfig() (*restclient.Config, error) { return c.config, c.err } func (c *testClientConfig) Namespace() (string, bool, error) { @@ -95,7 +95,7 @@ func TestInClusterConfig(t *testing.T) { if err != nil { t.Fatal(err) } - config2 := &rest.Config{Host: "config2"} + config2 := &restclient.Config{Host: "config2"} err1 := fmt.Errorf("unique error") testCases := map[string]struct { @@ -104,7 +104,7 @@ func TestInClusterConfig(t *testing.T) { defaultConfig *DirectClientConfig checkedICC bool - result *rest.Config + result *restclient.Config err error }{ "in-cluster checked on other error": { diff --git a/staging/src/k8s.io/client-go/tools/record/event.go b/staging/src/k8s.io/client-go/tools/record/event.go index 9162fc0c24a..e195cc838b3 100644 --- a/staging/src/k8s.io/client-go/tools/record/event.go +++ b/staging/src/k8s.io/client-go/tools/record/event.go @@ -28,7 +28,7 @@ import ( "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/pkg/util/clock" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" "net/http" @@ -188,7 +188,7 @@ func recordEvent(sink EventSink, event *v1.Event, patch []byte, updateExistingEv // If we can't contact the server, then hold everything while we keep trying. // Otherwise, something about the event is malformed and we should abandon it. switch err.(type) { - case *rest.RequestConstructionError: + case *restclient.RequestConstructionError: // We will construct the request the same next time, so don't keep trying. glog.Errorf("Unable to construct event '%#v': '%v' (will not retry!)", event, err) return true diff --git a/staging/src/k8s.io/client-go/tools/record/event_test.go b/staging/src/k8s.io/client-go/tools/record/event_test.go index cfef4fb8550..60bc928eed4 100644 --- a/staging/src/k8s.io/client-go/tools/record/event_test.go +++ b/staging/src/k8s.io/client-go/tools/record/event_test.go @@ -32,7 +32,7 @@ import ( "k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/pkg/util/clock" "k8s.io/client-go/pkg/util/strategicpatch" - "k8s.io/client-go/rest" + restclient "k8s.io/client-go/rest" ) type testEventSink struct { @@ -387,7 +387,7 @@ func TestWriteEventError(t *testing.T) { "giveUp1": { timesToSendError: 1000, attemptsWanted: 1, - err: &rest.RequestConstructionError{}, + err: &restclient.RequestConstructionError{}, }, "giveUp2": { timesToSendError: 1000, diff --git a/vendor/BUILD b/vendor/BUILD index 3bd9187678b..8938efee3d4 100644 --- a/vendor/BUILD +++ b/vendor/BUILD @@ -11270,48 +11270,6 @@ go_library( ], ) -go_library( - name = "k8s.io/client-go/kubernetes/typed/policy/v1alpha1", - srcs = [ - "k8s.io/client-go/kubernetes/typed/policy/v1alpha1/doc.go", - "k8s.io/client-go/kubernetes/typed/policy/v1alpha1/generated_expansion.go", - "k8s.io/client-go/kubernetes/typed/policy/v1alpha1/poddisruptionbudget.go", - "k8s.io/client-go/kubernetes/typed/policy/v1alpha1/policy_client.go", - ], - tags = ["automanaged"], - deps = [ - "//vendor:k8s.io/apimachinery/pkg/runtime/schema", - "//vendor:k8s.io/apimachinery/pkg/runtime/serializer", - "//vendor:k8s.io/apimachinery/pkg/types", - "//vendor:k8s.io/apimachinery/pkg/watch", - "//vendor:k8s.io/client-go/pkg/api", - "//vendor:k8s.io/client-go/pkg/api/v1", - "//vendor:k8s.io/client-go/pkg/apis/policy/v1alpha1", - "//vendor:k8s.io/client-go/rest", - ], -) - -go_library( - name = "k8s.io/client-go/kubernetes/typed/policy/v1alpha1/fake", - srcs = [ - "k8s.io/client-go/kubernetes/typed/policy/v1alpha1/fake/doc.go", - "k8s.io/client-go/kubernetes/typed/policy/v1alpha1/fake/fake_poddisruptionbudget.go", - "k8s.io/client-go/kubernetes/typed/policy/v1alpha1/fake/fake_policy_client.go", - ], - tags = ["automanaged"], - deps = [ - "//vendor:k8s.io/apimachinery/pkg/labels", - "//vendor:k8s.io/apimachinery/pkg/runtime/schema", - "//vendor:k8s.io/apimachinery/pkg/types", - "//vendor:k8s.io/apimachinery/pkg/watch", - "//vendor:k8s.io/client-go/kubernetes/typed/policy/v1alpha1", - "//vendor:k8s.io/client-go/pkg/api/v1", - "//vendor:k8s.io/client-go/pkg/apis/policy/v1alpha1", - "//vendor:k8s.io/client-go/rest", - "//vendor:k8s.io/client-go/testing", - ], -) - go_library( name = "k8s.io/client-go/kubernetes/typed/policy/v1beta1", srcs = [ @@ -11616,12 +11574,6 @@ go_library( ], ) -go_library( - name = "k8s.io/client-go/pkg/api/validation/path", - srcs = ["k8s.io/client-go/pkg/api/validation/path/name.go"], - tags = ["automanaged"], -) - go_library( name = "k8s.io/client-go/pkg/apimachinery/announced", srcs = [ @@ -12299,23 +12251,6 @@ go_library( ], ) -go_library( - name = "k8s.io/client-go/pkg/apis/policy/v1alpha1", - srcs = [ - "k8s.io/client-go/pkg/apis/policy/v1alpha1/doc.go", - "k8s.io/client-go/pkg/apis/policy/v1alpha1/register.go", - "k8s.io/client-go/pkg/apis/policy/v1alpha1/types.go", - ], - tags = ["automanaged"], - deps = [ - "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", - "//vendor:k8s.io/apimachinery/pkg/runtime", - "//vendor:k8s.io/apimachinery/pkg/runtime/schema", - "//vendor:k8s.io/client-go/pkg/api/v1", - "//vendor:k8s.io/client-go/pkg/util/intstr", - ], -) - go_library( name = "k8s.io/client-go/pkg/apis/policy/v1beta1", srcs = [ @@ -12966,7 +12901,6 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/watch", "//vendor:k8s.io/client-go/pkg/api", "//vendor:k8s.io/client-go/pkg/api/v1", - "//vendor:k8s.io/client-go/pkg/api/validation/path", "//vendor:k8s.io/client-go/pkg/util/cert", "//vendor:k8s.io/client-go/pkg/util/flowcontrol", "//vendor:k8s.io/client-go/pkg/version",