From a69e9abf3cd097c47a1d7f3de8f3633e5678a831 Mon Sep 17 00:00:00 2001 From: Kevin Dorosh Date: Tue, 22 Dec 2020 10:20:07 -0500 Subject: [PATCH] Remove upstream group Signed-off-by: Kevin Dorosh --- .../typed/gloo/v1/fake/fake_upstreamgroup.go | 130 ------------- .../versioned/typed/gloo/v1/upstreamgroup.go | 178 ------------------ .../externalversions/gloo/v1/upstreamgroup.go | 90 --------- pkg/client/listers/gloo/v1/upstreamgroup.go | 94 --------- 4 files changed, 492 deletions(-) delete mode 100644 pkg/client/clientset/versioned/typed/gloo/v1/fake/fake_upstreamgroup.go delete mode 100644 pkg/client/clientset/versioned/typed/gloo/v1/upstreamgroup.go delete mode 100644 pkg/client/informers/externalversions/gloo/v1/upstreamgroup.go delete mode 100644 pkg/client/listers/gloo/v1/upstreamgroup.go diff --git a/pkg/client/clientset/versioned/typed/gloo/v1/fake/fake_upstreamgroup.go b/pkg/client/clientset/versioned/typed/gloo/v1/fake/fake_upstreamgroup.go deleted file mode 100644 index efc80800..00000000 --- a/pkg/client/clientset/versioned/typed/gloo/v1/fake/fake_upstreamgroup.go +++ /dev/null @@ -1,130 +0,0 @@ -/* -Copyright 2020 The Flux 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - gloov1 "github.com/fluxcd/flagger/pkg/apis/gloo/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeUpstreamGroups implements UpstreamGroupInterface -type FakeUpstreamGroups struct { - Fake *FakeGlooV1 - ns string -} - -var upstreamgroupsResource = schema.GroupVersionResource{Group: "gloo.solo.io", Version: "v1", Resource: "upstreamgroups"} - -var upstreamgroupsKind = schema.GroupVersionKind{Group: "gloo.solo.io", Version: "v1", Kind: "UpstreamGroup"} - -// Get takes name of the upstreamGroup, and returns the corresponding upstreamGroup object, and an error if there is any. -func (c *FakeUpstreamGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *gloov1.UpstreamGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(upstreamgroupsResource, c.ns, name), &gloov1.UpstreamGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*gloov1.UpstreamGroup), err -} - -// List takes label and field selectors, and returns the list of UpstreamGroups that match those selectors. -func (c *FakeUpstreamGroups) List(ctx context.Context, opts v1.ListOptions) (result *gloov1.UpstreamGroupList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(upstreamgroupsResource, upstreamgroupsKind, c.ns, opts), &gloov1.UpstreamGroupList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &gloov1.UpstreamGroupList{ListMeta: obj.(*gloov1.UpstreamGroupList).ListMeta} - for _, item := range obj.(*gloov1.UpstreamGroupList).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 upstreamGroups. -func (c *FakeUpstreamGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(upstreamgroupsResource, c.ns, opts)) - -} - -// Create takes the representation of a upstreamGroup and creates it. Returns the server's representation of the upstreamGroup, and an error, if there is any. -func (c *FakeUpstreamGroups) Create(ctx context.Context, upstreamGroup *gloov1.UpstreamGroup, opts v1.CreateOptions) (result *gloov1.UpstreamGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(upstreamgroupsResource, c.ns, upstreamGroup), &gloov1.UpstreamGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*gloov1.UpstreamGroup), err -} - -// Update takes the representation of a upstreamGroup and updates it. Returns the server's representation of the upstreamGroup, and an error, if there is any. -func (c *FakeUpstreamGroups) Update(ctx context.Context, upstreamGroup *gloov1.UpstreamGroup, opts v1.UpdateOptions) (result *gloov1.UpstreamGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(upstreamgroupsResource, c.ns, upstreamGroup), &gloov1.UpstreamGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*gloov1.UpstreamGroup), err -} - -// Delete takes name of the upstreamGroup and deletes it. Returns an error if one occurs. -func (c *FakeUpstreamGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(upstreamgroupsResource, c.ns, name), &gloov1.UpstreamGroup{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeUpstreamGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(upstreamgroupsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &gloov1.UpstreamGroupList{}) - return err -} - -// Patch applies the patch and returns the patched upstreamGroup. -func (c *FakeUpstreamGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *gloov1.UpstreamGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(upstreamgroupsResource, c.ns, name, pt, data, subresources...), &gloov1.UpstreamGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*gloov1.UpstreamGroup), err -} diff --git a/pkg/client/clientset/versioned/typed/gloo/v1/upstreamgroup.go b/pkg/client/clientset/versioned/typed/gloo/v1/upstreamgroup.go deleted file mode 100644 index 767fe3db..00000000 --- a/pkg/client/clientset/versioned/typed/gloo/v1/upstreamgroup.go +++ /dev/null @@ -1,178 +0,0 @@ -/* -Copyright 2020 The Flux 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/fluxcd/flagger/pkg/apis/gloo/v1" - scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// UpstreamGroupsGetter has a method to return a UpstreamGroupInterface. -// A group's client should implement this interface. -type UpstreamGroupsGetter interface { - UpstreamGroups(namespace string) UpstreamGroupInterface -} - -// UpstreamGroupInterface has methods to work with UpstreamGroup resources. -type UpstreamGroupInterface interface { - Create(ctx context.Context, upstreamGroup *v1.UpstreamGroup, opts metav1.CreateOptions) (*v1.UpstreamGroup, error) - Update(ctx context.Context, upstreamGroup *v1.UpstreamGroup, opts metav1.UpdateOptions) (*v1.UpstreamGroup, 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.UpstreamGroup, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.UpstreamGroupList, 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.UpstreamGroup, err error) - UpstreamGroupExpansion -} - -// upstreamGroups implements UpstreamGroupInterface -type upstreamGroups struct { - client rest.Interface - ns string -} - -// newUpstreamGroups returns a UpstreamGroups -func newUpstreamGroups(c *GlooV1Client, namespace string) *upstreamGroups { - return &upstreamGroups{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the upstreamGroup, and returns the corresponding upstreamGroup object, and an error if there is any. -func (c *upstreamGroups) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.UpstreamGroup, err error) { - result = &v1.UpstreamGroup{} - err = c.client.Get(). - Namespace(c.ns). - Resource("upstreamgroups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of UpstreamGroups that match those selectors. -func (c *upstreamGroups) List(ctx context.Context, opts metav1.ListOptions) (result *v1.UpstreamGroupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.UpstreamGroupList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("upstreamgroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested upstreamGroups. -func (c *upstreamGroups) 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 - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("upstreamgroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a upstreamGroup and creates it. Returns the server's representation of the upstreamGroup, and an error, if there is any. -func (c *upstreamGroups) Create(ctx context.Context, upstreamGroup *v1.UpstreamGroup, opts metav1.CreateOptions) (result *v1.UpstreamGroup, err error) { - result = &v1.UpstreamGroup{} - err = c.client.Post(). - Namespace(c.ns). - Resource("upstreamgroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(upstreamGroup). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a upstreamGroup and updates it. Returns the server's representation of the upstreamGroup, and an error, if there is any. -func (c *upstreamGroups) Update(ctx context.Context, upstreamGroup *v1.UpstreamGroup, opts metav1.UpdateOptions) (result *v1.UpstreamGroup, err error) { - result = &v1.UpstreamGroup{} - err = c.client.Put(). - Namespace(c.ns). - Resource("upstreamgroups"). - Name(upstreamGroup.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(upstreamGroup). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the upstreamGroup and deletes it. Returns an error if one occurs. -func (c *upstreamGroups) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("upstreamgroups"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *upstreamGroups) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("upstreamgroups"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched upstreamGroup. -func (c *upstreamGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.UpstreamGroup, err error) { - result = &v1.UpstreamGroup{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("upstreamgroups"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/informers/externalversions/gloo/v1/upstreamgroup.go b/pkg/client/informers/externalversions/gloo/v1/upstreamgroup.go deleted file mode 100644 index 74faa191..00000000 --- a/pkg/client/informers/externalversions/gloo/v1/upstreamgroup.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2020 The Flux 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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - gloov1 "github.com/fluxcd/flagger/pkg/apis/gloo/v1" - versioned "github.com/fluxcd/flagger/pkg/client/clientset/versioned" - internalinterfaces "github.com/fluxcd/flagger/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/fluxcd/flagger/pkg/client/listers/gloo/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// UpstreamGroupInformer provides access to a shared informer and lister for -// UpstreamGroups. -type UpstreamGroupInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.UpstreamGroupLister -} - -type upstreamGroupInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewUpstreamGroupInformer constructs a new informer for UpstreamGroup type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewUpstreamGroupInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredUpstreamGroupInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredUpstreamGroupInformer constructs a new informer for UpstreamGroup type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredUpstreamGroupInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.GlooV1().UpstreamGroups(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.GlooV1().UpstreamGroups(namespace).Watch(context.TODO(), options) - }, - }, - &gloov1.UpstreamGroup{}, - resyncPeriod, - indexers, - ) -} - -func (f *upstreamGroupInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredUpstreamGroupInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *upstreamGroupInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&gloov1.UpstreamGroup{}, f.defaultInformer) -} - -func (f *upstreamGroupInformer) Lister() v1.UpstreamGroupLister { - return v1.NewUpstreamGroupLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/gloo/v1/upstreamgroup.go b/pkg/client/listers/gloo/v1/upstreamgroup.go deleted file mode 100644 index 430a31e5..00000000 --- a/pkg/client/listers/gloo/v1/upstreamgroup.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright 2020 The Flux 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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/fluxcd/flagger/pkg/apis/gloo/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// UpstreamGroupLister helps list UpstreamGroups. -type UpstreamGroupLister interface { - // List lists all UpstreamGroups in the indexer. - List(selector labels.Selector) (ret []*v1.UpstreamGroup, err error) - // UpstreamGroups returns an object that can list and get UpstreamGroups. - UpstreamGroups(namespace string) UpstreamGroupNamespaceLister - UpstreamGroupListerExpansion -} - -// upstreamGroupLister implements the UpstreamGroupLister interface. -type upstreamGroupLister struct { - indexer cache.Indexer -} - -// NewUpstreamGroupLister returns a new UpstreamGroupLister. -func NewUpstreamGroupLister(indexer cache.Indexer) UpstreamGroupLister { - return &upstreamGroupLister{indexer: indexer} -} - -// List lists all UpstreamGroups in the indexer. -func (s *upstreamGroupLister) List(selector labels.Selector) (ret []*v1.UpstreamGroup, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.UpstreamGroup)) - }) - return ret, err -} - -// UpstreamGroups returns an object that can list and get UpstreamGroups. -func (s *upstreamGroupLister) UpstreamGroups(namespace string) UpstreamGroupNamespaceLister { - return upstreamGroupNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// UpstreamGroupNamespaceLister helps list and get UpstreamGroups. -type UpstreamGroupNamespaceLister interface { - // List lists all UpstreamGroups in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1.UpstreamGroup, err error) - // Get retrieves the UpstreamGroup from the indexer for a given namespace and name. - Get(name string) (*v1.UpstreamGroup, error) - UpstreamGroupNamespaceListerExpansion -} - -// upstreamGroupNamespaceLister implements the UpstreamGroupNamespaceLister -// interface. -type upstreamGroupNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all UpstreamGroups in the indexer for a given namespace. -func (s upstreamGroupNamespaceLister) List(selector labels.Selector) (ret []*v1.UpstreamGroup, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.UpstreamGroup)) - }) - return ret, err -} - -// Get retrieves the UpstreamGroup from the indexer for a given namespace and name. -func (s upstreamGroupNamespaceLister) Get(name string) (*v1.UpstreamGroup, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("upstreamgroup"), name) - } - return obj.(*v1.UpstreamGroup), nil -}