diff --git a/pkg/apis/submariner.io/v1alpha1/doc.go b/pkg/apis/submariner.io/v1alpha1/doc.go new file mode 100644 index 000000000..92148a55f --- /dev/null +++ b/pkg/apis/submariner.io/v1alpha1/doc.go @@ -0,0 +1,19 @@ +/* +© 2021 Red Hat, Inc. and others + +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. +*/ +// +k8s:deepcopy-gen=package,register + +// +groupName=submariner.io +package v1alpha1 diff --git a/pkg/apis/submariner.io/v1alpha1/register.go b/pkg/apis/submariner.io/v1alpha1/register.go new file mode 100644 index 000000000..84fa81d50 --- /dev/null +++ b/pkg/apis/submariner.io/v1alpha1/register.go @@ -0,0 +1,52 @@ +/* +© 2021 Red Hat, Inc. and others + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: "submariner.io", Version: "v1alpha1"} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +// Adds the list of known types to Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &GlobalnetEgressIP{}, + &GlobalnetEgressIPList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + + return nil +} diff --git a/pkg/apis/submariner.io/v1alpha1/types.go b/pkg/apis/submariner.io/v1alpha1/types.go new file mode 100644 index 000000000..b773962e4 --- /dev/null +++ b/pkg/apis/submariner.io/v1alpha1/types.go @@ -0,0 +1,112 @@ +/* +© 2021 Red Hat, Inc. and others + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type GlobalnetEgressIP struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec is the specification of desired behavior of GlobalnetEgressIP object + Spec EgressIPSpec `json:"spec"` + + // Observed status of GlobalnetEgressIP. Its a read-only field. + // +optional + Status EgressIPStatus `json:"status,omitempty"` +} + +type EgressIPSpec struct { + // User can explicitly request a specific GlobalIP and this should be a valid IPaddress + // from globalnetCIDR allocated to the Cluster. If the requested globalIP falls outside + // of the globalnetCIDR or is already allocated (either fully or partially), then Status + // field will be set to Error with appropriate message. + // If this field is not specified, a single globalIP will be allocated. + // This field cannot be changed through updates. + // +optional + GlobalIP string `json:"globalIP,omitempty"` + + // The number of globalIP's requested. Globalnet Controller will allocate the requested + // number of contiguous GlobalIPs for this GlobalnetEgressIP object. + // User can specify this field while omitting GlobalIP. In such cases, Globalnet will + // auto-allocate the requested number of contiguous GlobalIPs. + // If unspecified, NumGlobalIPs defaults to 1. + // +optional + NumGlobalIPs int `json:"numGlobalIPs,omitempty"` + + // Selects the Namespaces to which this GlobalnetEgressIP object applies. + // If an empty namespaceSelector: {} is configured, it selects all namespaces. + // If an empty namespaceSelector: {} is configured along with empty PodSelector, it applies + // to whole Cluster. + // On the other hand, if you omit specifying namespaceSelector, it does not select any + // namespaces and selects only Pods from the namespace where the GlobalnetEgressIP is + // deployed to. + // +optional + NamespaceSelector metav1.LabelSelector `json:"namespaceSelector,omitempty"` + + // Selects the pods whose label match the definition. This is an optional field and + // in case it is not set, it results in all the Pods selected from the NamespaceSelector. + // In case it is set, its intersected with NamespaceSelector, and only Pods that match the + // PodSelector and present in the NamespaceSelector will have the GlobalIPs as EgressIPs. + // Either namespaceSelector or podSelector have to be specified. If both are omitted, + // its considered as an error. + // When a Pod or Namespace matches multiple GlobalnetEgressIP objects, there is no guarantee + // which of the globalIP address that are assigned to GlobalnetEgressIP will be used. + // +optional + PodSelector metav1.LabelSelector `json:"podSelector,omitempty"` +} + +// GlobalnetEgressIPStatus identifies the status of GlobalnetEgressIP request. +type GlobalnetEgressIPStatus string + +const ( + // GlobalnetEgressIPSuccess means that Globalnet was able to successfully + // allocate the GlobalIP as requested in GlobalnetEgressIP object. + GlobalnetEgressIPSuccess GlobalnetEgressIPStatus = "Success" + + // GlobalnetEgressIPError means that Globalnet was unable to allocate the + // requested GlobalIP. + GlobalnetEgressIPError GlobalnetEgressIPStatus = "Error" +) + +type EgressIPStatus struct { + // Status is one of {"Success", "Error"} + Status GlobalnetEgressIPStatus `json:"status,omitempty"` + + // +optional + Message *string `json:"message,omitempty"` + + // The list of GlobalIPs assigned via this GlobalnetEgressIP object. + GlobalIPs []string `json:"globalIPs"` + + // The Namespaces to which the GlobalIPs are applied. + Namespaces []string `json:"namespaces"` + + // The Pods to which the GlobalIPs are applied. + Pods []string `json:"pods"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type GlobalnetEgressIPList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + Items []GlobalnetEgressIP `json:"items"` +} diff --git a/pkg/apis/submariner.io/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/submariner.io/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000..91193608f --- /dev/null +++ b/pkg/apis/submariner.io/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,140 @@ +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +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 *EgressIPSpec) DeepCopyInto(out *EgressIPSpec) { + *out = *in + in.NamespaceSelector.DeepCopyInto(&out.NamespaceSelector) + in.PodSelector.DeepCopyInto(&out.PodSelector) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EgressIPSpec. +func (in *EgressIPSpec) DeepCopy() *EgressIPSpec { + if in == nil { + return nil + } + out := new(EgressIPSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EgressIPStatus) DeepCopyInto(out *EgressIPStatus) { + *out = *in + if in.Message != nil { + in, out := &in.Message, &out.Message + *out = new(string) + **out = **in + } + if in.GlobalIPs != nil { + in, out := &in.GlobalIPs, &out.GlobalIPs + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Namespaces != nil { + in, out := &in.Namespaces, &out.Namespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Pods != nil { + in, out := &in.Pods, &out.Pods + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EgressIPStatus. +func (in *EgressIPStatus) DeepCopy() *EgressIPStatus { + if in == nil { + return nil + } + out := new(EgressIPStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GlobalnetEgressIP) DeepCopyInto(out *GlobalnetEgressIP) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalnetEgressIP. +func (in *GlobalnetEgressIP) DeepCopy() *GlobalnetEgressIP { + if in == nil { + return nil + } + out := new(GlobalnetEgressIP) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GlobalnetEgressIP) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GlobalnetEgressIPList) DeepCopyInto(out *GlobalnetEgressIPList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GlobalnetEgressIP, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalnetEgressIPList. +func (in *GlobalnetEgressIPList) DeepCopy() *GlobalnetEgressIPList { + if in == nil { + return nil + } + out := new(GlobalnetEgressIPList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GlobalnetEgressIPList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 4eacf4824..3f9cccb7d 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -22,6 +22,7 @@ import ( "fmt" submarinerv1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1" + submarinerv1alpha1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -30,13 +31,15 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface SubmarinerV1() submarinerv1.SubmarinerV1Interface + SubmarinerV1alpha1() submarinerv1alpha1.SubmarinerV1alpha1Interface } // Clientset contains the clients for groups. Each group has exactly one // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - submarinerV1 *submarinerv1.SubmarinerV1Client + submarinerV1 *submarinerv1.SubmarinerV1Client + submarinerV1alpha1 *submarinerv1alpha1.SubmarinerV1alpha1Client } // SubmarinerV1 retrieves the SubmarinerV1Client @@ -44,6 +47,11 @@ func (c *Clientset) SubmarinerV1() submarinerv1.SubmarinerV1Interface { return c.submarinerV1 } +// SubmarinerV1alpha1 retrieves the SubmarinerV1alpha1Client +func (c *Clientset) SubmarinerV1alpha1() submarinerv1alpha1.SubmarinerV1alpha1Interface { + return c.submarinerV1alpha1 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -69,6 +77,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } + cs.submarinerV1alpha1, err = submarinerv1alpha1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) if err != nil { @@ -82,6 +94,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset cs.submarinerV1 = submarinerv1.NewForConfigOrDie(c) + cs.submarinerV1alpha1 = submarinerv1alpha1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -91,6 +104,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.submarinerV1 = submarinerv1.New(c) + cs.submarinerV1alpha1 = submarinerv1alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index b6a2a6fa8..c1065442b 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -22,6 +22,8 @@ import ( clientset "github.com/submariner-io/submariner/pkg/client/clientset/versioned" submarinerv1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1" fakesubmarinerv1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1/fake" + submarinerv1alpha1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1" + fakesubmarinerv1alpha1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -80,3 +82,8 @@ var _ clientset.Interface = &Clientset{} func (c *Clientset) SubmarinerV1() submarinerv1.SubmarinerV1Interface { return &fakesubmarinerv1.FakeSubmarinerV1{Fake: &c.Fake} } + +// SubmarinerV1alpha1 retrieves the SubmarinerV1alpha1Client +func (c *Clientset) SubmarinerV1alpha1() submarinerv1alpha1.SubmarinerV1alpha1Interface { + return &fakesubmarinerv1alpha1.FakeSubmarinerV1alpha1{Fake: &c.Fake} +} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 26de3ef83..bc934dcc8 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -20,6 +20,7 @@ package fake import ( submarinerv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" + submarinerv1alpha1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,6 +33,7 @@ var codecs = serializer.NewCodecFactory(scheme) var parameterCodec = runtime.NewParameterCodec(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ submarinerv1.AddToScheme, + submarinerv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 76482724b..a21a6cac7 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -20,6 +20,7 @@ package scheme import ( submarinerv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" + submarinerv1alpha1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,6 +33,7 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ submarinerv1.AddToScheme, + submarinerv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/doc.go new file mode 100644 index 000000000..df51baa4d --- /dev/null +++ b/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/fake/doc.go new file mode 100644 index 000000000..16f443990 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/fake/fake_globalnetegressip.go b/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/fake/fake_globalnetegressip.go new file mode 100644 index 000000000..06f5fb8e0 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/fake/fake_globalnetegressip.go @@ -0,0 +1,128 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/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" +) + +// FakeGlobalnetEgressIPs implements GlobalnetEgressIPInterface +type FakeGlobalnetEgressIPs struct { + Fake *FakeSubmarinerV1alpha1 + ns string +} + +var globalnetegressipsResource = schema.GroupVersionResource{Group: "submariner.io", Version: "v1alpha1", Resource: "globalnetegressips"} + +var globalnetegressipsKind = schema.GroupVersionKind{Group: "submariner.io", Version: "v1alpha1", Kind: "GlobalnetEgressIP"} + +// Get takes name of the globalnetEgressIP, and returns the corresponding globalnetEgressIP object, and an error if there is any. +func (c *FakeGlobalnetEgressIPs) Get(name string, options v1.GetOptions) (result *v1alpha1.GlobalnetEgressIP, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(globalnetegressipsResource, c.ns, name), &v1alpha1.GlobalnetEgressIP{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.GlobalnetEgressIP), err +} + +// List takes label and field selectors, and returns the list of GlobalnetEgressIPs that match those selectors. +func (c *FakeGlobalnetEgressIPs) List(opts v1.ListOptions) (result *v1alpha1.GlobalnetEgressIPList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(globalnetegressipsResource, globalnetegressipsKind, c.ns, opts), &v1alpha1.GlobalnetEgressIPList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.GlobalnetEgressIPList{ListMeta: obj.(*v1alpha1.GlobalnetEgressIPList).ListMeta} + for _, item := range obj.(*v1alpha1.GlobalnetEgressIPList).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 globalnetEgressIPs. +func (c *FakeGlobalnetEgressIPs) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(globalnetegressipsResource, c.ns, opts)) + +} + +// Create takes the representation of a globalnetEgressIP and creates it. Returns the server's representation of the globalnetEgressIP, and an error, if there is any. +func (c *FakeGlobalnetEgressIPs) Create(globalnetEgressIP *v1alpha1.GlobalnetEgressIP) (result *v1alpha1.GlobalnetEgressIP, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(globalnetegressipsResource, c.ns, globalnetEgressIP), &v1alpha1.GlobalnetEgressIP{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.GlobalnetEgressIP), err +} + +// Update takes the representation of a globalnetEgressIP and updates it. Returns the server's representation of the globalnetEgressIP, and an error, if there is any. +func (c *FakeGlobalnetEgressIPs) Update(globalnetEgressIP *v1alpha1.GlobalnetEgressIP) (result *v1alpha1.GlobalnetEgressIP, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(globalnetegressipsResource, c.ns, globalnetEgressIP), &v1alpha1.GlobalnetEgressIP{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.GlobalnetEgressIP), err +} + +// Delete takes name of the globalnetEgressIP and deletes it. Returns an error if one occurs. +func (c *FakeGlobalnetEgressIPs) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(globalnetegressipsResource, c.ns, name), &v1alpha1.GlobalnetEgressIP{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeGlobalnetEgressIPs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(globalnetegressipsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.GlobalnetEgressIPList{}) + return err +} + +// Patch applies the patch and returns the patched globalnetEgressIP. +func (c *FakeGlobalnetEgressIPs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.GlobalnetEgressIP, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(globalnetegressipsResource, c.ns, name, pt, data, subresources...), &v1alpha1.GlobalnetEgressIP{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.GlobalnetEgressIP), err +} diff --git a/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/fake/fake_submariner.io_client.go b/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/fake/fake_submariner.io_client.go new file mode 100644 index 000000000..b371cb394 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/fake/fake_submariner.io_client.go @@ -0,0 +1,40 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeSubmarinerV1alpha1 struct { + *testing.Fake +} + +func (c *FakeSubmarinerV1alpha1) GlobalnetEgressIPs(namespace string) v1alpha1.GlobalnetEgressIPInterface { + return &FakeGlobalnetEgressIPs{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeSubmarinerV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/generated_expansion.go new file mode 100644 index 000000000..342588c85 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/generated_expansion.go @@ -0,0 +1,21 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +type GlobalnetEgressIPExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/globalnetegressip.go b/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/globalnetegressip.go new file mode 100644 index 000000000..0c39cf7fe --- /dev/null +++ b/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/globalnetegressip.go @@ -0,0 +1,174 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "time" + + v1alpha1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1alpha1" + scheme "github.com/submariner-io/submariner/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" +) + +// GlobalnetEgressIPsGetter has a method to return a GlobalnetEgressIPInterface. +// A group's client should implement this interface. +type GlobalnetEgressIPsGetter interface { + GlobalnetEgressIPs(namespace string) GlobalnetEgressIPInterface +} + +// GlobalnetEgressIPInterface has methods to work with GlobalnetEgressIP resources. +type GlobalnetEgressIPInterface interface { + Create(*v1alpha1.GlobalnetEgressIP) (*v1alpha1.GlobalnetEgressIP, error) + Update(*v1alpha1.GlobalnetEgressIP) (*v1alpha1.GlobalnetEgressIP, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.GlobalnetEgressIP, error) + List(opts v1.ListOptions) (*v1alpha1.GlobalnetEgressIPList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.GlobalnetEgressIP, err error) + GlobalnetEgressIPExpansion +} + +// globalnetEgressIPs implements GlobalnetEgressIPInterface +type globalnetEgressIPs struct { + client rest.Interface + ns string +} + +// newGlobalnetEgressIPs returns a GlobalnetEgressIPs +func newGlobalnetEgressIPs(c *SubmarinerV1alpha1Client, namespace string) *globalnetEgressIPs { + return &globalnetEgressIPs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the globalnetEgressIP, and returns the corresponding globalnetEgressIP object, and an error if there is any. +func (c *globalnetEgressIPs) Get(name string, options v1.GetOptions) (result *v1alpha1.GlobalnetEgressIP, err error) { + result = &v1alpha1.GlobalnetEgressIP{} + err = c.client.Get(). + Namespace(c.ns). + Resource("globalnetegressips"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of GlobalnetEgressIPs that match those selectors. +func (c *globalnetEgressIPs) List(opts v1.ListOptions) (result *v1alpha1.GlobalnetEgressIPList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.GlobalnetEgressIPList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("globalnetegressips"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested globalnetEgressIPs. +func (c *globalnetEgressIPs) Watch(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(). + Namespace(c.ns). + Resource("globalnetegressips"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a globalnetEgressIP and creates it. Returns the server's representation of the globalnetEgressIP, and an error, if there is any. +func (c *globalnetEgressIPs) Create(globalnetEgressIP *v1alpha1.GlobalnetEgressIP) (result *v1alpha1.GlobalnetEgressIP, err error) { + result = &v1alpha1.GlobalnetEgressIP{} + err = c.client.Post(). + Namespace(c.ns). + Resource("globalnetegressips"). + Body(globalnetEgressIP). + Do(). + Into(result) + return +} + +// Update takes the representation of a globalnetEgressIP and updates it. Returns the server's representation of the globalnetEgressIP, and an error, if there is any. +func (c *globalnetEgressIPs) Update(globalnetEgressIP *v1alpha1.GlobalnetEgressIP) (result *v1alpha1.GlobalnetEgressIP, err error) { + result = &v1alpha1.GlobalnetEgressIP{} + err = c.client.Put(). + Namespace(c.ns). + Resource("globalnetegressips"). + Name(globalnetEgressIP.Name). + Body(globalnetEgressIP). + Do(). + Into(result) + return +} + +// Delete takes name of the globalnetEgressIP and deletes it. Returns an error if one occurs. +func (c *globalnetEgressIPs) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("globalnetegressips"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *globalnetEgressIPs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("globalnetegressips"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched globalnetEgressIP. +func (c *globalnetEgressIPs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.GlobalnetEgressIP, err error) { + result = &v1alpha1.GlobalnetEgressIP{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("globalnetegressips"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/submariner.io_client.go b/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/submariner.io_client.go new file mode 100644 index 000000000..f907a1f81 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/submariner.io/v1alpha1/submariner.io_client.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1alpha1" + "github.com/submariner-io/submariner/pkg/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type SubmarinerV1alpha1Interface interface { + RESTClient() rest.Interface + GlobalnetEgressIPsGetter +} + +// SubmarinerV1alpha1Client is used to interact with features provided by the submariner.io group. +type SubmarinerV1alpha1Client struct { + restClient rest.Interface +} + +func (c *SubmarinerV1alpha1Client) GlobalnetEgressIPs(namespace string) GlobalnetEgressIPInterface { + return newGlobalnetEgressIPs(c, namespace) +} + +// NewForConfig creates a new SubmarinerV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*SubmarinerV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &SubmarinerV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new SubmarinerV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *SubmarinerV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new SubmarinerV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *SubmarinerV1alpha1Client { + return &SubmarinerV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *SubmarinerV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index c97f96620..e8a881391 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -22,6 +22,7 @@ import ( "fmt" v1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" + v1alpha1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -60,6 +61,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1.SchemeGroupVersion.WithResource("gateways"): return &genericInformer{resource: resource.GroupResource(), informer: f.Submariner().V1().Gateways().Informer()}, nil + // Group=submariner.io, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("globalnetegressips"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Submariner().V1alpha1().GlobalnetEgressIPs().Informer()}, nil + } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/pkg/client/informers/externalversions/submariner.io/interface.go b/pkg/client/informers/externalversions/submariner.io/interface.go index 801874dd4..cddf3938f 100644 --- a/pkg/client/informers/externalversions/submariner.io/interface.go +++ b/pkg/client/informers/externalversions/submariner.io/interface.go @@ -21,12 +21,15 @@ package submariner import ( internalinterfaces "github.com/submariner-io/submariner/pkg/client/informers/externalversions/internalinterfaces" v1 "github.com/submariner-io/submariner/pkg/client/informers/externalversions/submariner.io/v1" + v1alpha1 "github.com/submariner-io/submariner/pkg/client/informers/externalversions/submariner.io/v1alpha1" ) // Interface provides access to each of this group's versions. type Interface interface { // V1 provides access to shared informers for resources in V1. V1() v1.Interface + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface } type group struct { @@ -44,3 +47,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (g *group) V1() v1.Interface { return v1.New(g.factory, g.namespace, g.tweakListOptions) } + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/submariner.io/v1alpha1/globalnetegressip.go b/pkg/client/informers/externalversions/submariner.io/v1alpha1/globalnetegressip.go new file mode 100644 index 000000000..1d0c1efec --- /dev/null +++ b/pkg/client/informers/externalversions/submariner.io/v1alpha1/globalnetegressip.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + submarineriov1alpha1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1alpha1" + versioned "github.com/submariner-io/submariner/pkg/client/clientset/versioned" + internalinterfaces "github.com/submariner-io/submariner/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/submariner-io/submariner/pkg/client/listers/submariner.io/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" +) + +// GlobalnetEgressIPInformer provides access to a shared informer and lister for +// GlobalnetEgressIPs. +type GlobalnetEgressIPInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.GlobalnetEgressIPLister +} + +type globalnetEgressIPInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewGlobalnetEgressIPInformer constructs a new informer for GlobalnetEgressIP 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 NewGlobalnetEgressIPInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredGlobalnetEgressIPInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredGlobalnetEgressIPInformer constructs a new informer for GlobalnetEgressIP 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 NewFilteredGlobalnetEgressIPInformer(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.SubmarinerV1alpha1().GlobalnetEgressIPs(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SubmarinerV1alpha1().GlobalnetEgressIPs(namespace).Watch(options) + }, + }, + &submarineriov1alpha1.GlobalnetEgressIP{}, + resyncPeriod, + indexers, + ) +} + +func (f *globalnetEgressIPInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredGlobalnetEgressIPInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *globalnetEgressIPInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&submarineriov1alpha1.GlobalnetEgressIP{}, f.defaultInformer) +} + +func (f *globalnetEgressIPInformer) Lister() v1alpha1.GlobalnetEgressIPLister { + return v1alpha1.NewGlobalnetEgressIPLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/submariner.io/v1alpha1/interface.go b/pkg/client/informers/externalversions/submariner.io/v1alpha1/interface.go new file mode 100644 index 000000000..02a38668b --- /dev/null +++ b/pkg/client/informers/externalversions/submariner.io/v1alpha1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "github.com/submariner-io/submariner/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // GlobalnetEgressIPs returns a GlobalnetEgressIPInformer. + GlobalnetEgressIPs() GlobalnetEgressIPInformer +} + +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} +} + +// GlobalnetEgressIPs returns a GlobalnetEgressIPInformer. +func (v *version) GlobalnetEgressIPs() GlobalnetEgressIPInformer { + return &globalnetEgressIPInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/listers/submariner.io/v1alpha1/expansion_generated.go b/pkg/client/listers/submariner.io/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..b39ac73aa --- /dev/null +++ b/pkg/client/listers/submariner.io/v1alpha1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// GlobalnetEgressIPListerExpansion allows custom methods to be added to +// GlobalnetEgressIPLister. +type GlobalnetEgressIPListerExpansion interface{} + +// GlobalnetEgressIPNamespaceListerExpansion allows custom methods to be added to +// GlobalnetEgressIPNamespaceLister. +type GlobalnetEgressIPNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/submariner.io/v1alpha1/globalnetegressip.go b/pkg/client/listers/submariner.io/v1alpha1/globalnetegressip.go new file mode 100644 index 000000000..14cb34821 --- /dev/null +++ b/pkg/client/listers/submariner.io/v1alpha1/globalnetegressip.go @@ -0,0 +1,94 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// GlobalnetEgressIPLister helps list GlobalnetEgressIPs. +type GlobalnetEgressIPLister interface { + // List lists all GlobalnetEgressIPs in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.GlobalnetEgressIP, err error) + // GlobalnetEgressIPs returns an object that can list and get GlobalnetEgressIPs. + GlobalnetEgressIPs(namespace string) GlobalnetEgressIPNamespaceLister + GlobalnetEgressIPListerExpansion +} + +// globalnetEgressIPLister implements the GlobalnetEgressIPLister interface. +type globalnetEgressIPLister struct { + indexer cache.Indexer +} + +// NewGlobalnetEgressIPLister returns a new GlobalnetEgressIPLister. +func NewGlobalnetEgressIPLister(indexer cache.Indexer) GlobalnetEgressIPLister { + return &globalnetEgressIPLister{indexer: indexer} +} + +// List lists all GlobalnetEgressIPs in the indexer. +func (s *globalnetEgressIPLister) List(selector labels.Selector) (ret []*v1alpha1.GlobalnetEgressIP, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.GlobalnetEgressIP)) + }) + return ret, err +} + +// GlobalnetEgressIPs returns an object that can list and get GlobalnetEgressIPs. +func (s *globalnetEgressIPLister) GlobalnetEgressIPs(namespace string) GlobalnetEgressIPNamespaceLister { + return globalnetEgressIPNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// GlobalnetEgressIPNamespaceLister helps list and get GlobalnetEgressIPs. +type GlobalnetEgressIPNamespaceLister interface { + // List lists all GlobalnetEgressIPs in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.GlobalnetEgressIP, err error) + // Get retrieves the GlobalnetEgressIP from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.GlobalnetEgressIP, error) + GlobalnetEgressIPNamespaceListerExpansion +} + +// globalnetEgressIPNamespaceLister implements the GlobalnetEgressIPNamespaceLister +// interface. +type globalnetEgressIPNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all GlobalnetEgressIPs in the indexer for a given namespace. +func (s globalnetEgressIPNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.GlobalnetEgressIP, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.GlobalnetEgressIP)) + }) + return ret, err +} + +// Get retrieves the GlobalnetEgressIP from the indexer for a given namespace and name. +func (s globalnetEgressIPNamespaceLister) Get(name string) (*v1alpha1.GlobalnetEgressIP, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("globalnetegressip"), name) + } + return obj.(*v1alpha1.GlobalnetEgressIP), nil +} diff --git a/scripts/codegen b/scripts/codegen index 111c02488..3242ce7ac 100755 --- a/scripts/codegen +++ b/scripts/codegen @@ -16,4 +16,4 @@ if [ ! -f "$CODEGEN_SCRIPT" ]; then echo "Successsfully checked out release tag $CODEGEN_RELEASE_TAG" fi -"${CODEGEN_SCRIPT}" all github.com/submariner-io/submariner/pkg/client github.com/submariner-io/submariner/pkg/apis submariner.io:v1 +"${CODEGEN_SCRIPT}" all github.com/submariner-io/submariner/pkg/client github.com/submariner-io/submariner/pkg/apis submariner.io:v1,v1alpha1