From 6f681864ffa849699d18bfaf17f866057c79aee0 Mon Sep 17 00:00:00 2001 From: Sridhar Gaddam Date: Wed, 3 Mar 2021 00:11:18 +0530 Subject: [PATCH] Add GlobalEgressIP CRD and associated generated code This PR adds the necessary types and includes the clientsets, informers and listers using gthe code generator. Fixes issue: https://github.com/submariner-io/submariner/issues/1157 Signed-Off-by: Sridhar Gaddam Signed-off-by: Tom Pantelis --- pkg/apis/submariner.io/v1/register.go | 4 + pkg/apis/submariner.io/v1/types.go | 92 ++++++++ .../submariner.io/v1/zz_generated.deepcopy.go | 198 ++++++++++++++++++ .../submariner.io/v1/clusterglobalegressip.go | 195 +++++++++++++++++ .../v1/fake/fake_clusterglobalegressip.go | 142 +++++++++++++ .../v1/fake/fake_globalegressip.go | 142 +++++++++++++ .../v1/fake/fake_submariner.io_client.go | 8 + .../submariner.io/v1/generated_expansion.go | 4 + .../typed/submariner.io/v1/globalegressip.go | 195 +++++++++++++++++ .../submariner.io/v1/submariner.io_client.go | 10 + .../informers/externalversions/generic.go | 4 + .../submariner.io/v1/clusterglobalegressip.go | 90 ++++++++ .../submariner.io/v1/globalegressip.go | 90 ++++++++ .../submariner.io/v1/interface.go | 14 ++ .../submariner.io/v1/clusterglobalegressip.go | 99 +++++++++ .../submariner.io/v1/expansion_generated.go | 16 ++ .../submariner.io/v1/globalegressip.go | 99 +++++++++ 17 files changed, 1402 insertions(+) create mode 100644 pkg/client/clientset/versioned/typed/submariner.io/v1/clusterglobalegressip.go create mode 100644 pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_clusterglobalegressip.go create mode 100644 pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_globalegressip.go create mode 100644 pkg/client/clientset/versioned/typed/submariner.io/v1/globalegressip.go create mode 100644 pkg/client/informers/externalversions/submariner.io/v1/clusterglobalegressip.go create mode 100644 pkg/client/informers/externalversions/submariner.io/v1/globalegressip.go create mode 100644 pkg/client/listers/submariner.io/v1/clusterglobalegressip.go create mode 100644 pkg/client/listers/submariner.io/v1/globalegressip.go diff --git a/pkg/apis/submariner.io/v1/register.go b/pkg/apis/submariner.io/v1/register.go index b774c44cd..9b3b1a098 100644 --- a/pkg/apis/submariner.io/v1/register.go +++ b/pkg/apis/submariner.io/v1/register.go @@ -48,6 +48,10 @@ func addKnownTypes(scheme *runtime.Scheme) error { &EndpointList{}, &Gateway{}, &GatewayList{}, + &GlobalEgressIP{}, + &GlobalEgressIPList{}, + &ClusterGlobalEgressIP{}, + &ClusterGlobalEgressIPList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) diff --git a/pkg/apis/submariner.io/v1/types.go b/pkg/apis/submariner.io/v1/types.go index f126dbd0f..0a13ef604 100644 --- a/pkg/apis/submariner.io/v1/types.go +++ b/pkg/apis/submariner.io/v1/types.go @@ -175,3 +175,95 @@ func (c *Connection) SetStatus(status ConnectionStatus, messageFormat string, a c.Status = status c.StatusMessage = fmt.Sprintf(messageFormat, a...) } + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// GlobalEgressIP defines a policy for allocating GlobalIPs for selected pods in the namespace of the GlobalEgressIP object. +type GlobalEgressIP struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec is the specification of the desired behavior. + Spec GlobalEgressIPSpec `json:"spec"` + + // The most recently observed status. Read-only. + // +optional + Status GlobalEgressIPStatus `json:"status,omitempty"` +} + +type GlobalEgressIPSpec struct { + // The requested number of contiguous GlobalIPs to allocate from the Globalnet CIDR assigned to the cluster. + // If not specified, defaults to 1. + // +optional + NumGlobalIPs *int `json:"numGlobalIPs,omitempty"` + + // Selects specific pods in the namespace of this GlobalEgressIP to which this GlobalEgressIP applies. If not specified, + // all pods in the namespace are selected. + // If a pod matches multiple GlobalEgressIP objects, there is no guarantee from which GlobalEgressIP its + // GlobalIP will be assigned. + // +optional + PodSelector *metav1.LabelSelector `json:"podSelector,omitempty"` +} + +type GlobalEgressIPConditionType string + +const ( + GlobalEgressIPAllocated GlobalEgressIPConditionType = "Allocated" + GlobalEgressIPConflict GlobalEgressIPConditionType = "Conflict" +) + +type GlobalEgressIPStatus struct { + // +optional + // +patchStrategy=merge + // +patchMergeKey=type + // +listType=map + // +listMapKey=type + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` + + // The list of allocated GlobalIPs. + // +optional + GlobalIPs []string `json:"globalIPs"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +type GlobalEgressIPList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []GlobalEgressIP `json:"items"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ClusterGlobalEgressIP defines a policy for allocating GlobalIPs at the cluster level to be used when no GlobalEgressIP +// applies. +type ClusterGlobalEgressIP struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec is the specification of desired behavior. + Spec ClusterGlobalEgressIPSpec `json:"spec"` + + // The most recently observed status. Read-only. + // +optional + Status GlobalEgressIPStatus `json:"status,omitempty"` +} + +type ClusterGlobalEgressIPSpec struct { + // The requested number of contiguous GlobalIPs to allocate from the Globalnet CIDR assigned to the cluster. + // If not specified, defaults to 1. + // +optional + NumGlobalIPs *int `json:"numGlobalIPs,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +type ClusterGlobalEgressIPList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []ClusterGlobalEgressIP `json:"items"` +} diff --git a/pkg/apis/submariner.io/v1/zz_generated.deepcopy.go b/pkg/apis/submariner.io/v1/zz_generated.deepcopy.go index 0029c3b45..04e12645b 100644 --- a/pkg/apis/submariner.io/v1/zz_generated.deepcopy.go +++ b/pkg/apis/submariner.io/v1/zz_generated.deepcopy.go @@ -21,6 +21,7 @@ limitations under the License. package v1 import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -51,6 +52,88 @@ func (in *Cluster) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterGlobalEgressIP) DeepCopyInto(out *ClusterGlobalEgressIP) { + *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 ClusterGlobalEgressIP. +func (in *ClusterGlobalEgressIP) DeepCopy() *ClusterGlobalEgressIP { + if in == nil { + return nil + } + out := new(ClusterGlobalEgressIP) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterGlobalEgressIP) 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 *ClusterGlobalEgressIPList) DeepCopyInto(out *ClusterGlobalEgressIPList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterGlobalEgressIP, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterGlobalEgressIPList. +func (in *ClusterGlobalEgressIPList) DeepCopy() *ClusterGlobalEgressIPList { + if in == nil { + return nil + } + out := new(ClusterGlobalEgressIPList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterGlobalEgressIPList) 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 *ClusterGlobalEgressIPSpec) DeepCopyInto(out *ClusterGlobalEgressIPSpec) { + *out = *in + if in.NumGlobalIPs != nil { + in, out := &in.NumGlobalIPs, &out.NumGlobalIPs + *out = new(int) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterGlobalEgressIPSpec. +func (in *ClusterGlobalEgressIPSpec) DeepCopy() *ClusterGlobalEgressIPSpec { + if in == nil { + return nil + } + out := new(ClusterGlobalEgressIPSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterList) DeepCopyInto(out *ClusterList) { *out = *in @@ -314,6 +397,121 @@ func (in *GatewayStatus) DeepCopy() *GatewayStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GlobalEgressIP) DeepCopyInto(out *GlobalEgressIP) { + *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 GlobalEgressIP. +func (in *GlobalEgressIP) DeepCopy() *GlobalEgressIP { + if in == nil { + return nil + } + out := new(GlobalEgressIP) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GlobalEgressIP) 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 *GlobalEgressIPList) DeepCopyInto(out *GlobalEgressIPList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GlobalEgressIP, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalEgressIPList. +func (in *GlobalEgressIPList) DeepCopy() *GlobalEgressIPList { + if in == nil { + return nil + } + out := new(GlobalEgressIPList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GlobalEgressIPList) 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 *GlobalEgressIPSpec) DeepCopyInto(out *GlobalEgressIPSpec) { + *out = *in + if in.NumGlobalIPs != nil { + in, out := &in.NumGlobalIPs, &out.NumGlobalIPs + *out = new(int) + **out = **in + } + if in.PodSelector != nil { + in, out := &in.PodSelector, &out.PodSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalEgressIPSpec. +func (in *GlobalEgressIPSpec) DeepCopy() *GlobalEgressIPSpec { + if in == nil { + return nil + } + out := new(GlobalEgressIPSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GlobalEgressIPStatus) DeepCopyInto(out *GlobalEgressIPStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.GlobalIPs != nil { + in, out := &in.GlobalIPs, &out.GlobalIPs + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalEgressIPStatus. +func (in *GlobalEgressIPStatus) DeepCopy() *GlobalEgressIPStatus { + if in == nil { + return nil + } + out := new(GlobalEgressIPStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LatencyRTTSpec) DeepCopyInto(out *LatencyRTTSpec) { *out = *in diff --git a/pkg/client/clientset/versioned/typed/submariner.io/v1/clusterglobalegressip.go b/pkg/client/clientset/versioned/typed/submariner.io/v1/clusterglobalegressip.go new file mode 100644 index 000000000..a00217cae --- /dev/null +++ b/pkg/client/clientset/versioned/typed/submariner.io/v1/clusterglobalegressip.go @@ -0,0 +1,195 @@ +/* +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 v1 + +import ( + "context" + "time" + + v1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" + scheme "github.com/submariner-io/submariner/pkg/client/clientset/versioned/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ClusterGlobalEgressIPsGetter has a method to return a ClusterGlobalEgressIPInterface. +// A group's client should implement this interface. +type ClusterGlobalEgressIPsGetter interface { + ClusterGlobalEgressIPs(namespace string) ClusterGlobalEgressIPInterface +} + +// ClusterGlobalEgressIPInterface has methods to work with ClusterGlobalEgressIP resources. +type ClusterGlobalEgressIPInterface interface { + Create(ctx context.Context, clusterGlobalEgressIP *v1.ClusterGlobalEgressIP, opts metav1.CreateOptions) (*v1.ClusterGlobalEgressIP, error) + Update(ctx context.Context, clusterGlobalEgressIP *v1.ClusterGlobalEgressIP, opts metav1.UpdateOptions) (*v1.ClusterGlobalEgressIP, error) + UpdateStatus(ctx context.Context, clusterGlobalEgressIP *v1.ClusterGlobalEgressIP, opts metav1.UpdateOptions) (*v1.ClusterGlobalEgressIP, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ClusterGlobalEgressIP, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ClusterGlobalEgressIPList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterGlobalEgressIP, err error) + ClusterGlobalEgressIPExpansion +} + +// clusterGlobalEgressIPs implements ClusterGlobalEgressIPInterface +type clusterGlobalEgressIPs struct { + client rest.Interface + ns string +} + +// newClusterGlobalEgressIPs returns a ClusterGlobalEgressIPs +func newClusterGlobalEgressIPs(c *SubmarinerV1Client, namespace string) *clusterGlobalEgressIPs { + return &clusterGlobalEgressIPs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the clusterGlobalEgressIP, and returns the corresponding clusterGlobalEgressIP object, and an error if there is any. +func (c *clusterGlobalEgressIPs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterGlobalEgressIP, err error) { + result = &v1.ClusterGlobalEgressIP{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusterglobalegressips"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterGlobalEgressIPs that match those selectors. +func (c *clusterGlobalEgressIPs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterGlobalEgressIPList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ClusterGlobalEgressIPList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusterglobalegressips"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterGlobalEgressIPs. +func (c *clusterGlobalEgressIPs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("clusterglobalegressips"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a clusterGlobalEgressIP and creates it. Returns the server's representation of the clusterGlobalEgressIP, and an error, if there is any. +func (c *clusterGlobalEgressIPs) Create(ctx context.Context, clusterGlobalEgressIP *v1.ClusterGlobalEgressIP, opts metav1.CreateOptions) (result *v1.ClusterGlobalEgressIP, err error) { + result = &v1.ClusterGlobalEgressIP{} + err = c.client.Post(). + Namespace(c.ns). + Resource("clusterglobalegressips"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterGlobalEgressIP). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a clusterGlobalEgressIP and updates it. Returns the server's representation of the clusterGlobalEgressIP, and an error, if there is any. +func (c *clusterGlobalEgressIPs) Update(ctx context.Context, clusterGlobalEgressIP *v1.ClusterGlobalEgressIP, opts metav1.UpdateOptions) (result *v1.ClusterGlobalEgressIP, err error) { + result = &v1.ClusterGlobalEgressIP{} + err = c.client.Put(). + Namespace(c.ns). + Resource("clusterglobalegressips"). + Name(clusterGlobalEgressIP.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterGlobalEgressIP). + Do(ctx). + 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 *clusterGlobalEgressIPs) UpdateStatus(ctx context.Context, clusterGlobalEgressIP *v1.ClusterGlobalEgressIP, opts metav1.UpdateOptions) (result *v1.ClusterGlobalEgressIP, err error) { + result = &v1.ClusterGlobalEgressIP{} + err = c.client.Put(). + Namespace(c.ns). + Resource("clusterglobalegressips"). + Name(clusterGlobalEgressIP.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterGlobalEgressIP). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the clusterGlobalEgressIP and deletes it. Returns an error if one occurs. +func (c *clusterGlobalEgressIPs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusterglobalegressips"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterGlobalEgressIPs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("clusterglobalegressips"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched clusterGlobalEgressIP. +func (c *clusterGlobalEgressIPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterGlobalEgressIP, err error) { + result = &v1.ClusterGlobalEgressIP{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("clusterglobalegressips"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_clusterglobalegressip.go b/pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_clusterglobalegressip.go new file mode 100644 index 000000000..9d7c822f6 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_clusterglobalegressip.go @@ -0,0 +1,142 @@ +/* +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 ( + "context" + + submarineriov1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeClusterGlobalEgressIPs implements ClusterGlobalEgressIPInterface +type FakeClusterGlobalEgressIPs struct { + Fake *FakeSubmarinerV1 + ns string +} + +var clusterglobalegressipsResource = schema.GroupVersionResource{Group: "submariner.io", Version: "v1", Resource: "clusterglobalegressips"} + +var clusterglobalegressipsKind = schema.GroupVersionKind{Group: "submariner.io", Version: "v1", Kind: "ClusterGlobalEgressIP"} + +// Get takes name of the clusterGlobalEgressIP, and returns the corresponding clusterGlobalEgressIP object, and an error if there is any. +func (c *FakeClusterGlobalEgressIPs) Get(ctx context.Context, name string, options v1.GetOptions) (result *submarineriov1.ClusterGlobalEgressIP, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(clusterglobalegressipsResource, c.ns, name), &submarineriov1.ClusterGlobalEgressIP{}) + + if obj == nil { + return nil, err + } + return obj.(*submarineriov1.ClusterGlobalEgressIP), err +} + +// List takes label and field selectors, and returns the list of ClusterGlobalEgressIPs that match those selectors. +func (c *FakeClusterGlobalEgressIPs) List(ctx context.Context, opts v1.ListOptions) (result *submarineriov1.ClusterGlobalEgressIPList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(clusterglobalegressipsResource, clusterglobalegressipsKind, c.ns, opts), &submarineriov1.ClusterGlobalEgressIPList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &submarineriov1.ClusterGlobalEgressIPList{ListMeta: obj.(*submarineriov1.ClusterGlobalEgressIPList).ListMeta} + for _, item := range obj.(*submarineriov1.ClusterGlobalEgressIPList).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 clusterGlobalEgressIPs. +func (c *FakeClusterGlobalEgressIPs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(clusterglobalegressipsResource, c.ns, opts)) + +} + +// Create takes the representation of a clusterGlobalEgressIP and creates it. Returns the server's representation of the clusterGlobalEgressIP, and an error, if there is any. +func (c *FakeClusterGlobalEgressIPs) Create(ctx context.Context, clusterGlobalEgressIP *submarineriov1.ClusterGlobalEgressIP, opts v1.CreateOptions) (result *submarineriov1.ClusterGlobalEgressIP, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(clusterglobalegressipsResource, c.ns, clusterGlobalEgressIP), &submarineriov1.ClusterGlobalEgressIP{}) + + if obj == nil { + return nil, err + } + return obj.(*submarineriov1.ClusterGlobalEgressIP), err +} + +// Update takes the representation of a clusterGlobalEgressIP and updates it. Returns the server's representation of the clusterGlobalEgressIP, and an error, if there is any. +func (c *FakeClusterGlobalEgressIPs) Update(ctx context.Context, clusterGlobalEgressIP *submarineriov1.ClusterGlobalEgressIP, opts v1.UpdateOptions) (result *submarineriov1.ClusterGlobalEgressIP, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(clusterglobalegressipsResource, c.ns, clusterGlobalEgressIP), &submarineriov1.ClusterGlobalEgressIP{}) + + if obj == nil { + return nil, err + } + return obj.(*submarineriov1.ClusterGlobalEgressIP), 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 *FakeClusterGlobalEgressIPs) UpdateStatus(ctx context.Context, clusterGlobalEgressIP *submarineriov1.ClusterGlobalEgressIP, opts v1.UpdateOptions) (*submarineriov1.ClusterGlobalEgressIP, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(clusterglobalegressipsResource, "status", c.ns, clusterGlobalEgressIP), &submarineriov1.ClusterGlobalEgressIP{}) + + if obj == nil { + return nil, err + } + return obj.(*submarineriov1.ClusterGlobalEgressIP), err +} + +// Delete takes name of the clusterGlobalEgressIP and deletes it. Returns an error if one occurs. +func (c *FakeClusterGlobalEgressIPs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(clusterglobalegressipsResource, c.ns, name), &submarineriov1.ClusterGlobalEgressIP{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterGlobalEgressIPs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(clusterglobalegressipsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &submarineriov1.ClusterGlobalEgressIPList{}) + return err +} + +// Patch applies the patch and returns the patched clusterGlobalEgressIP. +func (c *FakeClusterGlobalEgressIPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *submarineriov1.ClusterGlobalEgressIP, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(clusterglobalegressipsResource, c.ns, name, pt, data, subresources...), &submarineriov1.ClusterGlobalEgressIP{}) + + if obj == nil { + return nil, err + } + return obj.(*submarineriov1.ClusterGlobalEgressIP), err +} diff --git a/pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_globalegressip.go b/pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_globalegressip.go new file mode 100644 index 000000000..45a494bc5 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_globalegressip.go @@ -0,0 +1,142 @@ +/* +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 ( + "context" + + submarineriov1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeGlobalEgressIPs implements GlobalEgressIPInterface +type FakeGlobalEgressIPs struct { + Fake *FakeSubmarinerV1 + ns string +} + +var globalegressipsResource = schema.GroupVersionResource{Group: "submariner.io", Version: "v1", Resource: "globalegressips"} + +var globalegressipsKind = schema.GroupVersionKind{Group: "submariner.io", Version: "v1", Kind: "GlobalEgressIP"} + +// Get takes name of the globalEgressIP, and returns the corresponding globalEgressIP object, and an error if there is any. +func (c *FakeGlobalEgressIPs) Get(ctx context.Context, name string, options v1.GetOptions) (result *submarineriov1.GlobalEgressIP, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(globalegressipsResource, c.ns, name), &submarineriov1.GlobalEgressIP{}) + + if obj == nil { + return nil, err + } + return obj.(*submarineriov1.GlobalEgressIP), err +} + +// List takes label and field selectors, and returns the list of GlobalEgressIPs that match those selectors. +func (c *FakeGlobalEgressIPs) List(ctx context.Context, opts v1.ListOptions) (result *submarineriov1.GlobalEgressIPList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(globalegressipsResource, globalegressipsKind, c.ns, opts), &submarineriov1.GlobalEgressIPList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &submarineriov1.GlobalEgressIPList{ListMeta: obj.(*submarineriov1.GlobalEgressIPList).ListMeta} + for _, item := range obj.(*submarineriov1.GlobalEgressIPList).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 globalEgressIPs. +func (c *FakeGlobalEgressIPs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(globalegressipsResource, c.ns, opts)) + +} + +// Create takes the representation of a globalEgressIP and creates it. Returns the server's representation of the globalEgressIP, and an error, if there is any. +func (c *FakeGlobalEgressIPs) Create(ctx context.Context, globalEgressIP *submarineriov1.GlobalEgressIP, opts v1.CreateOptions) (result *submarineriov1.GlobalEgressIP, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(globalegressipsResource, c.ns, globalEgressIP), &submarineriov1.GlobalEgressIP{}) + + if obj == nil { + return nil, err + } + return obj.(*submarineriov1.GlobalEgressIP), err +} + +// Update takes the representation of a globalEgressIP and updates it. Returns the server's representation of the globalEgressIP, and an error, if there is any. +func (c *FakeGlobalEgressIPs) Update(ctx context.Context, globalEgressIP *submarineriov1.GlobalEgressIP, opts v1.UpdateOptions) (result *submarineriov1.GlobalEgressIP, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(globalegressipsResource, c.ns, globalEgressIP), &submarineriov1.GlobalEgressIP{}) + + if obj == nil { + return nil, err + } + return obj.(*submarineriov1.GlobalEgressIP), 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 *FakeGlobalEgressIPs) UpdateStatus(ctx context.Context, globalEgressIP *submarineriov1.GlobalEgressIP, opts v1.UpdateOptions) (*submarineriov1.GlobalEgressIP, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(globalegressipsResource, "status", c.ns, globalEgressIP), &submarineriov1.GlobalEgressIP{}) + + if obj == nil { + return nil, err + } + return obj.(*submarineriov1.GlobalEgressIP), err +} + +// Delete takes name of the globalEgressIP and deletes it. Returns an error if one occurs. +func (c *FakeGlobalEgressIPs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(globalegressipsResource, c.ns, name), &submarineriov1.GlobalEgressIP{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeGlobalEgressIPs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(globalegressipsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &submarineriov1.GlobalEgressIPList{}) + return err +} + +// Patch applies the patch and returns the patched globalEgressIP. +func (c *FakeGlobalEgressIPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *submarineriov1.GlobalEgressIP, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(globalegressipsResource, c.ns, name, pt, data, subresources...), &submarineriov1.GlobalEgressIP{}) + + if obj == nil { + return nil, err + } + return obj.(*submarineriov1.GlobalEgressIP), err +} diff --git a/pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_submariner.io_client.go b/pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_submariner.io_client.go index add7e4fc9..a3248d91f 100644 --- a/pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_submariner.io_client.go +++ b/pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_submariner.io_client.go @@ -32,6 +32,10 @@ func (c *FakeSubmarinerV1) Clusters(namespace string) v1.ClusterInterface { return &FakeClusters{c, namespace} } +func (c *FakeSubmarinerV1) ClusterGlobalEgressIPs(namespace string) v1.ClusterGlobalEgressIPInterface { + return &FakeClusterGlobalEgressIPs{c, namespace} +} + func (c *FakeSubmarinerV1) Endpoints(namespace string) v1.EndpointInterface { return &FakeEndpoints{c, namespace} } @@ -40,6 +44,10 @@ func (c *FakeSubmarinerV1) Gateways(namespace string) v1.GatewayInterface { return &FakeGateways{c, namespace} } +func (c *FakeSubmarinerV1) GlobalEgressIPs(namespace string) v1.GlobalEgressIPInterface { + return &FakeGlobalEgressIPs{c, namespace} +} + // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeSubmarinerV1) RESTClient() rest.Interface { diff --git a/pkg/client/clientset/versioned/typed/submariner.io/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/submariner.io/v1/generated_expansion.go index ae77537c0..a6485b6fb 100644 --- a/pkg/client/clientset/versioned/typed/submariner.io/v1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/submariner.io/v1/generated_expansion.go @@ -20,6 +20,10 @@ package v1 type ClusterExpansion interface{} +type ClusterGlobalEgressIPExpansion interface{} + type EndpointExpansion interface{} type GatewayExpansion interface{} + +type GlobalEgressIPExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/submariner.io/v1/globalegressip.go b/pkg/client/clientset/versioned/typed/submariner.io/v1/globalegressip.go new file mode 100644 index 000000000..9ce2a5914 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/submariner.io/v1/globalegressip.go @@ -0,0 +1,195 @@ +/* +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 v1 + +import ( + "context" + "time" + + v1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" + scheme "github.com/submariner-io/submariner/pkg/client/clientset/versioned/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// GlobalEgressIPsGetter has a method to return a GlobalEgressIPInterface. +// A group's client should implement this interface. +type GlobalEgressIPsGetter interface { + GlobalEgressIPs(namespace string) GlobalEgressIPInterface +} + +// GlobalEgressIPInterface has methods to work with GlobalEgressIP resources. +type GlobalEgressIPInterface interface { + Create(ctx context.Context, globalEgressIP *v1.GlobalEgressIP, opts metav1.CreateOptions) (*v1.GlobalEgressIP, error) + Update(ctx context.Context, globalEgressIP *v1.GlobalEgressIP, opts metav1.UpdateOptions) (*v1.GlobalEgressIP, error) + UpdateStatus(ctx context.Context, globalEgressIP *v1.GlobalEgressIP, opts metav1.UpdateOptions) (*v1.GlobalEgressIP, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.GlobalEgressIP, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.GlobalEgressIPList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.GlobalEgressIP, err error) + GlobalEgressIPExpansion +} + +// globalEgressIPs implements GlobalEgressIPInterface +type globalEgressIPs struct { + client rest.Interface + ns string +} + +// newGlobalEgressIPs returns a GlobalEgressIPs +func newGlobalEgressIPs(c *SubmarinerV1Client, namespace string) *globalEgressIPs { + return &globalEgressIPs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the globalEgressIP, and returns the corresponding globalEgressIP object, and an error if there is any. +func (c *globalEgressIPs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.GlobalEgressIP, err error) { + result = &v1.GlobalEgressIP{} + err = c.client.Get(). + Namespace(c.ns). + Resource("globalegressips"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of GlobalEgressIPs that match those selectors. +func (c *globalEgressIPs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.GlobalEgressIPList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.GlobalEgressIPList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("globalegressips"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested globalEgressIPs. +func (c *globalEgressIPs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("globalegressips"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a globalEgressIP and creates it. Returns the server's representation of the globalEgressIP, and an error, if there is any. +func (c *globalEgressIPs) Create(ctx context.Context, globalEgressIP *v1.GlobalEgressIP, opts metav1.CreateOptions) (result *v1.GlobalEgressIP, err error) { + result = &v1.GlobalEgressIP{} + err = c.client.Post(). + Namespace(c.ns). + Resource("globalegressips"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(globalEgressIP). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a globalEgressIP and updates it. Returns the server's representation of the globalEgressIP, and an error, if there is any. +func (c *globalEgressIPs) Update(ctx context.Context, globalEgressIP *v1.GlobalEgressIP, opts metav1.UpdateOptions) (result *v1.GlobalEgressIP, err error) { + result = &v1.GlobalEgressIP{} + err = c.client.Put(). + Namespace(c.ns). + Resource("globalegressips"). + Name(globalEgressIP.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(globalEgressIP). + Do(ctx). + 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 *globalEgressIPs) UpdateStatus(ctx context.Context, globalEgressIP *v1.GlobalEgressIP, opts metav1.UpdateOptions) (result *v1.GlobalEgressIP, err error) { + result = &v1.GlobalEgressIP{} + err = c.client.Put(). + Namespace(c.ns). + Resource("globalegressips"). + Name(globalEgressIP.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(globalEgressIP). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the globalEgressIP and deletes it. Returns an error if one occurs. +func (c *globalEgressIPs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("globalegressips"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *globalEgressIPs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("globalegressips"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched globalEgressIP. +func (c *globalEgressIPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.GlobalEgressIP, err error) { + result = &v1.GlobalEgressIP{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("globalegressips"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/submariner.io/v1/submariner.io_client.go b/pkg/client/clientset/versioned/typed/submariner.io/v1/submariner.io_client.go index 1a86d9b12..f7cb1ec22 100644 --- a/pkg/client/clientset/versioned/typed/submariner.io/v1/submariner.io_client.go +++ b/pkg/client/clientset/versioned/typed/submariner.io/v1/submariner.io_client.go @@ -27,8 +27,10 @@ import ( type SubmarinerV1Interface interface { RESTClient() rest.Interface ClustersGetter + ClusterGlobalEgressIPsGetter EndpointsGetter GatewaysGetter + GlobalEgressIPsGetter } // SubmarinerV1Client is used to interact with features provided by the submariner.io group. @@ -40,6 +42,10 @@ func (c *SubmarinerV1Client) Clusters(namespace string) ClusterInterface { return newClusters(c, namespace) } +func (c *SubmarinerV1Client) ClusterGlobalEgressIPs(namespace string) ClusterGlobalEgressIPInterface { + return newClusterGlobalEgressIPs(c, namespace) +} + func (c *SubmarinerV1Client) Endpoints(namespace string) EndpointInterface { return newEndpoints(c, namespace) } @@ -48,6 +54,10 @@ func (c *SubmarinerV1Client) Gateways(namespace string) GatewayInterface { return newGateways(c, namespace) } +func (c *SubmarinerV1Client) GlobalEgressIPs(namespace string) GlobalEgressIPInterface { + return newGlobalEgressIPs(c, namespace) +} + // NewForConfig creates a new SubmarinerV1Client for the given config. func NewForConfig(c *rest.Config) (*SubmarinerV1Client, error) { config := *c diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index c97f96620..36ffb8d1f 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -55,10 +55,14 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=submariner.io, Version=v1 case v1.SchemeGroupVersion.WithResource("clusters"): return &genericInformer{resource: resource.GroupResource(), informer: f.Submariner().V1().Clusters().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("clusterglobalegressips"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Submariner().V1().ClusterGlobalEgressIPs().Informer()}, nil case v1.SchemeGroupVersion.WithResource("endpoints"): return &genericInformer{resource: resource.GroupResource(), informer: f.Submariner().V1().Endpoints().Informer()}, nil case v1.SchemeGroupVersion.WithResource("gateways"): return &genericInformer{resource: resource.GroupResource(), informer: f.Submariner().V1().Gateways().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("globalegressips"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Submariner().V1().GlobalEgressIPs().Informer()}, nil } diff --git a/pkg/client/informers/externalversions/submariner.io/v1/clusterglobalegressip.go b/pkg/client/informers/externalversions/submariner.io/v1/clusterglobalegressip.go new file mode 100644 index 000000000..6c6610908 --- /dev/null +++ b/pkg/client/informers/externalversions/submariner.io/v1/clusterglobalegressip.go @@ -0,0 +1,90 @@ +/* +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 v1 + +import ( + "context" + time "time" + + submarineriov1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" + versioned "github.com/submariner-io/submariner/pkg/client/clientset/versioned" + internalinterfaces "github.com/submariner-io/submariner/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/submariner-io/submariner/pkg/client/listers/submariner.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterGlobalEgressIPInformer provides access to a shared informer and lister for +// ClusterGlobalEgressIPs. +type ClusterGlobalEgressIPInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ClusterGlobalEgressIPLister +} + +type clusterGlobalEgressIPInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewClusterGlobalEgressIPInformer constructs a new informer for ClusterGlobalEgressIP 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 NewClusterGlobalEgressIPInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterGlobalEgressIPInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterGlobalEgressIPInformer constructs a new informer for ClusterGlobalEgressIP 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 NewFilteredClusterGlobalEgressIPInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SubmarinerV1().ClusterGlobalEgressIPs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SubmarinerV1().ClusterGlobalEgressIPs(namespace).Watch(context.TODO(), options) + }, + }, + &submarineriov1.ClusterGlobalEgressIP{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterGlobalEgressIPInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterGlobalEgressIPInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterGlobalEgressIPInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&submarineriov1.ClusterGlobalEgressIP{}, f.defaultInformer) +} + +func (f *clusterGlobalEgressIPInformer) Lister() v1.ClusterGlobalEgressIPLister { + return v1.NewClusterGlobalEgressIPLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/submariner.io/v1/globalegressip.go b/pkg/client/informers/externalversions/submariner.io/v1/globalegressip.go new file mode 100644 index 000000000..8cd7cf4e4 --- /dev/null +++ b/pkg/client/informers/externalversions/submariner.io/v1/globalegressip.go @@ -0,0 +1,90 @@ +/* +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 v1 + +import ( + "context" + time "time" + + submarineriov1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" + versioned "github.com/submariner-io/submariner/pkg/client/clientset/versioned" + internalinterfaces "github.com/submariner-io/submariner/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/submariner-io/submariner/pkg/client/listers/submariner.io/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// GlobalEgressIPInformer provides access to a shared informer and lister for +// GlobalEgressIPs. +type GlobalEgressIPInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.GlobalEgressIPLister +} + +type globalEgressIPInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewGlobalEgressIPInformer constructs a new informer for GlobalEgressIP 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 NewGlobalEgressIPInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredGlobalEgressIPInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredGlobalEgressIPInformer constructs a new informer for GlobalEgressIP 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 NewFilteredGlobalEgressIPInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SubmarinerV1().GlobalEgressIPs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SubmarinerV1().GlobalEgressIPs(namespace).Watch(context.TODO(), options) + }, + }, + &submarineriov1.GlobalEgressIP{}, + resyncPeriod, + indexers, + ) +} + +func (f *globalEgressIPInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredGlobalEgressIPInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *globalEgressIPInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&submarineriov1.GlobalEgressIP{}, f.defaultInformer) +} + +func (f *globalEgressIPInformer) Lister() v1.GlobalEgressIPLister { + return v1.NewGlobalEgressIPLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/submariner.io/v1/interface.go b/pkg/client/informers/externalversions/submariner.io/v1/interface.go index c64f33f42..ac35b9f6e 100644 --- a/pkg/client/informers/externalversions/submariner.io/v1/interface.go +++ b/pkg/client/informers/externalversions/submariner.io/v1/interface.go @@ -26,10 +26,14 @@ import ( type Interface interface { // Clusters returns a ClusterInformer. Clusters() ClusterInformer + // ClusterGlobalEgressIPs returns a ClusterGlobalEgressIPInformer. + ClusterGlobalEgressIPs() ClusterGlobalEgressIPInformer // Endpoints returns a EndpointInformer. Endpoints() EndpointInformer // Gateways returns a GatewayInformer. Gateways() GatewayInformer + // GlobalEgressIPs returns a GlobalEgressIPInformer. + GlobalEgressIPs() GlobalEgressIPInformer } type version struct { @@ -48,6 +52,11 @@ func (v *version) Clusters() ClusterInformer { return &clusterInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } +// ClusterGlobalEgressIPs returns a ClusterGlobalEgressIPInformer. +func (v *version) ClusterGlobalEgressIPs() ClusterGlobalEgressIPInformer { + return &clusterGlobalEgressIPInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // Endpoints returns a EndpointInformer. func (v *version) Endpoints() EndpointInformer { return &endpointInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} @@ -57,3 +66,8 @@ func (v *version) Endpoints() EndpointInformer { func (v *version) Gateways() GatewayInformer { return &gatewayInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } + +// GlobalEgressIPs returns a GlobalEgressIPInformer. +func (v *version) GlobalEgressIPs() GlobalEgressIPInformer { + return &globalEgressIPInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/listers/submariner.io/v1/clusterglobalegressip.go b/pkg/client/listers/submariner.io/v1/clusterglobalegressip.go new file mode 100644 index 000000000..c19af5eb7 --- /dev/null +++ b/pkg/client/listers/submariner.io/v1/clusterglobalegressip.go @@ -0,0 +1,99 @@ +/* +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 v1 + +import ( + v1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterGlobalEgressIPLister helps list ClusterGlobalEgressIPs. +// All objects returned here must be treated as read-only. +type ClusterGlobalEgressIPLister interface { + // List lists all ClusterGlobalEgressIPs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ClusterGlobalEgressIP, err error) + // ClusterGlobalEgressIPs returns an object that can list and get ClusterGlobalEgressIPs. + ClusterGlobalEgressIPs(namespace string) ClusterGlobalEgressIPNamespaceLister + ClusterGlobalEgressIPListerExpansion +} + +// clusterGlobalEgressIPLister implements the ClusterGlobalEgressIPLister interface. +type clusterGlobalEgressIPLister struct { + indexer cache.Indexer +} + +// NewClusterGlobalEgressIPLister returns a new ClusterGlobalEgressIPLister. +func NewClusterGlobalEgressIPLister(indexer cache.Indexer) ClusterGlobalEgressIPLister { + return &clusterGlobalEgressIPLister{indexer: indexer} +} + +// List lists all ClusterGlobalEgressIPs in the indexer. +func (s *clusterGlobalEgressIPLister) List(selector labels.Selector) (ret []*v1.ClusterGlobalEgressIP, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ClusterGlobalEgressIP)) + }) + return ret, err +} + +// ClusterGlobalEgressIPs returns an object that can list and get ClusterGlobalEgressIPs. +func (s *clusterGlobalEgressIPLister) ClusterGlobalEgressIPs(namespace string) ClusterGlobalEgressIPNamespaceLister { + return clusterGlobalEgressIPNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ClusterGlobalEgressIPNamespaceLister helps list and get ClusterGlobalEgressIPs. +// All objects returned here must be treated as read-only. +type ClusterGlobalEgressIPNamespaceLister interface { + // List lists all ClusterGlobalEgressIPs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ClusterGlobalEgressIP, err error) + // Get retrieves the ClusterGlobalEgressIP from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ClusterGlobalEgressIP, error) + ClusterGlobalEgressIPNamespaceListerExpansion +} + +// clusterGlobalEgressIPNamespaceLister implements the ClusterGlobalEgressIPNamespaceLister +// interface. +type clusterGlobalEgressIPNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ClusterGlobalEgressIPs in the indexer for a given namespace. +func (s clusterGlobalEgressIPNamespaceLister) List(selector labels.Selector) (ret []*v1.ClusterGlobalEgressIP, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ClusterGlobalEgressIP)) + }) + return ret, err +} + +// Get retrieves the ClusterGlobalEgressIP from the indexer for a given namespace and name. +func (s clusterGlobalEgressIPNamespaceLister) Get(name string) (*v1.ClusterGlobalEgressIP, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("clusterglobalegressip"), name) + } + return obj.(*v1.ClusterGlobalEgressIP), nil +} diff --git a/pkg/client/listers/submariner.io/v1/expansion_generated.go b/pkg/client/listers/submariner.io/v1/expansion_generated.go index 4d77718a1..378385441 100644 --- a/pkg/client/listers/submariner.io/v1/expansion_generated.go +++ b/pkg/client/listers/submariner.io/v1/expansion_generated.go @@ -26,6 +26,14 @@ type ClusterListerExpansion interface{} // ClusterNamespaceLister. type ClusterNamespaceListerExpansion interface{} +// ClusterGlobalEgressIPListerExpansion allows custom methods to be added to +// ClusterGlobalEgressIPLister. +type ClusterGlobalEgressIPListerExpansion interface{} + +// ClusterGlobalEgressIPNamespaceListerExpansion allows custom methods to be added to +// ClusterGlobalEgressIPNamespaceLister. +type ClusterGlobalEgressIPNamespaceListerExpansion interface{} + // EndpointListerExpansion allows custom methods to be added to // EndpointLister. type EndpointListerExpansion interface{} @@ -41,3 +49,11 @@ type GatewayListerExpansion interface{} // GatewayNamespaceListerExpansion allows custom methods to be added to // GatewayNamespaceLister. type GatewayNamespaceListerExpansion interface{} + +// GlobalEgressIPListerExpansion allows custom methods to be added to +// GlobalEgressIPLister. +type GlobalEgressIPListerExpansion interface{} + +// GlobalEgressIPNamespaceListerExpansion allows custom methods to be added to +// GlobalEgressIPNamespaceLister. +type GlobalEgressIPNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/submariner.io/v1/globalegressip.go b/pkg/client/listers/submariner.io/v1/globalegressip.go new file mode 100644 index 000000000..b5fe921e0 --- /dev/null +++ b/pkg/client/listers/submariner.io/v1/globalegressip.go @@ -0,0 +1,99 @@ +/* +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 v1 + +import ( + v1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// GlobalEgressIPLister helps list GlobalEgressIPs. +// All objects returned here must be treated as read-only. +type GlobalEgressIPLister interface { + // List lists all GlobalEgressIPs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.GlobalEgressIP, err error) + // GlobalEgressIPs returns an object that can list and get GlobalEgressIPs. + GlobalEgressIPs(namespace string) GlobalEgressIPNamespaceLister + GlobalEgressIPListerExpansion +} + +// globalEgressIPLister implements the GlobalEgressIPLister interface. +type globalEgressIPLister struct { + indexer cache.Indexer +} + +// NewGlobalEgressIPLister returns a new GlobalEgressIPLister. +func NewGlobalEgressIPLister(indexer cache.Indexer) GlobalEgressIPLister { + return &globalEgressIPLister{indexer: indexer} +} + +// List lists all GlobalEgressIPs in the indexer. +func (s *globalEgressIPLister) List(selector labels.Selector) (ret []*v1.GlobalEgressIP, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.GlobalEgressIP)) + }) + return ret, err +} + +// GlobalEgressIPs returns an object that can list and get GlobalEgressIPs. +func (s *globalEgressIPLister) GlobalEgressIPs(namespace string) GlobalEgressIPNamespaceLister { + return globalEgressIPNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// GlobalEgressIPNamespaceLister helps list and get GlobalEgressIPs. +// All objects returned here must be treated as read-only. +type GlobalEgressIPNamespaceLister interface { + // List lists all GlobalEgressIPs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.GlobalEgressIP, err error) + // Get retrieves the GlobalEgressIP from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.GlobalEgressIP, error) + GlobalEgressIPNamespaceListerExpansion +} + +// globalEgressIPNamespaceLister implements the GlobalEgressIPNamespaceLister +// interface. +type globalEgressIPNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all GlobalEgressIPs in the indexer for a given namespace. +func (s globalEgressIPNamespaceLister) List(selector labels.Selector) (ret []*v1.GlobalEgressIP, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.GlobalEgressIP)) + }) + return ret, err +} + +// Get retrieves the GlobalEgressIP from the indexer for a given namespace and name. +func (s globalEgressIPNamespaceLister) Get(name string) (*v1.GlobalEgressIP, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("globalegressip"), name) + } + return obj.(*v1.GlobalEgressIP), nil +}