Add/update API types

Signed-off-by: John Harris <john.harris@konghq.com>
This commit is contained in:
John Harris
2021-12-18 14:05:54 -08:00
parent 204228bc8f
commit bd58a47862
16 changed files with 755 additions and 13 deletions
+1
View File
@@ -12,4 +12,5 @@ const (
SkipperProvider string = "skipper"
TraefikProvider string = "traefik"
OsmProvider string = "osm"
KumaProvider string = "kuma"
)
+2 -2
View File
@@ -7,7 +7,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
)
// SchemeGroupVersion is the GroupVersion for the Contour API
// SchemeGroupVersion is the GroupVersion for the Kuma API
var SchemeGroupVersion = schema.GroupVersion{Group: kuma.GroupName, Version: "v1alpha1"}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
@@ -15,7 +15,7 @@ func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource gets an Contour GroupResource for a specified resource
// Resource gets a Kuma GroupResource for a specified resource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
+50 -9
View File
@@ -15,27 +15,68 @@ package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)
// +genclient
// +genclient:noStatus
// +genclient:nonNamespaced
// TrafficRoute is the Schema for the Traffic Routes API.
//
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
type TrafficRoute struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Mesh string `json:"mesh,omitempty"`
Spec unstructured.Unstructured `json:"spec,omitempty"`
Mesh string `json:"mesh,omitempty"`
Spec TrafficRouteSpec `json:"spec,omitempty"`
}
// TrafficRouteList contains a list of TrafficRoutes.
//
// TrafficRouteList defines a list of TrafficRoute objects.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
type TrafficRouteList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []TrafficRoute `json:"items"`
}
// TrafficRouteSpec defines the spec for a TrafficRoute.
type TrafficRouteSpec struct {
// List of selectors to match data plane proxies that are sources of traffic.
Sources []*Selector `json:"sources,omitempty"`
// List of selectors to match services that are destinations of traffic.
//
// Notice the difference between sources and destinations.
// While the source of traffic is always a data plane proxy within a mesh,
// the destination is a service that could be either within or outside
// of a mesh.
Destinations []*Selector `json:"destinations,omitempty"`
// Configuration for the route.
Conf *TrafficRouteConf `json:"conf,omitempty"`
}
// Selector defines the configuration for which Kuma services should be targeted.
type Selector struct {
// Tags to match, can be used for both source and destinations
Match map[string]string `json:"match,omitempty"`
}
// TrafficRouteConf defines the destination configuration.
type TrafficRouteConf struct {
// List of destinations with weights assigned to them.
// When used, "destination" is not allowed.
Split []*TrafficRouteSplit `json:"split,omitempty"`
}
// TrafficRouteSplit defines a destination with a weight assigned to it.
type TrafficRouteSplit struct {
// Weight assigned to that destination.
// Weights are not percentages. For example two destinations with
// weights the same weight "1" will receive both same amount of the traffic.
// 0 means that the destination will be ignored.
Weight uint32 `json:"weight"`
// Selector to match individual endpoints that comprise that destination.
//
// Notice that an endpoint can be either inside or outside the mesh.
// In the former case an endpoint corresponds to a data plane proxy,
// in the latter case an endpoint is an External Service.
Destination map[string]string `json:"destination,omitempty"`
}
@@ -25,6 +25,29 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Selector) DeepCopyInto(out *Selector) {
*out = *in
if in.Match != nil {
in, out := &in.Match, &out.Match
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Selector.
func (in *Selector) DeepCopy() *Selector {
if in == nil {
return nil
}
out := new(Selector)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TrafficRoute) DeepCopyInto(out *TrafficRoute) {
*out = *in
@@ -52,6 +75,33 @@ func (in *TrafficRoute) DeepCopyObject() runtime.Object {
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TrafficRouteConf) DeepCopyInto(out *TrafficRouteConf) {
*out = *in
if in.Split != nil {
in, out := &in.Split, &out.Split
*out = make([]*TrafficRouteSplit, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(TrafficRouteSplit)
(*in).DeepCopyInto(*out)
}
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficRouteConf.
func (in *TrafficRouteConf) DeepCopy() *TrafficRouteConf {
if in == nil {
return nil
}
out := new(TrafficRouteConf)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TrafficRouteList) DeepCopyInto(out *TrafficRouteList) {
*out = *in
@@ -84,3 +134,69 @@ func (in *TrafficRouteList) DeepCopyObject() runtime.Object {
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TrafficRouteSpec) DeepCopyInto(out *TrafficRouteSpec) {
*out = *in
if in.Sources != nil {
in, out := &in.Sources, &out.Sources
*out = make([]*Selector, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(Selector)
(*in).DeepCopyInto(*out)
}
}
}
if in.Destinations != nil {
in, out := &in.Destinations, &out.Destinations
*out = make([]*Selector, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(Selector)
(*in).DeepCopyInto(*out)
}
}
}
if in.Conf != nil {
in, out := &in.Conf, &out.Conf
*out = new(TrafficRouteConf)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficRouteSpec.
func (in *TrafficRouteSpec) DeepCopy() *TrafficRouteSpec {
if in == nil {
return nil
}
out := new(TrafficRouteSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TrafficRouteSplit) DeepCopyInto(out *TrafficRouteSplit) {
*out = *in
if in.Destination != nil {
in, out := &in.Destination, &out.Destination
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficRouteSplit.
func (in *TrafficRouteSplit) DeepCopy() *TrafficRouteSplit {
if in == nil {
return nil
}
out := new(TrafficRouteSplit)
in.DeepCopyInto(out)
return out
}
@@ -19,6 +19,7 @@ limitations under the License.
package fake
import (
v1alpha1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/kuma/v1alpha1"
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
)
@@ -27,6 +28,10 @@ type FakeKumaV1alpha1 struct {
*testing.Fake
}
func (c *FakeKumaV1alpha1) TrafficRoutes() v1alpha1.TrafficRouteInterface {
return &FakeTrafficRoutes{c}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeKumaV1alpha1) RESTClient() rest.Interface {
@@ -0,0 +1,122 @@
/*
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"
v1alpha1 "github.com/fluxcd/flagger/pkg/apis/kuma/v1alpha1"
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"
)
// FakeTrafficRoutes implements TrafficRouteInterface
type FakeTrafficRoutes struct {
Fake *FakeKumaV1alpha1
}
var trafficroutesResource = schema.GroupVersionResource{Group: "kuma.io", Version: "v1alpha1", Resource: "trafficroutes"}
var trafficroutesKind = schema.GroupVersionKind{Group: "kuma.io", Version: "v1alpha1", Kind: "TrafficRoute"}
// Get takes name of the trafficRoute, and returns the corresponding trafficRoute object, and an error if there is any.
func (c *FakeTrafficRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TrafficRoute, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootGetAction(trafficroutesResource, name), &v1alpha1.TrafficRoute{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.TrafficRoute), err
}
// List takes label and field selectors, and returns the list of TrafficRoutes that match those selectors.
func (c *FakeTrafficRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TrafficRouteList, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootListAction(trafficroutesResource, trafficroutesKind, opts), &v1alpha1.TrafficRouteList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.TrafficRouteList{ListMeta: obj.(*v1alpha1.TrafficRouteList).ListMeta}
for _, item := range obj.(*v1alpha1.TrafficRouteList).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 trafficRoutes.
func (c *FakeTrafficRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchAction(trafficroutesResource, opts))
}
// Create takes the representation of a trafficRoute and creates it. Returns the server's representation of the trafficRoute, and an error, if there is any.
func (c *FakeTrafficRoutes) Create(ctx context.Context, trafficRoute *v1alpha1.TrafficRoute, opts v1.CreateOptions) (result *v1alpha1.TrafficRoute, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(trafficroutesResource, trafficRoute), &v1alpha1.TrafficRoute{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.TrafficRoute), err
}
// Update takes the representation of a trafficRoute and updates it. Returns the server's representation of the trafficRoute, and an error, if there is any.
func (c *FakeTrafficRoutes) Update(ctx context.Context, trafficRoute *v1alpha1.TrafficRoute, opts v1.UpdateOptions) (result *v1alpha1.TrafficRoute, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(trafficroutesResource, trafficRoute), &v1alpha1.TrafficRoute{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.TrafficRoute), err
}
// Delete takes name of the trafficRoute and deletes it. Returns an error if one occurs.
func (c *FakeTrafficRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(trafficroutesResource, name, opts), &v1alpha1.TrafficRoute{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeTrafficRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(trafficroutesResource, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.TrafficRouteList{})
return err
}
// Patch applies the patch and returns the patched trafficRoute.
func (c *FakeTrafficRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TrafficRoute, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(trafficroutesResource, name, pt, data, subresources...), &v1alpha1.TrafficRoute{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.TrafficRoute), err
}
@@ -17,3 +17,5 @@ limitations under the License.
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
type TrafficRouteExpansion interface{}
@@ -28,6 +28,7 @@ import (
type KumaV1alpha1Interface interface {
RESTClient() rest.Interface
TrafficRoutesGetter
}
// KumaV1alpha1Client is used to interact with features provided by the kuma.io group.
@@ -35,6 +36,10 @@ type KumaV1alpha1Client struct {
restClient rest.Interface
}
func (c *KumaV1alpha1Client) TrafficRoutes() TrafficRouteInterface {
return newTrafficRoutes(c)
}
// NewForConfig creates a new KumaV1alpha1Client for the given config.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
@@ -0,0 +1,168 @@
/*
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 v1alpha1
import (
"context"
"time"
v1alpha1 "github.com/fluxcd/flagger/pkg/apis/kuma/v1alpha1"
scheme "github.com/fluxcd/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"
)
// TrafficRoutesGetter has a method to return a TrafficRouteInterface.
// A group's client should implement this interface.
type TrafficRoutesGetter interface {
TrafficRoutes() TrafficRouteInterface
}
// TrafficRouteInterface has methods to work with TrafficRoute resources.
type TrafficRouteInterface interface {
Create(ctx context.Context, trafficRoute *v1alpha1.TrafficRoute, opts v1.CreateOptions) (*v1alpha1.TrafficRoute, error)
Update(ctx context.Context, trafficRoute *v1alpha1.TrafficRoute, opts v1.UpdateOptions) (*v1alpha1.TrafficRoute, 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) (*v1alpha1.TrafficRoute, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.TrafficRouteList, 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 *v1alpha1.TrafficRoute, err error)
TrafficRouteExpansion
}
// trafficRoutes implements TrafficRouteInterface
type trafficRoutes struct {
client rest.Interface
}
// newTrafficRoutes returns a TrafficRoutes
func newTrafficRoutes(c *KumaV1alpha1Client) *trafficRoutes {
return &trafficRoutes{
client: c.RESTClient(),
}
}
// Get takes name of the trafficRoute, and returns the corresponding trafficRoute object, and an error if there is any.
func (c *trafficRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TrafficRoute, err error) {
result = &v1alpha1.TrafficRoute{}
err = c.client.Get().
Resource("trafficroutes").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of TrafficRoutes that match those selectors.
func (c *trafficRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TrafficRouteList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.TrafficRouteList{}
err = c.client.Get().
Resource("trafficroutes").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested trafficRoutes.
func (c *trafficRoutes) 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
}
opts.Watch = true
return c.client.Get().
Resource("trafficroutes").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a trafficRoute and creates it. Returns the server's representation of the trafficRoute, and an error, if there is any.
func (c *trafficRoutes) Create(ctx context.Context, trafficRoute *v1alpha1.TrafficRoute, opts v1.CreateOptions) (result *v1alpha1.TrafficRoute, err error) {
result = &v1alpha1.TrafficRoute{}
err = c.client.Post().
Resource("trafficroutes").
VersionedParams(&opts, scheme.ParameterCodec).
Body(trafficRoute).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a trafficRoute and updates it. Returns the server's representation of the trafficRoute, and an error, if there is any.
func (c *trafficRoutes) Update(ctx context.Context, trafficRoute *v1alpha1.TrafficRoute, opts v1.UpdateOptions) (result *v1alpha1.TrafficRoute, err error) {
result = &v1alpha1.TrafficRoute{}
err = c.client.Put().
Resource("trafficroutes").
Name(trafficRoute.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(trafficRoute).
Do(ctx).
Into(result)
return
}
// Delete takes name of the trafficRoute and deletes it. Returns an error if one occurs.
func (c *trafficRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Resource("trafficroutes").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *trafficRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Resource("trafficroutes").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched trafficRoute.
func (c *trafficRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TrafficRoute, err error) {
result = &v1alpha1.TrafficRoute{}
err = c.client.Patch(pt).
Resource("trafficroutes").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -30,6 +30,7 @@ import (
gloo "github.com/fluxcd/flagger/pkg/client/informers/externalversions/gloo"
internalinterfaces "github.com/fluxcd/flagger/pkg/client/informers/externalversions/internalinterfaces"
istio "github.com/fluxcd/flagger/pkg/client/informers/externalversions/istio"
kuma "github.com/fluxcd/flagger/pkg/client/informers/externalversions/kuma"
projectcontour "github.com/fluxcd/flagger/pkg/client/informers/externalversions/projectcontour"
smi "github.com/fluxcd/flagger/pkg/client/informers/externalversions/smi"
traefik "github.com/fluxcd/flagger/pkg/client/informers/externalversions/traefik"
@@ -184,6 +185,7 @@ type SharedInformerFactory interface {
Gateway() gateway.Interface
Gloo() gloo.Interface
Networking() istio.Interface
Kuma() kuma.Interface
Projectcontour() projectcontour.Interface
Split() smi.Interface
Traefik() traefik.Interface
@@ -209,6 +211,10 @@ func (f *sharedInformerFactory) Networking() istio.Interface {
return istio.New(f, f.namespace, f.tweakListOptions)
}
func (f *sharedInformerFactory) Kuma() kuma.Interface {
return kuma.New(f, f.namespace, f.tweakListOptions)
}
func (f *sharedInformerFactory) Projectcontour() projectcontour.Interface {
return projectcontour.New(f, f.namespace, f.tweakListOptions)
}
@@ -27,8 +27,9 @@ import (
v1 "github.com/fluxcd/flagger/pkg/apis/gloo/gateway/v1"
gloov1 "github.com/fluxcd/flagger/pkg/apis/gloo/gloo/v1"
v1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
v1alpha1 "github.com/fluxcd/flagger/pkg/apis/kuma/v1alpha1"
projectcontourv1 "github.com/fluxcd/flagger/pkg/apis/projectcontour/v1"
v1alpha1 "github.com/fluxcd/flagger/pkg/apis/smi/v1alpha1"
smiv1alpha1 "github.com/fluxcd/flagger/pkg/apis/smi/v1alpha1"
v1alpha2 "github.com/fluxcd/flagger/pkg/apis/smi/v1alpha2"
smiv1alpha3 "github.com/fluxcd/flagger/pkg/apis/smi/v1alpha3"
traefikv1alpha1 "github.com/fluxcd/flagger/pkg/apis/traefik/v1alpha1"
@@ -94,6 +95,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
case gloov1.SchemeGroupVersion.WithResource("upstreams"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Gloo().V1().Upstreams().Informer()}, nil
// Group=kuma.io, Version=v1alpha1
case v1alpha1.SchemeGroupVersion.WithResource("trafficroutes"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kuma().V1alpha1().TrafficRoutes().Informer()}, nil
// Group=networking.istio.io, Version=v1alpha3
case v1alpha3.SchemeGroupVersion.WithResource("destinationrules"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().DestinationRules().Informer()}, nil
@@ -105,7 +110,7 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Projectcontour().V1().HTTPProxies().Informer()}, nil
// Group=split.smi-spec.io, Version=v1alpha1
case v1alpha1.SchemeGroupVersion.WithResource("trafficsplits"):
case smiv1alpha1.SchemeGroupVersion.WithResource("trafficsplits"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Split().V1alpha1().TrafficSplits().Informer()}, nil
// Group=split.smi-spec.io, Version=v1alpha2
@@ -0,0 +1,46 @@
/*
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 kuma
import (
internalinterfaces "github.com/fluxcd/flagger/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/fluxcd/flagger/pkg/client/informers/externalversions/kuma/v1alpha1"
)
// Interface provides access to each of this group's versions.
type Interface interface {
// V1alpha1 provides access to shared informers for resources in V1alpha1.
V1alpha1() v1alpha1.Interface
}
type group struct {
factory internalinterfaces.SharedInformerFactory
namespace string
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// V1alpha1 returns a new v1alpha1.Interface.
func (g *group) V1alpha1() v1alpha1.Interface {
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
}
@@ -0,0 +1,45 @@
/*
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 v1alpha1
import (
internalinterfaces "github.com/fluxcd/flagger/pkg/client/informers/externalversions/internalinterfaces"
)
// Interface provides access to all the informers in this group version.
type Interface interface {
// TrafficRoutes returns a TrafficRouteInformer.
TrafficRoutes() TrafficRouteInformer
}
type version struct {
factory internalinterfaces.SharedInformerFactory
namespace string
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// TrafficRoutes returns a TrafficRouteInformer.
func (v *version) TrafficRoutes() TrafficRouteInformer {
return &trafficRouteInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
@@ -0,0 +1,89 @@
/*
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 v1alpha1
import (
"context"
time "time"
kumav1alpha1 "github.com/fluxcd/flagger/pkg/apis/kuma/v1alpha1"
versioned "github.com/fluxcd/flagger/pkg/client/clientset/versioned"
internalinterfaces "github.com/fluxcd/flagger/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/fluxcd/flagger/pkg/client/listers/kuma/v1alpha1"
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"
)
// TrafficRouteInformer provides access to a shared informer and lister for
// TrafficRoutes.
type TrafficRouteInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.TrafficRouteLister
}
type trafficRouteInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewTrafficRouteInformer constructs a new informer for TrafficRoute 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 NewTrafficRouteInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredTrafficRouteInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredTrafficRouteInformer constructs a new informer for TrafficRoute 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 NewFilteredTrafficRouteInformer(client versioned.Interface, 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.KumaV1alpha1().TrafficRoutes().List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.KumaV1alpha1().TrafficRoutes().Watch(context.TODO(), options)
},
},
&kumav1alpha1.TrafficRoute{},
resyncPeriod,
indexers,
)
}
func (f *trafficRouteInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredTrafficRouteInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *trafficRouteInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&kumav1alpha1.TrafficRoute{}, f.defaultInformer)
}
func (f *trafficRouteInformer) Lister() v1alpha1.TrafficRouteLister {
return v1alpha1.NewTrafficRouteLister(f.Informer().GetIndexer())
}
@@ -0,0 +1,23 @@
/*
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 v1alpha1
// TrafficRouteListerExpansion allows custom methods to be added to
// TrafficRouteLister.
type TrafficRouteListerExpansion interface{}
@@ -0,0 +1,68 @@
/*
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 v1alpha1
import (
v1alpha1 "github.com/fluxcd/flagger/pkg/apis/kuma/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// TrafficRouteLister helps list TrafficRoutes.
// All objects returned here must be treated as read-only.
type TrafficRouteLister interface {
// List lists all TrafficRoutes in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.TrafficRoute, err error)
// Get retrieves the TrafficRoute from the index for a given name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1alpha1.TrafficRoute, error)
TrafficRouteListerExpansion
}
// trafficRouteLister implements the TrafficRouteLister interface.
type trafficRouteLister struct {
indexer cache.Indexer
}
// NewTrafficRouteLister returns a new TrafficRouteLister.
func NewTrafficRouteLister(indexer cache.Indexer) TrafficRouteLister {
return &trafficRouteLister{indexer: indexer}
}
// List lists all TrafficRoutes in the indexer.
func (s *trafficRouteLister) List(selector labels.Selector) (ret []*v1alpha1.TrafficRoute, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.TrafficRoute))
})
return ret, err
}
// Get retrieves the TrafficRoute from the index for a given name.
func (s *trafficRouteLister) Get(name string) (*v1alpha1.TrafficRoute, error) {
obj, exists, err := s.indexer.GetByKey(name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("trafficroute"), name)
}
return obj.(*v1alpha1.TrafficRoute), nil
}