mirror of
https://github.com/fluxcd/flagger.git
synced 2026-04-15 06:57:34 +00:00
Add CanaryDeployment kind
- bootstrap the deployments. services and Istio virtual service - use google/go-cmp to detect changes in the deployment pod spec
This commit is contained in:
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
Copyright The Flagger 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 v1beta1
|
||||
|
||||
import (
|
||||
v1beta1 "github.com/stefanprodan/flagger/pkg/apis/flagger/v1beta1"
|
||||
scheme "github.com/stefanprodan/flagger/pkg/client/clientset/versioned/scheme"
|
||||
v1 "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"
|
||||
)
|
||||
|
||||
// CanaryDeploymentsGetter has a method to return a CanaryDeploymentInterface.
|
||||
// A group's client should implement this interface.
|
||||
type CanaryDeploymentsGetter interface {
|
||||
CanaryDeployments(namespace string) CanaryDeploymentInterface
|
||||
}
|
||||
|
||||
// CanaryDeploymentInterface has methods to work with CanaryDeployment resources.
|
||||
type CanaryDeploymentInterface interface {
|
||||
Create(*v1beta1.CanaryDeployment) (*v1beta1.CanaryDeployment, error)
|
||||
Update(*v1beta1.CanaryDeployment) (*v1beta1.CanaryDeployment, error)
|
||||
UpdateStatus(*v1beta1.CanaryDeployment) (*v1beta1.CanaryDeployment, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string, options v1.GetOptions) (*v1beta1.CanaryDeployment, error)
|
||||
List(opts v1.ListOptions) (*v1beta1.CanaryDeploymentList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.CanaryDeployment, err error)
|
||||
CanaryDeploymentExpansion
|
||||
}
|
||||
|
||||
// canaryDeployments implements CanaryDeploymentInterface
|
||||
type canaryDeployments struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newCanaryDeployments returns a CanaryDeployments
|
||||
func newCanaryDeployments(c *FlaggerV1beta1Client, namespace string) *canaryDeployments {
|
||||
return &canaryDeployments{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the canaryDeployment, and returns the corresponding canaryDeployment object, and an error if there is any.
|
||||
func (c *canaryDeployments) Get(name string, options v1.GetOptions) (result *v1beta1.CanaryDeployment, err error) {
|
||||
result = &v1beta1.CanaryDeployment{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("canarydeployments").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of CanaryDeployments that match those selectors.
|
||||
func (c *canaryDeployments) List(opts v1.ListOptions) (result *v1beta1.CanaryDeploymentList, err error) {
|
||||
result = &v1beta1.CanaryDeploymentList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("canarydeployments").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested canaryDeployments.
|
||||
func (c *canaryDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("canarydeployments").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a canaryDeployment and creates it. Returns the server's representation of the canaryDeployment, and an error, if there is any.
|
||||
func (c *canaryDeployments) Create(canaryDeployment *v1beta1.CanaryDeployment) (result *v1beta1.CanaryDeployment, err error) {
|
||||
result = &v1beta1.CanaryDeployment{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("canarydeployments").
|
||||
Body(canaryDeployment).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a canaryDeployment and updates it. Returns the server's representation of the canaryDeployment, and an error, if there is any.
|
||||
func (c *canaryDeployments) Update(canaryDeployment *v1beta1.CanaryDeployment) (result *v1beta1.CanaryDeployment, err error) {
|
||||
result = &v1beta1.CanaryDeployment{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("canarydeployments").
|
||||
Name(canaryDeployment.Name).
|
||||
Body(canaryDeployment).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *canaryDeployments) UpdateStatus(canaryDeployment *v1beta1.CanaryDeployment) (result *v1beta1.CanaryDeployment, err error) {
|
||||
result = &v1beta1.CanaryDeployment{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("canarydeployments").
|
||||
Name(canaryDeployment.Name).
|
||||
SubResource("status").
|
||||
Body(canaryDeployment).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the canaryDeployment and deletes it. Returns an error if one occurs.
|
||||
func (c *canaryDeployments) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("canarydeployments").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *canaryDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("canarydeployments").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched canaryDeployment.
|
||||
func (c *canaryDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.CanaryDeployment, err error) {
|
||||
result = &v1beta1.CanaryDeployment{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("canarydeployments").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
Copyright The Flagger 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 (
|
||||
v1beta1 "github.com/stefanprodan/flagger/pkg/apis/flagger/v1beta1"
|
||||
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"
|
||||
)
|
||||
|
||||
// FakeCanaryDeployments implements CanaryDeploymentInterface
|
||||
type FakeCanaryDeployments struct {
|
||||
Fake *FakeFlaggerV1beta1
|
||||
ns string
|
||||
}
|
||||
|
||||
var canarydeploymentsResource = schema.GroupVersionResource{Group: "flagger.app", Version: "v1beta1", Resource: "canarydeployments"}
|
||||
|
||||
var canarydeploymentsKind = schema.GroupVersionKind{Group: "flagger.app", Version: "v1beta1", Kind: "CanaryDeployment"}
|
||||
|
||||
// Get takes name of the canaryDeployment, and returns the corresponding canaryDeployment object, and an error if there is any.
|
||||
func (c *FakeCanaryDeployments) Get(name string, options v1.GetOptions) (result *v1beta1.CanaryDeployment, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(canarydeploymentsResource, c.ns, name), &v1beta1.CanaryDeployment{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.CanaryDeployment), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of CanaryDeployments that match those selectors.
|
||||
func (c *FakeCanaryDeployments) List(opts v1.ListOptions) (result *v1beta1.CanaryDeploymentList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(canarydeploymentsResource, canarydeploymentsKind, c.ns, opts), &v1beta1.CanaryDeploymentList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1beta1.CanaryDeploymentList{ListMeta: obj.(*v1beta1.CanaryDeploymentList).ListMeta}
|
||||
for _, item := range obj.(*v1beta1.CanaryDeploymentList).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 canaryDeployments.
|
||||
func (c *FakeCanaryDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(canarydeploymentsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a canaryDeployment and creates it. Returns the server's representation of the canaryDeployment, and an error, if there is any.
|
||||
func (c *FakeCanaryDeployments) Create(canaryDeployment *v1beta1.CanaryDeployment) (result *v1beta1.CanaryDeployment, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(canarydeploymentsResource, c.ns, canaryDeployment), &v1beta1.CanaryDeployment{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.CanaryDeployment), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a canaryDeployment and updates it. Returns the server's representation of the canaryDeployment, and an error, if there is any.
|
||||
func (c *FakeCanaryDeployments) Update(canaryDeployment *v1beta1.CanaryDeployment) (result *v1beta1.CanaryDeployment, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(canarydeploymentsResource, c.ns, canaryDeployment), &v1beta1.CanaryDeployment{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.CanaryDeployment), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeCanaryDeployments) UpdateStatus(canaryDeployment *v1beta1.CanaryDeployment) (*v1beta1.CanaryDeployment, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(canarydeploymentsResource, "status", c.ns, canaryDeployment), &v1beta1.CanaryDeployment{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.CanaryDeployment), err
|
||||
}
|
||||
|
||||
// Delete takes name of the canaryDeployment and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeCanaryDeployments) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(canarydeploymentsResource, c.ns, name), &v1beta1.CanaryDeployment{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeCanaryDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(canarydeploymentsResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1beta1.CanaryDeploymentList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched canaryDeployment.
|
||||
func (c *FakeCanaryDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.CanaryDeployment, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(canarydeploymentsResource, c.ns, name, data, subresources...), &v1beta1.CanaryDeployment{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.CanaryDeployment), err
|
||||
}
|
||||
@@ -32,6 +32,10 @@ func (c *FakeFlaggerV1beta1) Canaries(namespace string) v1beta1.CanaryInterface
|
||||
return &FakeCanaries{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeFlaggerV1beta1) CanaryDeployments(namespace string) v1beta1.CanaryDeploymentInterface {
|
||||
return &FakeCanaryDeployments{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeFlaggerV1beta1) RESTClient() rest.Interface {
|
||||
|
||||
@@ -28,6 +28,7 @@ import (
|
||||
type FlaggerV1beta1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
CanariesGetter
|
||||
CanaryDeploymentsGetter
|
||||
}
|
||||
|
||||
// FlaggerV1beta1Client is used to interact with features provided by the flagger.app group.
|
||||
@@ -39,6 +40,10 @@ func (c *FlaggerV1beta1Client) Canaries(namespace string) CanaryInterface {
|
||||
return newCanaries(c, namespace)
|
||||
}
|
||||
|
||||
func (c *FlaggerV1beta1Client) CanaryDeployments(namespace string) CanaryDeploymentInterface {
|
||||
return newCanaryDeployments(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new FlaggerV1beta1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*FlaggerV1beta1Client, error) {
|
||||
config := *c
|
||||
|
||||
@@ -19,3 +19,5 @@ limitations under the License.
|
||||
package v1beta1
|
||||
|
||||
type CanaryExpansion interface{}
|
||||
|
||||
type CanaryDeploymentExpansion interface{}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
Copyright The Flagger 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 v1beta1
|
||||
|
||||
import (
|
||||
time "time"
|
||||
|
||||
flaggerv1beta1 "github.com/stefanprodan/flagger/pkg/apis/flagger/v1beta1"
|
||||
versioned "github.com/stefanprodan/flagger/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/stefanprodan/flagger/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v1beta1 "github.com/stefanprodan/flagger/pkg/client/listers/flagger/v1beta1"
|
||||
v1 "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"
|
||||
)
|
||||
|
||||
// CanaryDeploymentInformer provides access to a shared informer and lister for
|
||||
// CanaryDeployments.
|
||||
type CanaryDeploymentInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1beta1.CanaryDeploymentLister
|
||||
}
|
||||
|
||||
type canaryDeploymentInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewCanaryDeploymentInformer constructs a new informer for CanaryDeployment 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 NewCanaryDeploymentInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredCanaryDeploymentInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredCanaryDeploymentInformer constructs a new informer for CanaryDeployment 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 NewFilteredCanaryDeploymentInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.FlaggerV1beta1().CanaryDeployments(namespace).List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.FlaggerV1beta1().CanaryDeployments(namespace).Watch(options)
|
||||
},
|
||||
},
|
||||
&flaggerv1beta1.CanaryDeployment{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *canaryDeploymentInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredCanaryDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *canaryDeploymentInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&flaggerv1beta1.CanaryDeployment{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *canaryDeploymentInformer) Lister() v1beta1.CanaryDeploymentLister {
|
||||
return v1beta1.NewCanaryDeploymentLister(f.Informer().GetIndexer())
|
||||
}
|
||||
@@ -26,6 +26,8 @@ import (
|
||||
type Interface interface {
|
||||
// Canaries returns a CanaryInformer.
|
||||
Canaries() CanaryInformer
|
||||
// CanaryDeployments returns a CanaryDeploymentInformer.
|
||||
CanaryDeployments() CanaryDeploymentInformer
|
||||
}
|
||||
|
||||
type version struct {
|
||||
@@ -43,3 +45,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
|
||||
func (v *version) Canaries() CanaryInformer {
|
||||
return &canaryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// CanaryDeployments returns a CanaryDeploymentInformer.
|
||||
func (v *version) CanaryDeployments() CanaryDeploymentInformer {
|
||||
return &canaryDeploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
||||
// Group=flagger.app, Version=v1beta1
|
||||
case v1beta1.SchemeGroupVersion.WithResource("canaries"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Flagger().V1beta1().Canaries().Informer()}, nil
|
||||
case v1beta1.SchemeGroupVersion.WithResource("canarydeployments"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Flagger().V1beta1().CanaryDeployments().Informer()}, nil
|
||||
|
||||
}
|
||||
|
||||
|
||||
94
pkg/client/listers/flagger/v1beta1/canarydeployment.go
Normal file
94
pkg/client/listers/flagger/v1beta1/canarydeployment.go
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
Copyright The Flagger 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 v1beta1
|
||||
|
||||
import (
|
||||
v1beta1 "github.com/stefanprodan/flagger/pkg/apis/flagger/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// CanaryDeploymentLister helps list CanaryDeployments.
|
||||
type CanaryDeploymentLister interface {
|
||||
// List lists all CanaryDeployments in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1beta1.CanaryDeployment, err error)
|
||||
// CanaryDeployments returns an object that can list and get CanaryDeployments.
|
||||
CanaryDeployments(namespace string) CanaryDeploymentNamespaceLister
|
||||
CanaryDeploymentListerExpansion
|
||||
}
|
||||
|
||||
// canaryDeploymentLister implements the CanaryDeploymentLister interface.
|
||||
type canaryDeploymentLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewCanaryDeploymentLister returns a new CanaryDeploymentLister.
|
||||
func NewCanaryDeploymentLister(indexer cache.Indexer) CanaryDeploymentLister {
|
||||
return &canaryDeploymentLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all CanaryDeployments in the indexer.
|
||||
func (s *canaryDeploymentLister) List(selector labels.Selector) (ret []*v1beta1.CanaryDeployment, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1beta1.CanaryDeployment))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// CanaryDeployments returns an object that can list and get CanaryDeployments.
|
||||
func (s *canaryDeploymentLister) CanaryDeployments(namespace string) CanaryDeploymentNamespaceLister {
|
||||
return canaryDeploymentNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
}
|
||||
|
||||
// CanaryDeploymentNamespaceLister helps list and get CanaryDeployments.
|
||||
type CanaryDeploymentNamespaceLister interface {
|
||||
// List lists all CanaryDeployments in the indexer for a given namespace.
|
||||
List(selector labels.Selector) (ret []*v1beta1.CanaryDeployment, err error)
|
||||
// Get retrieves the CanaryDeployment from the indexer for a given namespace and name.
|
||||
Get(name string) (*v1beta1.CanaryDeployment, error)
|
||||
CanaryDeploymentNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// canaryDeploymentNamespaceLister implements the CanaryDeploymentNamespaceLister
|
||||
// interface.
|
||||
type canaryDeploymentNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all CanaryDeployments in the indexer for a given namespace.
|
||||
func (s canaryDeploymentNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.CanaryDeployment, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1beta1.CanaryDeployment))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the CanaryDeployment from the indexer for a given namespace and name.
|
||||
func (s canaryDeploymentNamespaceLister) Get(name string) (*v1beta1.CanaryDeployment, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1beta1.Resource("canarydeployment"), name)
|
||||
}
|
||||
return obj.(*v1beta1.CanaryDeployment), nil
|
||||
}
|
||||
@@ -25,3 +25,11 @@ type CanaryListerExpansion interface{}
|
||||
// CanaryNamespaceListerExpansion allows custom methods to be added to
|
||||
// CanaryNamespaceLister.
|
||||
type CanaryNamespaceListerExpansion interface{}
|
||||
|
||||
// CanaryDeploymentListerExpansion allows custom methods to be added to
|
||||
// CanaryDeploymentLister.
|
||||
type CanaryDeploymentListerExpansion interface{}
|
||||
|
||||
// CanaryDeploymentNamespaceListerExpansion allows custom methods to be added to
|
||||
// CanaryDeploymentNamespaceLister.
|
||||
type CanaryDeploymentNamespaceListerExpansion interface{}
|
||||
|
||||
Reference in New Issue
Block a user