diff --git a/cmd/e2e-test/affinity_beta_test.go b/cmd/e2e-test/affinity_beta_test.go index ddfabb247a..0dffa7228a 100644 --- a/cmd/e2e-test/affinity_beta_test.go +++ b/cmd/e2e-test/affinity_beta_test.go @@ -65,7 +65,7 @@ func TestAffinityBeta(t *testing.T) { }, }, } - if _, err := Framework.BackendConfigClient.CloudV1beta1().BackendConfigs(s.Namespace).Create(beConfig); err != nil { + if _, err := Framework.BackendConfigClient.CloudV1beta1().BackendConfigs(s.Namespace).Create(context.TODO(), beConfig, metav1.CreateOptions{}); err != nil { t.Fatalf("CloudV1beta1().BackendConfigs(%q).Create(%#v) = %v, want nil", s.Namespace, beConfig, err) } t.Logf("BackendConfig created (%s/%s) ", s.Namespace, beConfig.Name) @@ -110,7 +110,7 @@ func TestAffinityBeta(t *testing.T) { for _, transition := range affinityTransitions { // Test modifications. if err := retry.RetryOnConflict(retry.DefaultRetry, func() error { - bc, err := Framework.BackendConfigClient.CloudV1beta1().BackendConfigs(s.Namespace).Get(beConfig.Name, metav1.GetOptions{}) + bc, err := Framework.BackendConfigClient.CloudV1beta1().BackendConfigs(s.Namespace).Get(context.TODO(), beConfig.Name, metav1.GetOptions{}) if err != nil { return err } @@ -119,7 +119,7 @@ func TestAffinityBeta(t *testing.T) { } bc.Spec.SessionAffinity.AffinityType = transition.affinity bc.Spec.SessionAffinity.AffinityCookieTtlSec = &transition.ttl - _, err = Framework.BackendConfigClient.CloudV1beta1().BackendConfigs(s.Namespace).Update(bc) + _, err = Framework.BackendConfigClient.CloudV1beta1().BackendConfigs(s.Namespace).Update(context.TODO(), bc, metav1.UpdateOptions{}) return err }); err != nil { t.Errorf("CloudV1beta1().BackendConfigs(%q).Update(%#v) = %v, want nil", s.Namespace, transition, err) diff --git a/go.sum b/go.sum index 883378dc88..ed03d9ae6d 100644 --- a/go.sum +++ b/go.sum @@ -675,6 +675,7 @@ golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190909030654-5b82db07426d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72 h1:bw9doJza/SFBEweII/rHQh338oozWyiFsBRHtrflcws= golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= @@ -777,6 +778,7 @@ k8s.io/component-base v0.18.0/go.mod h1:u3BCg0z1uskkzrnAKFzulmYaEpZF7XC9Pf/uFyb1 k8s.io/cri-api v0.18.0/go.mod h1:OJtpjDvfsKoLGhvcc0qfygved0S0dGX56IJzPbqTG1s= k8s.io/csi-translation-lib v0.18.0/go.mod h1:iF8TE4ACSaPqN1qxmiIjvcU1A8VgkOrpcFGD7Z0hVu0= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/gengo v0.0.0-20200114144118-36b2048a9120 h1:RPscN6KhmG54S33L+lr3GS+oD1jmchIU0ll519K6FA4= k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/heapster v1.2.0-beta.1/go.mod h1:h1uhptVXMwC8xtZBYsPXKVi8fpdlYkTs6k949KozGrM= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= diff --git a/pkg/apis/backendconfig/v1/zz_generated.openapi.go b/pkg/apis/backendconfig/v1/zz_generated.openapi.go index e3433557da..d82f241662 100644 --- a/pkg/apis/backendconfig/v1/zz_generated.openapi.go +++ b/pkg/apis/backendconfig/v1/zz_generated.openapi.go @@ -51,14 +51,14 @@ func schema_pkg_apis_backendconfig_v1_BackendConfig(ref common.ReferenceCallback Properties: map[string]spec.Schema{ "kind": { SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", Type: []string{"string"}, Format: "", }, }, "apiVersion": { SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", Type: []string{"string"}, Format: "", }, @@ -134,9 +134,9 @@ func schema_pkg_apis_backendconfig_v1_BackendConfigSpec(ref common.ReferenceCall Ref: ref("k8s.io/ingress-gce/pkg/apis/backendconfig/v1.HealthCheckConfig"), }, }, - "log": { + "logging": { SchemaProps: spec.SchemaProps{ - Description: "Log specifies logging specification for Backend Services.", + Description: "Logging specifies the configuration for access logs.", Ref: ref("k8s.io/ingress-gce/pkg/apis/backendconfig/v1.LogConfig"), }, }, @@ -327,8 +327,9 @@ func schema_pkg_apis_backendconfig_v1_HealthCheckConfig(ref common.ReferenceCall }, "port": { SchemaProps: spec.SchemaProps{ - Type: []string{"integer"}, - Format: "int64", + Description: "Port is a health check parameter. See https://cloud.google.com/compute/docs/reference/rest/v1/healthChecks. If Port is used, the controller updates portSpecification as well", + Type: []string{"integer"}, + Format: "int64", }, }, "requestPath": { diff --git a/pkg/apis/backendconfig/v1beta1/zz_generated.openapi.go b/pkg/apis/backendconfig/v1beta1/zz_generated.openapi.go index e7b4f4200e..5c25dcf9dc 100644 --- a/pkg/apis/backendconfig/v1beta1/zz_generated.openapi.go +++ b/pkg/apis/backendconfig/v1beta1/zz_generated.openapi.go @@ -50,14 +50,14 @@ func schema_pkg_apis_backendconfig_v1beta1_BackendConfig(ref common.ReferenceCal Properties: map[string]spec.Schema{ "kind": { SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", Type: []string{"string"}, Format: "", }, }, "apiVersion": { SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", Type: []string{"string"}, Format: "", }, diff --git a/pkg/backendconfig/client/clientset/versioned/clientset.go b/pkg/backendconfig/client/clientset/versioned/clientset.go index 854b2ea8a2..d000be938c 100644 --- a/pkg/backendconfig/client/clientset/versioned/clientset.go +++ b/pkg/backendconfig/client/clientset/versioned/clientset.go @@ -67,7 +67,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { configShallowCopy := *c if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.Burst <= 0 { - return nil, fmt.Errorf("Burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") + return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") } configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) } diff --git a/pkg/backendconfig/client/clientset/versioned/typed/backendconfig/v1/backendconfig.go b/pkg/backendconfig/client/clientset/versioned/typed/backendconfig/v1/backendconfig.go index c67a054056..ea57e3fc73 100644 --- a/pkg/backendconfig/client/clientset/versioned/typed/backendconfig/v1/backendconfig.go +++ b/pkg/backendconfig/client/clientset/versioned/typed/backendconfig/v1/backendconfig.go @@ -38,14 +38,14 @@ type BackendConfigsGetter interface { // BackendConfigInterface has methods to work with BackendConfig resources. type BackendConfigInterface interface { - Create(*v1.BackendConfig) (*v1.BackendConfig, error) - Update(*v1.BackendConfig) (*v1.BackendConfig, error) - Delete(name string, options *metav1.DeleteOptions) error - DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error - Get(name string, options metav1.GetOptions) (*v1.BackendConfig, error) - List(opts metav1.ListOptions) (*v1.BackendConfigList, error) - Watch(opts metav1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.BackendConfig, err error) + Create(ctx context.Context, backendConfig *v1.BackendConfig, opts metav1.CreateOptions) (*v1.BackendConfig, error) + Update(ctx context.Context, backendConfig *v1.BackendConfig, opts metav1.UpdateOptions) (*v1.BackendConfig, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.BackendConfig, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.BackendConfigList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.BackendConfig, err error) BackendConfigExpansion } @@ -64,20 +64,20 @@ func newBackendConfigs(c *CloudV1Client, namespace string) *backendConfigs { } // Get takes name of the backendConfig, and returns the corresponding backendConfig object, and an error if there is any. -func (c *backendConfigs) Get(name string, options metav1.GetOptions) (result *v1.BackendConfig, err error) { +func (c *backendConfigs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.BackendConfig, err error) { result = &v1.BackendConfig{} err = c.client.Get(). Namespace(c.ns). Resource("backendconfigs"). Name(name). VersionedParams(&options, scheme.ParameterCodec). - Do(context.TODO()). + Do(ctx). Into(result) return } // List takes label and field selectors, and returns the list of BackendConfigs that match those selectors. -func (c *backendConfigs) List(opts metav1.ListOptions) (result *v1.BackendConfigList, err error) { +func (c *backendConfigs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.BackendConfigList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -88,13 +88,13 @@ func (c *backendConfigs) List(opts metav1.ListOptions) (result *v1.BackendConfig Resource("backendconfigs"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Do(context.TODO()). + Do(ctx). Into(result) return } // Watch returns a watch.Interface that watches the requested backendConfigs. -func (c *backendConfigs) Watch(opts metav1.ListOptions) (watch.Interface, error) { +func (c *backendConfigs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -105,71 +105,74 @@ func (c *backendConfigs) Watch(opts metav1.ListOptions) (watch.Interface, error) Resource("backendconfigs"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Watch(context.TODO()) + Watch(ctx) } // Create takes the representation of a backendConfig and creates it. Returns the server's representation of the backendConfig, and an error, if there is any. -func (c *backendConfigs) Create(backendConfig *v1.BackendConfig) (result *v1.BackendConfig, err error) { +func (c *backendConfigs) Create(ctx context.Context, backendConfig *v1.BackendConfig, opts metav1.CreateOptions) (result *v1.BackendConfig, err error) { result = &v1.BackendConfig{} err = c.client.Post(). Namespace(c.ns). Resource("backendconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). Body(backendConfig). - Do(context.TODO()). + Do(ctx). Into(result) return } // Update takes the representation of a backendConfig and updates it. Returns the server's representation of the backendConfig, and an error, if there is any. -func (c *backendConfigs) Update(backendConfig *v1.BackendConfig) (result *v1.BackendConfig, err error) { +func (c *backendConfigs) Update(ctx context.Context, backendConfig *v1.BackendConfig, opts metav1.UpdateOptions) (result *v1.BackendConfig, err error) { result = &v1.BackendConfig{} err = c.client.Put(). Namespace(c.ns). Resource("backendconfigs"). Name(backendConfig.Name). + VersionedParams(&opts, scheme.ParameterCodec). Body(backendConfig). - Do(context.TODO()). + Do(ctx). Into(result) return } // Delete takes name of the backendConfig and deletes it. Returns an error if one occurs. -func (c *backendConfigs) Delete(name string, options *metav1.DeleteOptions) error { +func (c *backendConfigs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("backendconfigs"). Name(name). - Body(options). - Do(context.TODO()). + Body(&opts). + Do(ctx). Error() } // DeleteCollection deletes a collection of objects. -func (c *backendConfigs) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { +func (c *backendConfigs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { var timeout time.Duration - if listOptions.TimeoutSeconds != nil { - timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second } return c.client.Delete(). Namespace(c.ns). Resource("backendconfigs"). - VersionedParams(&listOptions, scheme.ParameterCodec). + VersionedParams(&listOpts, scheme.ParameterCodec). Timeout(timeout). - Body(options). - Do(context.TODO()). + Body(&opts). + Do(ctx). Error() } // Patch applies the patch and returns the patched backendConfig. -func (c *backendConfigs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.BackendConfig, err error) { +func (c *backendConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.BackendConfig, err error) { result = &v1.BackendConfig{} err = c.client.Patch(pt). Namespace(c.ns). Resource("backendconfigs"). - SubResource(subresources...). Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). Body(data). - Do(context.TODO()). + Do(ctx). Into(result) return } diff --git a/pkg/backendconfig/client/clientset/versioned/typed/backendconfig/v1/fake/fake_backendconfig.go b/pkg/backendconfig/client/clientset/versioned/typed/backendconfig/v1/fake/fake_backendconfig.go index b67e8089a1..03a68c87c7 100644 --- a/pkg/backendconfig/client/clientset/versioned/typed/backendconfig/v1/fake/fake_backendconfig.go +++ b/pkg/backendconfig/client/clientset/versioned/typed/backendconfig/v1/fake/fake_backendconfig.go @@ -19,6 +19,8 @@ limitations under the License. package fake import ( + "context" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -39,7 +41,7 @@ var backendconfigsResource = schema.GroupVersionResource{Group: "cloud.google.co var backendconfigsKind = schema.GroupVersionKind{Group: "cloud.google.com", Version: "v1", Kind: "BackendConfig"} // Get takes name of the backendConfig, and returns the corresponding backendConfig object, and an error if there is any. -func (c *FakeBackendConfigs) Get(name string, options v1.GetOptions) (result *backendconfigv1.BackendConfig, err error) { +func (c *FakeBackendConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *backendconfigv1.BackendConfig, err error) { obj, err := c.Fake. Invokes(testing.NewGetAction(backendconfigsResource, c.ns, name), &backendconfigv1.BackendConfig{}) @@ -50,7 +52,7 @@ func (c *FakeBackendConfigs) Get(name string, options v1.GetOptions) (result *ba } // List takes label and field selectors, and returns the list of BackendConfigs that match those selectors. -func (c *FakeBackendConfigs) List(opts v1.ListOptions) (result *backendconfigv1.BackendConfigList, err error) { +func (c *FakeBackendConfigs) List(ctx context.Context, opts v1.ListOptions) (result *backendconfigv1.BackendConfigList, err error) { obj, err := c.Fake. Invokes(testing.NewListAction(backendconfigsResource, backendconfigsKind, c.ns, opts), &backendconfigv1.BackendConfigList{}) @@ -72,14 +74,14 @@ func (c *FakeBackendConfigs) List(opts v1.ListOptions) (result *backendconfigv1. } // Watch returns a watch.Interface that watches the requested backendConfigs. -func (c *FakeBackendConfigs) Watch(opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeBackendConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(backendconfigsResource, c.ns, opts)) } // Create takes the representation of a backendConfig and creates it. Returns the server's representation of the backendConfig, and an error, if there is any. -func (c *FakeBackendConfigs) Create(backendConfig *backendconfigv1.BackendConfig) (result *backendconfigv1.BackendConfig, err error) { +func (c *FakeBackendConfigs) Create(ctx context.Context, backendConfig *backendconfigv1.BackendConfig, opts v1.CreateOptions) (result *backendconfigv1.BackendConfig, err error) { obj, err := c.Fake. Invokes(testing.NewCreateAction(backendconfigsResource, c.ns, backendConfig), &backendconfigv1.BackendConfig{}) @@ -90,7 +92,7 @@ func (c *FakeBackendConfigs) Create(backendConfig *backendconfigv1.BackendConfig } // Update takes the representation of a backendConfig and updates it. Returns the server's representation of the backendConfig, and an error, if there is any. -func (c *FakeBackendConfigs) Update(backendConfig *backendconfigv1.BackendConfig) (result *backendconfigv1.BackendConfig, err error) { +func (c *FakeBackendConfigs) Update(ctx context.Context, backendConfig *backendconfigv1.BackendConfig, opts v1.UpdateOptions) (result *backendconfigv1.BackendConfig, err error) { obj, err := c.Fake. Invokes(testing.NewUpdateAction(backendconfigsResource, c.ns, backendConfig), &backendconfigv1.BackendConfig{}) @@ -101,7 +103,7 @@ func (c *FakeBackendConfigs) Update(backendConfig *backendconfigv1.BackendConfig } // Delete takes name of the backendConfig and deletes it. Returns an error if one occurs. -func (c *FakeBackendConfigs) Delete(name string, options *v1.DeleteOptions) error { +func (c *FakeBackendConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. Invokes(testing.NewDeleteAction(backendconfigsResource, c.ns, name), &backendconfigv1.BackendConfig{}) @@ -109,15 +111,15 @@ func (c *FakeBackendConfigs) Delete(name string, options *v1.DeleteOptions) erro } // DeleteCollection deletes a collection of objects. -func (c *FakeBackendConfigs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(backendconfigsResource, c.ns, listOptions) +func (c *FakeBackendConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(backendconfigsResource, c.ns, listOpts) _, err := c.Fake.Invokes(action, &backendconfigv1.BackendConfigList{}) return err } // Patch applies the patch and returns the patched backendConfig. -func (c *FakeBackendConfigs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *backendconfigv1.BackendConfig, err error) { +func (c *FakeBackendConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *backendconfigv1.BackendConfig, err error) { obj, err := c.Fake. Invokes(testing.NewPatchSubresourceAction(backendconfigsResource, c.ns, name, pt, data, subresources...), &backendconfigv1.BackendConfig{}) diff --git a/pkg/backendconfig/client/clientset/versioned/typed/backendconfig/v1beta1/backendconfig.go b/pkg/backendconfig/client/clientset/versioned/typed/backendconfig/v1beta1/backendconfig.go index 2210733e65..2cca49e5a0 100644 --- a/pkg/backendconfig/client/clientset/versioned/typed/backendconfig/v1beta1/backendconfig.go +++ b/pkg/backendconfig/client/clientset/versioned/typed/backendconfig/v1beta1/backendconfig.go @@ -38,14 +38,14 @@ type BackendConfigsGetter interface { // BackendConfigInterface has methods to work with BackendConfig resources. type BackendConfigInterface interface { - Create(*v1beta1.BackendConfig) (*v1beta1.BackendConfig, error) - Update(*v1beta1.BackendConfig) (*v1beta1.BackendConfig, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1beta1.BackendConfig, error) - List(opts v1.ListOptions) (*v1beta1.BackendConfigList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.BackendConfig, err error) + Create(ctx context.Context, backendConfig *v1beta1.BackendConfig, opts v1.CreateOptions) (*v1beta1.BackendConfig, error) + Update(ctx context.Context, backendConfig *v1beta1.BackendConfig, opts v1.UpdateOptions) (*v1beta1.BackendConfig, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.BackendConfig, error) + List(ctx context.Context, opts v1.ListOptions) (*v1beta1.BackendConfigList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.BackendConfig, err error) BackendConfigExpansion } @@ -64,20 +64,20 @@ func newBackendConfigs(c *CloudV1beta1Client, namespace string) *backendConfigs } // Get takes name of the backendConfig, and returns the corresponding backendConfig object, and an error if there is any. -func (c *backendConfigs) Get(name string, options v1.GetOptions) (result *v1beta1.BackendConfig, err error) { +func (c *backendConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.BackendConfig, err error) { result = &v1beta1.BackendConfig{} err = c.client.Get(). Namespace(c.ns). Resource("backendconfigs"). Name(name). VersionedParams(&options, scheme.ParameterCodec). - Do(context.TODO()). + Do(ctx). Into(result) return } // List takes label and field selectors, and returns the list of BackendConfigs that match those selectors. -func (c *backendConfigs) List(opts v1.ListOptions) (result *v1beta1.BackendConfigList, err error) { +func (c *backendConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.BackendConfigList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -88,13 +88,13 @@ func (c *backendConfigs) List(opts v1.ListOptions) (result *v1beta1.BackendConfi Resource("backendconfigs"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Do(context.TODO()). + Do(ctx). Into(result) return } // Watch returns a watch.Interface that watches the requested backendConfigs. -func (c *backendConfigs) Watch(opts v1.ListOptions) (watch.Interface, error) { +func (c *backendConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -105,71 +105,74 @@ func (c *backendConfigs) Watch(opts v1.ListOptions) (watch.Interface, error) { Resource("backendconfigs"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Watch(context.TODO()) + Watch(ctx) } // Create takes the representation of a backendConfig and creates it. Returns the server's representation of the backendConfig, and an error, if there is any. -func (c *backendConfigs) Create(backendConfig *v1beta1.BackendConfig) (result *v1beta1.BackendConfig, err error) { +func (c *backendConfigs) Create(ctx context.Context, backendConfig *v1beta1.BackendConfig, opts v1.CreateOptions) (result *v1beta1.BackendConfig, err error) { result = &v1beta1.BackendConfig{} err = c.client.Post(). Namespace(c.ns). Resource("backendconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). Body(backendConfig). - Do(context.TODO()). + Do(ctx). Into(result) return } // Update takes the representation of a backendConfig and updates it. Returns the server's representation of the backendConfig, and an error, if there is any. -func (c *backendConfigs) Update(backendConfig *v1beta1.BackendConfig) (result *v1beta1.BackendConfig, err error) { +func (c *backendConfigs) Update(ctx context.Context, backendConfig *v1beta1.BackendConfig, opts v1.UpdateOptions) (result *v1beta1.BackendConfig, err error) { result = &v1beta1.BackendConfig{} err = c.client.Put(). Namespace(c.ns). Resource("backendconfigs"). Name(backendConfig.Name). + VersionedParams(&opts, scheme.ParameterCodec). Body(backendConfig). - Do(context.TODO()). + Do(ctx). Into(result) return } // Delete takes name of the backendConfig and deletes it. Returns an error if one occurs. -func (c *backendConfigs) Delete(name string, options *v1.DeleteOptions) error { +func (c *backendConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("backendconfigs"). Name(name). - Body(options). - Do(context.TODO()). + Body(&opts). + Do(ctx). Error() } // DeleteCollection deletes a collection of objects. -func (c *backendConfigs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { +func (c *backendConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { var timeout time.Duration - if listOptions.TimeoutSeconds != nil { - timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second } return c.client.Delete(). Namespace(c.ns). Resource("backendconfigs"). - VersionedParams(&listOptions, scheme.ParameterCodec). + VersionedParams(&listOpts, scheme.ParameterCodec). Timeout(timeout). - Body(options). - Do(context.TODO()). + Body(&opts). + Do(ctx). Error() } // Patch applies the patch and returns the patched backendConfig. -func (c *backendConfigs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.BackendConfig, err error) { +func (c *backendConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.BackendConfig, err error) { result = &v1beta1.BackendConfig{} err = c.client.Patch(pt). Namespace(c.ns). Resource("backendconfigs"). - SubResource(subresources...). Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). Body(data). - Do(context.TODO()). + Do(ctx). Into(result) return } diff --git a/pkg/backendconfig/client/clientset/versioned/typed/backendconfig/v1beta1/fake/fake_backendconfig.go b/pkg/backendconfig/client/clientset/versioned/typed/backendconfig/v1beta1/fake/fake_backendconfig.go index 6fa9e3cf63..8590a1993a 100644 --- a/pkg/backendconfig/client/clientset/versioned/typed/backendconfig/v1beta1/fake/fake_backendconfig.go +++ b/pkg/backendconfig/client/clientset/versioned/typed/backendconfig/v1beta1/fake/fake_backendconfig.go @@ -19,6 +19,8 @@ limitations under the License. package fake import ( + "context" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -39,7 +41,7 @@ var backendconfigsResource = schema.GroupVersionResource{Group: "cloud.google.co var backendconfigsKind = schema.GroupVersionKind{Group: "cloud.google.com", Version: "v1beta1", Kind: "BackendConfig"} // Get takes name of the backendConfig, and returns the corresponding backendConfig object, and an error if there is any. -func (c *FakeBackendConfigs) Get(name string, options v1.GetOptions) (result *v1beta1.BackendConfig, err error) { +func (c *FakeBackendConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.BackendConfig, err error) { obj, err := c.Fake. Invokes(testing.NewGetAction(backendconfigsResource, c.ns, name), &v1beta1.BackendConfig{}) @@ -50,7 +52,7 @@ func (c *FakeBackendConfigs) Get(name string, options v1.GetOptions) (result *v1 } // List takes label and field selectors, and returns the list of BackendConfigs that match those selectors. -func (c *FakeBackendConfigs) List(opts v1.ListOptions) (result *v1beta1.BackendConfigList, err error) { +func (c *FakeBackendConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.BackendConfigList, err error) { obj, err := c.Fake. Invokes(testing.NewListAction(backendconfigsResource, backendconfigsKind, c.ns, opts), &v1beta1.BackendConfigList{}) @@ -72,14 +74,14 @@ func (c *FakeBackendConfigs) List(opts v1.ListOptions) (result *v1beta1.BackendC } // Watch returns a watch.Interface that watches the requested backendConfigs. -func (c *FakeBackendConfigs) Watch(opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeBackendConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(backendconfigsResource, c.ns, opts)) } // Create takes the representation of a backendConfig and creates it. Returns the server's representation of the backendConfig, and an error, if there is any. -func (c *FakeBackendConfigs) Create(backendConfig *v1beta1.BackendConfig) (result *v1beta1.BackendConfig, err error) { +func (c *FakeBackendConfigs) Create(ctx context.Context, backendConfig *v1beta1.BackendConfig, opts v1.CreateOptions) (result *v1beta1.BackendConfig, err error) { obj, err := c.Fake. Invokes(testing.NewCreateAction(backendconfigsResource, c.ns, backendConfig), &v1beta1.BackendConfig{}) @@ -90,7 +92,7 @@ func (c *FakeBackendConfigs) Create(backendConfig *v1beta1.BackendConfig) (resul } // Update takes the representation of a backendConfig and updates it. Returns the server's representation of the backendConfig, and an error, if there is any. -func (c *FakeBackendConfigs) Update(backendConfig *v1beta1.BackendConfig) (result *v1beta1.BackendConfig, err error) { +func (c *FakeBackendConfigs) Update(ctx context.Context, backendConfig *v1beta1.BackendConfig, opts v1.UpdateOptions) (result *v1beta1.BackendConfig, err error) { obj, err := c.Fake. Invokes(testing.NewUpdateAction(backendconfigsResource, c.ns, backendConfig), &v1beta1.BackendConfig{}) @@ -101,7 +103,7 @@ func (c *FakeBackendConfigs) Update(backendConfig *v1beta1.BackendConfig) (resul } // Delete takes name of the backendConfig and deletes it. Returns an error if one occurs. -func (c *FakeBackendConfigs) Delete(name string, options *v1.DeleteOptions) error { +func (c *FakeBackendConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. Invokes(testing.NewDeleteAction(backendconfigsResource, c.ns, name), &v1beta1.BackendConfig{}) @@ -109,15 +111,15 @@ func (c *FakeBackendConfigs) Delete(name string, options *v1.DeleteOptions) erro } // DeleteCollection deletes a collection of objects. -func (c *FakeBackendConfigs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(backendconfigsResource, c.ns, listOptions) +func (c *FakeBackendConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(backendconfigsResource, c.ns, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.BackendConfigList{}) return err } // Patch applies the patch and returns the patched backendConfig. -func (c *FakeBackendConfigs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.BackendConfig, err error) { +func (c *FakeBackendConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.BackendConfig, err error) { obj, err := c.Fake. Invokes(testing.NewPatchSubresourceAction(backendconfigsResource, c.ns, name, pt, data, subresources...), &v1beta1.BackendConfig{}) diff --git a/pkg/backendconfig/client/informers/externalversions/backendconfig/v1/backendconfig.go b/pkg/backendconfig/client/informers/externalversions/backendconfig/v1/backendconfig.go index 4a73eebe10..bab845b523 100644 --- a/pkg/backendconfig/client/informers/externalversions/backendconfig/v1/backendconfig.go +++ b/pkg/backendconfig/client/informers/externalversions/backendconfig/v1/backendconfig.go @@ -19,6 +19,7 @@ limitations under the License. package v1 import ( + "context" time "time" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -61,13 +62,13 @@ func NewFilteredBackendConfigInformer(client versioned.Interface, namespace stri if tweakListOptions != nil { tweakListOptions(&options) } - return client.CloudV1().BackendConfigs(namespace).List(options) + return client.CloudV1().BackendConfigs(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.CloudV1().BackendConfigs(namespace).Watch(options) + return client.CloudV1().BackendConfigs(namespace).Watch(context.TODO(), options) }, }, &backendconfigv1.BackendConfig{}, diff --git a/pkg/backendconfig/client/informers/externalversions/backendconfig/v1beta1/backendconfig.go b/pkg/backendconfig/client/informers/externalversions/backendconfig/v1beta1/backendconfig.go index 5fbaeba97e..6255d35d03 100644 --- a/pkg/backendconfig/client/informers/externalversions/backendconfig/v1beta1/backendconfig.go +++ b/pkg/backendconfig/client/informers/externalversions/backendconfig/v1beta1/backendconfig.go @@ -19,6 +19,7 @@ limitations under the License. package v1beta1 import ( + "context" time "time" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -61,13 +62,13 @@ func NewFilteredBackendConfigInformer(client versioned.Interface, namespace stri if tweakListOptions != nil { tweakListOptions(&options) } - return client.CloudV1beta1().BackendConfigs(namespace).List(options) + return client.CloudV1beta1().BackendConfigs(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.CloudV1beta1().BackendConfigs(namespace).Watch(options) + return client.CloudV1beta1().BackendConfigs(namespace).Watch(context.TODO(), options) }, }, &backendconfigv1beta1.BackendConfig{}, diff --git a/pkg/e2e/adapter/beconfig.go b/pkg/e2e/adapter/beconfig.go index eb94fcab7a..eaecd58622 100644 --- a/pkg/e2e/adapter/beconfig.go +++ b/pkg/e2e/adapter/beconfig.go @@ -18,6 +18,7 @@ package adapter import ( "bytes" + "context" "encoding/json" "errors" @@ -41,10 +42,10 @@ func (crud *BackendConfigCRUD) Get(ns, name string) (*v1.BackendConfig, error) { } klog.V(3).Infof("Get BackendConfig %s/%s", ns, name) if isV1 { - return crud.C.CloudV1().BackendConfigs(ns).Get(name, metav1.GetOptions{}) + return crud.C.CloudV1().BackendConfigs(ns).Get(context.TODO(), name, metav1.GetOptions{}) } klog.V(4).Info("Using BackendConfig V1beta1 API") - bc, err := crud.C.CloudV1beta1().BackendConfigs(ns).Get(name, metav1.GetOptions{}) + bc, err := crud.C.CloudV1beta1().BackendConfigs(ns).Get(context.TODO(), name, metav1.GetOptions{}) return toV1(bc), err } @@ -56,11 +57,11 @@ func (crud *BackendConfigCRUD) Create(bc *v1.BackendConfig) (*v1.BackendConfig, } klog.V(2).Infof("Create BackendConfig %s/%s", bc.Namespace, bc.Name) if isV1 { - return crud.C.CloudV1().BackendConfigs(bc.Namespace).Create(bc) + return crud.C.CloudV1().BackendConfigs(bc.Namespace).Create(context.TODO(), bc, metav1.CreateOptions{}) } klog.V(2).Info("Using BackendConfig V1beta1 API") legacyBc := toV1beta1(bc) - legacyBc, err = crud.C.CloudV1beta1().BackendConfigs(bc.Namespace).Create(legacyBc) + legacyBc, err = crud.C.CloudV1beta1().BackendConfigs(bc.Namespace).Create(context.TODO(), legacyBc, metav1.CreateOptions{}) return toV1(legacyBc), err } @@ -72,11 +73,11 @@ func (crud *BackendConfigCRUD) Update(bc *v1.BackendConfig) (*v1.BackendConfig, } klog.V(2).Infof("Update %s/%s", bc.Namespace, bc.Name) if isV1 { - return crud.C.CloudV1().BackendConfigs(bc.Namespace).Update(bc) + return crud.C.CloudV1().BackendConfigs(bc.Namespace).Update(context.TODO(), bc, metav1.UpdateOptions{}) } klog.V(2).Infof("Using BackendConfig V1beta1 API") legacyBC := toV1beta1(bc) - legacyBC, err = crud.C.CloudV1beta1().BackendConfigs(bc.Namespace).Update(legacyBC) + legacyBC, err = crud.C.CloudV1beta1().BackendConfigs(bc.Namespace).Update(context.TODO(), legacyBC, metav1.UpdateOptions{}) return toV1(legacyBC), err } @@ -88,10 +89,10 @@ func (crud *BackendConfigCRUD) Delete(ns, name string) error { } klog.V(2).Infof("Delete BackendConfig %s/%s", ns, name) if isV1 { - return crud.C.CloudV1().BackendConfigs(ns).Delete(name, &metav1.DeleteOptions{}) + return crud.C.CloudV1().BackendConfigs(ns).Delete(context.TODO(), name, metav1.DeleteOptions{}) } klog.V(2).Info("Using BackendConfig V1beta1 API") - return crud.C.CloudV1beta1().BackendConfigs(ns).Delete(name, &metav1.DeleteOptions{}) + return crud.C.CloudV1beta1().BackendConfigs(ns).Delete(context.TODO(), name, metav1.DeleteOptions{}) } // List BackendConfig resources in given namespace. @@ -102,10 +103,10 @@ func (crud *BackendConfigCRUD) List(ns string) (*v1.BackendConfigList, error) { } klog.V(3).Infof("List BackendConfigs in namespace(%s)", ns) if isV1 { - return crud.C.CloudV1().BackendConfigs(ns).List(metav1.ListOptions{}) + return crud.C.CloudV1().BackendConfigs(ns).List(context.TODO(), metav1.ListOptions{}) } klog.V(4).Info("Using BackendConfig V1beta1 API") - bcl, err := crud.C.CloudV1beta1().BackendConfigs(ns).List(metav1.ListOptions{}) + bcl, err := crud.C.CloudV1beta1().BackendConfigs(ns).List(context.TODO(), metav1.ListOptions{}) return toV1List(bcl), err }