From 98122cc4aad33969fe24cf4187134c6f08334b78 Mon Sep 17 00:00:00 2001 From: Miguel Duarte Barroso Date: Fri, 22 Sep 2023 17:42:13 +0200 Subject: [PATCH] model: rename CRD A lease is time based; what we do model is an IPAM claim. Signed-off-by: Miguel Duarte Barroso --- ...s.yaml => k8s.cni.cncf.io_ipamclaims.yaml} | 12 +- cmd/example/main.go | 18 +-- .../v1alpha1/fake/fake_ipamclaim.go | 141 ++++++++++++++++++ .../v1alpha1/fake/fake_ipamlease.go | 141 ------------------ .../v1alpha1/fake/fake_persistentip_client.go | 4 +- .../v1alpha1/generated_expansion.go | 2 +- .../v1alpha1/{ipamlease.go => ipamclaim.go} | 106 ++++++------- .../v1alpha1/persistentip_client.go | 6 +- .../informers/externalversions/generic.go | 4 +- .../persistentip/v1alpha1/interface.go | 10 +- .../v1alpha1/{ipamlease.go => ipamclaim.go} | 38 ++--- .../v1alpha1/expansion_generated.go | 12 +- .../persistentip/v1alpha1/ipamclaim.go | 99 ++++++++++++ .../persistentip/v1alpha1/ipamlease.go | 99 ------------ pkg/crd/persistentip/v1alpha1/register.go | 4 +- pkg/crd/persistentip/v1alpha1/types.go | 18 +-- .../v1alpha1/zz_generated.deepcopy.go | 38 ++--- 17 files changed, 376 insertions(+), 376 deletions(-) rename artifacts/{k8s.cni.cncf.io_ipamleases.yaml => k8s.cni.cncf.io_ipamclaims.yaml} (91%) create mode 100644 pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/fake/fake_ipamclaim.go delete mode 100644 pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/fake/fake_ipamlease.go rename pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/{ipamlease.go => ipamclaim.go} (56%) rename pkg/crd/persistentip/v1alpha1/apis/informers/externalversions/persistentip/v1alpha1/{ipamlease.go => ipamclaim.go} (71%) create mode 100644 pkg/crd/persistentip/v1alpha1/apis/listers/persistentip/v1alpha1/ipamclaim.go delete mode 100644 pkg/crd/persistentip/v1alpha1/apis/listers/persistentip/v1alpha1/ipamlease.go diff --git a/artifacts/k8s.cni.cncf.io_ipamleases.yaml b/artifacts/k8s.cni.cncf.io_ipamclaims.yaml similarity index 91% rename from artifacts/k8s.cni.cncf.io_ipamleases.yaml rename to artifacts/k8s.cni.cncf.io_ipamclaims.yaml index abd1b8c..52a0797 100644 --- a/artifacts/k8s.cni.cncf.io_ipamleases.yaml +++ b/artifacts/k8s.cni.cncf.io_ipamclaims.yaml @@ -4,20 +4,20 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.13.0 - name: ipamleases.k8s.cni.cncf.io + name: ipamclaims.k8s.cni.cncf.io spec: group: k8s.cni.cncf.io names: - kind: IPAMLease - listKind: IPAMLeaseList - plural: ipamleases - singular: ipamlease + kind: IPAMClaim + listKind: IPAMClaimList + plural: ipamclaims + singular: ipamclaim scope: Namespaced versions: - name: v1alpha1 schema: openAPIV3Schema: - description: IPAMLease is the Schema for the IPAMLease API + description: IPAMClaim is the Schema for the IPAMClaim API properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation diff --git a/cmd/example/main.go b/cmd/example/main.go index a2564a2..b213b1d 100644 --- a/cmd/example/main.go +++ b/cmd/example/main.go @@ -33,17 +33,17 @@ func main() { } // create a persistent IP allocation - pip := &v1alpha1.IPAMLease{ + pip := &v1alpha1.IPAMClaim{ ObjectMeta: metav1.ObjectMeta{ Name: "example", }, - Spec: v1alpha1.IPAMLeaseSpec{ + Spec: v1alpha1.IPAMClaimSpec{ Network: "tenantblue", Interface: "iface321", }, } - ipamLease, err := exampleClient.K8sV1alpha1().IPAMLeases("default").Create( + ipamClaim, err := exampleClient.K8sV1alpha1().IPAMClaims("default").Create( context.Background(), pip, metav1.CreateOptions{}, @@ -54,24 +54,24 @@ func main() { defer func() { // teardown persistent IP - _ = exampleClient.K8sV1alpha1().IPAMLeases("default").Delete( + _ = exampleClient.K8sV1alpha1().IPAMClaims("default").Delete( context.Background(), pip.Name, metav1.DeleteOptions{}, ) }() - ipamLease.Status.IPs = []string{"winner", "winner", "chicken", "dinner"} - _, err = exampleClient.K8sV1alpha1().IPAMLeases("default").UpdateStatus( + ipamClaim.Status.IPs = []string{"winner", "winner", "chicken", "dinner"} + _, err = exampleClient.K8sV1alpha1().IPAMClaims("default").UpdateStatus( context.Background(), - ipamLease, + ipamClaim, metav1.UpdateOptions{}, ) if err != nil { glog.Fatalf("Error creating a dummy persistentIP object: %v", err) } - allPersistentIPs, err := exampleClient.K8sV1alpha1().IPAMLeases(metav1.NamespaceAll).List( + allPersistentIPs, err := exampleClient.K8sV1alpha1().IPAMClaims(metav1.NamespaceAll).List( context.Background(), metav1.ListOptions{}, ) @@ -80,7 +80,7 @@ func main() { } for _, persistentIP := range allPersistentIPs.Items { - fmt.Printf("IPAM lease name: %q\n", persistentIP.Name) + fmt.Printf("IPAM claim name: %q\n", persistentIP.Name) fmt.Printf(" - spec: %v\n", persistentIP.Spec) fmt.Printf(" - status: %v\n", persistentIP.Status) } diff --git a/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/fake/fake_ipamclaim.go b/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/fake/fake_ipamclaim.go new file mode 100644 index 0000000..9e3ae88 --- /dev/null +++ b/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/fake/fake_ipamclaim.go @@ -0,0 +1,141 @@ +/* +Copyright 2023 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" + + v1alpha1 "github.com/maiqueb/persistentips/pkg/crd/persistentip/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeIPAMClaims implements IPAMClaimInterface +type FakeIPAMClaims struct { + Fake *FakeK8sV1alpha1 + ns string +} + +var ipamclaimsResource = v1alpha1.SchemeGroupVersion.WithResource("ipamclaims") + +var ipamclaimsKind = v1alpha1.SchemeGroupVersion.WithKind("IPAMClaim") + +// Get takes name of the iPAMClaim, and returns the corresponding iPAMClaim object, and an error if there is any. +func (c *FakeIPAMClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IPAMClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(ipamclaimsResource, c.ns, name), &v1alpha1.IPAMClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.IPAMClaim), err +} + +// List takes label and field selectors, and returns the list of IPAMClaims that match those selectors. +func (c *FakeIPAMClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IPAMClaimList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(ipamclaimsResource, ipamclaimsKind, c.ns, opts), &v1alpha1.IPAMClaimList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.IPAMClaimList{ListMeta: obj.(*v1alpha1.IPAMClaimList).ListMeta} + for _, item := range obj.(*v1alpha1.IPAMClaimList).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 iPAMClaims. +func (c *FakeIPAMClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(ipamclaimsResource, c.ns, opts)) + +} + +// Create takes the representation of a iPAMClaim and creates it. Returns the server's representation of the iPAMClaim, and an error, if there is any. +func (c *FakeIPAMClaims) Create(ctx context.Context, iPAMClaim *v1alpha1.IPAMClaim, opts v1.CreateOptions) (result *v1alpha1.IPAMClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(ipamclaimsResource, c.ns, iPAMClaim), &v1alpha1.IPAMClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.IPAMClaim), err +} + +// Update takes the representation of a iPAMClaim and updates it. Returns the server's representation of the iPAMClaim, and an error, if there is any. +func (c *FakeIPAMClaims) Update(ctx context.Context, iPAMClaim *v1alpha1.IPAMClaim, opts v1.UpdateOptions) (result *v1alpha1.IPAMClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(ipamclaimsResource, c.ns, iPAMClaim), &v1alpha1.IPAMClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.IPAMClaim), 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 *FakeIPAMClaims) UpdateStatus(ctx context.Context, iPAMClaim *v1alpha1.IPAMClaim, opts v1.UpdateOptions) (*v1alpha1.IPAMClaim, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(ipamclaimsResource, "status", c.ns, iPAMClaim), &v1alpha1.IPAMClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.IPAMClaim), err +} + +// Delete takes name of the iPAMClaim and deletes it. Returns an error if one occurs. +func (c *FakeIPAMClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(ipamclaimsResource, c.ns, name, opts), &v1alpha1.IPAMClaim{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeIPAMClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(ipamclaimsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.IPAMClaimList{}) + return err +} + +// Patch applies the patch and returns the patched iPAMClaim. +func (c *FakeIPAMClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPAMClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(ipamclaimsResource, c.ns, name, pt, data, subresources...), &v1alpha1.IPAMClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.IPAMClaim), err +} diff --git a/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/fake/fake_ipamlease.go b/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/fake/fake_ipamlease.go deleted file mode 100644 index 75811d7..0000000 --- a/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/fake/fake_ipamlease.go +++ /dev/null @@ -1,141 +0,0 @@ -/* -Copyright 2023 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" - - v1alpha1 "github.com/maiqueb/persistentips/pkg/crd/persistentip/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeIPAMLeases implements IPAMLeaseInterface -type FakeIPAMLeases struct { - Fake *FakeK8sV1alpha1 - ns string -} - -var ipamleasesResource = v1alpha1.SchemeGroupVersion.WithResource("ipamleases") - -var ipamleasesKind = v1alpha1.SchemeGroupVersion.WithKind("IPAMLease") - -// Get takes name of the iPAMLease, and returns the corresponding iPAMLease object, and an error if there is any. -func (c *FakeIPAMLeases) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IPAMLease, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(ipamleasesResource, c.ns, name), &v1alpha1.IPAMLease{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPAMLease), err -} - -// List takes label and field selectors, and returns the list of IPAMLeases that match those selectors. -func (c *FakeIPAMLeases) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IPAMLeaseList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(ipamleasesResource, ipamleasesKind, c.ns, opts), &v1alpha1.IPAMLeaseList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.IPAMLeaseList{ListMeta: obj.(*v1alpha1.IPAMLeaseList).ListMeta} - for _, item := range obj.(*v1alpha1.IPAMLeaseList).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 iPAMLeases. -func (c *FakeIPAMLeases) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(ipamleasesResource, c.ns, opts)) - -} - -// Create takes the representation of a iPAMLease and creates it. Returns the server's representation of the iPAMLease, and an error, if there is any. -func (c *FakeIPAMLeases) Create(ctx context.Context, iPAMLease *v1alpha1.IPAMLease, opts v1.CreateOptions) (result *v1alpha1.IPAMLease, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(ipamleasesResource, c.ns, iPAMLease), &v1alpha1.IPAMLease{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPAMLease), err -} - -// Update takes the representation of a iPAMLease and updates it. Returns the server's representation of the iPAMLease, and an error, if there is any. -func (c *FakeIPAMLeases) Update(ctx context.Context, iPAMLease *v1alpha1.IPAMLease, opts v1.UpdateOptions) (result *v1alpha1.IPAMLease, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(ipamleasesResource, c.ns, iPAMLease), &v1alpha1.IPAMLease{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPAMLease), 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 *FakeIPAMLeases) UpdateStatus(ctx context.Context, iPAMLease *v1alpha1.IPAMLease, opts v1.UpdateOptions) (*v1alpha1.IPAMLease, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(ipamleasesResource, "status", c.ns, iPAMLease), &v1alpha1.IPAMLease{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPAMLease), err -} - -// Delete takes name of the iPAMLease and deletes it. Returns an error if one occurs. -func (c *FakeIPAMLeases) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(ipamleasesResource, c.ns, name, opts), &v1alpha1.IPAMLease{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeIPAMLeases) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(ipamleasesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.IPAMLeaseList{}) - return err -} - -// Patch applies the patch and returns the patched iPAMLease. -func (c *FakeIPAMLeases) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPAMLease, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(ipamleasesResource, c.ns, name, pt, data, subresources...), &v1alpha1.IPAMLease{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPAMLease), err -} diff --git a/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/fake/fake_persistentip_client.go b/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/fake/fake_persistentip_client.go index 8d0ad1f..3ff487a 100644 --- a/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/fake/fake_persistentip_client.go +++ b/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/fake/fake_persistentip_client.go @@ -28,8 +28,8 @@ type FakeK8sV1alpha1 struct { *testing.Fake } -func (c *FakeK8sV1alpha1) IPAMLeases(namespace string) v1alpha1.IPAMLeaseInterface { - return &FakeIPAMLeases{c, namespace} +func (c *FakeK8sV1alpha1) IPAMClaims(namespace string) v1alpha1.IPAMClaimInterface { + return &FakeIPAMClaims{c, namespace} } // RESTClient returns a RESTClient that is used to communicate diff --git a/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/generated_expansion.go b/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/generated_expansion.go index 50352c8..916f18c 100644 --- a/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/generated_expansion.go +++ b/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/generated_expansion.go @@ -18,4 +18,4 @@ limitations under the License. package v1alpha1 -type IPAMLeaseExpansion interface{} +type IPAMClaimExpansion interface{} diff --git a/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/ipamlease.go b/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/ipamclaim.go similarity index 56% rename from pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/ipamlease.go rename to pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/ipamclaim.go index 2d59378..b9c5ad6 100644 --- a/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/ipamlease.go +++ b/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/ipamclaim.go @@ -30,46 +30,46 @@ import ( rest "k8s.io/client-go/rest" ) -// IPAMLeasesGetter has a method to return a IPAMLeaseInterface. +// IPAMClaimsGetter has a method to return a IPAMClaimInterface. // A group's client should implement this interface. -type IPAMLeasesGetter interface { - IPAMLeases(namespace string) IPAMLeaseInterface +type IPAMClaimsGetter interface { + IPAMClaims(namespace string) IPAMClaimInterface } -// IPAMLeaseInterface has methods to work with IPAMLease resources. -type IPAMLeaseInterface interface { - Create(ctx context.Context, iPAMLease *v1alpha1.IPAMLease, opts v1.CreateOptions) (*v1alpha1.IPAMLease, error) - Update(ctx context.Context, iPAMLease *v1alpha1.IPAMLease, opts v1.UpdateOptions) (*v1alpha1.IPAMLease, error) - UpdateStatus(ctx context.Context, iPAMLease *v1alpha1.IPAMLease, opts v1.UpdateOptions) (*v1alpha1.IPAMLease, error) +// IPAMClaimInterface has methods to work with IPAMClaim resources. +type IPAMClaimInterface interface { + Create(ctx context.Context, iPAMClaim *v1alpha1.IPAMClaim, opts v1.CreateOptions) (*v1alpha1.IPAMClaim, error) + Update(ctx context.Context, iPAMClaim *v1alpha1.IPAMClaim, opts v1.UpdateOptions) (*v1alpha1.IPAMClaim, error) + UpdateStatus(ctx context.Context, iPAMClaim *v1alpha1.IPAMClaim, opts v1.UpdateOptions) (*v1alpha1.IPAMClaim, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.IPAMLease, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.IPAMLeaseList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.IPAMClaim, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.IPAMClaimList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPAMLease, err error) - IPAMLeaseExpansion + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPAMClaim, err error) + IPAMClaimExpansion } -// iPAMLeases implements IPAMLeaseInterface -type iPAMLeases struct { +// iPAMClaims implements IPAMClaimInterface +type iPAMClaims struct { client rest.Interface ns string } -// newIPAMLeases returns a IPAMLeases -func newIPAMLeases(c *K8sV1alpha1Client, namespace string) *iPAMLeases { - return &iPAMLeases{ +// newIPAMClaims returns a IPAMClaims +func newIPAMClaims(c *K8sV1alpha1Client, namespace string) *iPAMClaims { + return &iPAMClaims{ client: c.RESTClient(), ns: namespace, } } -// Get takes name of the iPAMLease, and returns the corresponding iPAMLease object, and an error if there is any. -func (c *iPAMLeases) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IPAMLease, err error) { - result = &v1alpha1.IPAMLease{} +// Get takes name of the iPAMClaim, and returns the corresponding iPAMClaim object, and an error if there is any. +func (c *iPAMClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IPAMClaim, err error) { + result = &v1alpha1.IPAMClaim{} err = c.client.Get(). Namespace(c.ns). - Resource("ipamleases"). + Resource("ipamclaims"). Name(name). VersionedParams(&options, scheme.ParameterCodec). Do(ctx). @@ -77,16 +77,16 @@ func (c *iPAMLeases) Get(ctx context.Context, name string, options v1.GetOptions return } -// List takes label and field selectors, and returns the list of IPAMLeases that match those selectors. -func (c *iPAMLeases) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IPAMLeaseList, err error) { +// List takes label and field selectors, and returns the list of IPAMClaims that match those selectors. +func (c *iPAMClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IPAMClaimList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1alpha1.IPAMLeaseList{} + result = &v1alpha1.IPAMClaimList{} err = c.client.Get(). Namespace(c.ns). - Resource("ipamleases"). + Resource("ipamclaims"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). Do(ctx). @@ -94,8 +94,8 @@ func (c *iPAMLeases) List(ctx context.Context, opts v1.ListOptions) (result *v1a return } -// Watch returns a watch.Interface that watches the requested iPAMLeases. -func (c *iPAMLeases) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +// Watch returns a watch.Interface that watches the requested iPAMClaims. +func (c *iPAMClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -103,34 +103,34 @@ func (c *iPAMLeases) Watch(ctx context.Context, opts v1.ListOptions) (watch.Inte opts.Watch = true return c.client.Get(). Namespace(c.ns). - Resource("ipamleases"). + Resource("ipamclaims"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). Watch(ctx) } -// Create takes the representation of a iPAMLease and creates it. Returns the server's representation of the iPAMLease, and an error, if there is any. -func (c *iPAMLeases) Create(ctx context.Context, iPAMLease *v1alpha1.IPAMLease, opts v1.CreateOptions) (result *v1alpha1.IPAMLease, err error) { - result = &v1alpha1.IPAMLease{} +// Create takes the representation of a iPAMClaim and creates it. Returns the server's representation of the iPAMClaim, and an error, if there is any. +func (c *iPAMClaims) Create(ctx context.Context, iPAMClaim *v1alpha1.IPAMClaim, opts v1.CreateOptions) (result *v1alpha1.IPAMClaim, err error) { + result = &v1alpha1.IPAMClaim{} err = c.client.Post(). Namespace(c.ns). - Resource("ipamleases"). + Resource("ipamclaims"). VersionedParams(&opts, scheme.ParameterCodec). - Body(iPAMLease). + Body(iPAMClaim). Do(ctx). Into(result) return } -// Update takes the representation of a iPAMLease and updates it. Returns the server's representation of the iPAMLease, and an error, if there is any. -func (c *iPAMLeases) Update(ctx context.Context, iPAMLease *v1alpha1.IPAMLease, opts v1.UpdateOptions) (result *v1alpha1.IPAMLease, err error) { - result = &v1alpha1.IPAMLease{} +// Update takes the representation of a iPAMClaim and updates it. Returns the server's representation of the iPAMClaim, and an error, if there is any. +func (c *iPAMClaims) Update(ctx context.Context, iPAMClaim *v1alpha1.IPAMClaim, opts v1.UpdateOptions) (result *v1alpha1.IPAMClaim, err error) { + result = &v1alpha1.IPAMClaim{} err = c.client.Put(). Namespace(c.ns). - Resource("ipamleases"). - Name(iPAMLease.Name). + Resource("ipamclaims"). + Name(iPAMClaim.Name). VersionedParams(&opts, scheme.ParameterCodec). - Body(iPAMLease). + Body(iPAMClaim). Do(ctx). Into(result) return @@ -138,25 +138,25 @@ func (c *iPAMLeases) Update(ctx context.Context, iPAMLease *v1alpha1.IPAMLease, // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *iPAMLeases) UpdateStatus(ctx context.Context, iPAMLease *v1alpha1.IPAMLease, opts v1.UpdateOptions) (result *v1alpha1.IPAMLease, err error) { - result = &v1alpha1.IPAMLease{} +func (c *iPAMClaims) UpdateStatus(ctx context.Context, iPAMClaim *v1alpha1.IPAMClaim, opts v1.UpdateOptions) (result *v1alpha1.IPAMClaim, err error) { + result = &v1alpha1.IPAMClaim{} err = c.client.Put(). Namespace(c.ns). - Resource("ipamleases"). - Name(iPAMLease.Name). + Resource("ipamclaims"). + Name(iPAMClaim.Name). SubResource("status"). VersionedParams(&opts, scheme.ParameterCodec). - Body(iPAMLease). + Body(iPAMClaim). Do(ctx). Into(result) return } -// Delete takes name of the iPAMLease and deletes it. Returns an error if one occurs. -func (c *iPAMLeases) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +// Delete takes name of the iPAMClaim and deletes it. Returns an error if one occurs. +func (c *iPAMClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). - Resource("ipamleases"). + Resource("ipamclaims"). Name(name). Body(&opts). Do(ctx). @@ -164,14 +164,14 @@ func (c *iPAMLeases) Delete(ctx context.Context, name string, opts v1.DeleteOpti } // DeleteCollection deletes a collection of objects. -func (c *iPAMLeases) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *iPAMClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { var timeout time.Duration if listOpts.TimeoutSeconds != nil { timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second } return c.client.Delete(). Namespace(c.ns). - Resource("ipamleases"). + Resource("ipamclaims"). VersionedParams(&listOpts, scheme.ParameterCodec). Timeout(timeout). Body(&opts). @@ -179,12 +179,12 @@ func (c *iPAMLeases) DeleteCollection(ctx context.Context, opts v1.DeleteOptions Error() } -// Patch applies the patch and returns the patched iPAMLease. -func (c *iPAMLeases) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPAMLease, err error) { - result = &v1alpha1.IPAMLease{} +// Patch applies the patch and returns the patched iPAMClaim. +func (c *iPAMClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPAMClaim, err error) { + result = &v1alpha1.IPAMClaim{} err = c.client.Patch(pt). Namespace(c.ns). - Resource("ipamleases"). + Resource("ipamclaims"). Name(name). SubResource(subresources...). VersionedParams(&opts, scheme.ParameterCodec). diff --git a/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/persistentip_client.go b/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/persistentip_client.go index d76e52a..da1cc58 100644 --- a/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/persistentip_client.go +++ b/pkg/crd/persistentip/v1alpha1/apis/clientset/versioned/typed/persistentip/v1alpha1/persistentip_client.go @@ -28,7 +28,7 @@ import ( type K8sV1alpha1Interface interface { RESTClient() rest.Interface - IPAMLeasesGetter + IPAMClaimsGetter } // K8sV1alpha1Client is used to interact with features provided by the k8s.cni.cncf.io group. @@ -36,8 +36,8 @@ type K8sV1alpha1Client struct { restClient rest.Interface } -func (c *K8sV1alpha1Client) IPAMLeases(namespace string) IPAMLeaseInterface { - return newIPAMLeases(c, namespace) +func (c *K8sV1alpha1Client) IPAMClaims(namespace string) IPAMClaimInterface { + return newIPAMClaims(c, namespace) } // NewForConfig creates a new K8sV1alpha1Client for the given config. diff --git a/pkg/crd/persistentip/v1alpha1/apis/informers/externalversions/generic.go b/pkg/crd/persistentip/v1alpha1/apis/informers/externalversions/generic.go index 75a8957..ad0b3c5 100644 --- a/pkg/crd/persistentip/v1alpha1/apis/informers/externalversions/generic.go +++ b/pkg/crd/persistentip/v1alpha1/apis/informers/externalversions/generic.go @@ -53,8 +53,8 @@ func (f *genericInformer) Lister() cache.GenericLister { func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { // Group=k8s.cni.cncf.io, Version=v1alpha1 - case v1alpha1.SchemeGroupVersion.WithResource("ipamleases"): - return &genericInformer{resource: resource.GroupResource(), informer: f.K8s().V1alpha1().IPAMLeases().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("ipamclaims"): + return &genericInformer{resource: resource.GroupResource(), informer: f.K8s().V1alpha1().IPAMClaims().Informer()}, nil } diff --git a/pkg/crd/persistentip/v1alpha1/apis/informers/externalversions/persistentip/v1alpha1/interface.go b/pkg/crd/persistentip/v1alpha1/apis/informers/externalversions/persistentip/v1alpha1/interface.go index 49d108f..fc63008 100644 --- a/pkg/crd/persistentip/v1alpha1/apis/informers/externalversions/persistentip/v1alpha1/interface.go +++ b/pkg/crd/persistentip/v1alpha1/apis/informers/externalversions/persistentip/v1alpha1/interface.go @@ -24,8 +24,8 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { - // IPAMLeases returns a IPAMLeaseInformer. - IPAMLeases() IPAMLeaseInformer + // IPAMClaims returns a IPAMClaimInformer. + IPAMClaims() IPAMClaimInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// IPAMLeases returns a IPAMLeaseInformer. -func (v *version) IPAMLeases() IPAMLeaseInformer { - return &iPAMLeaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +// IPAMClaims returns a IPAMClaimInformer. +func (v *version) IPAMClaims() IPAMClaimInformer { + return &iPAMClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/pkg/crd/persistentip/v1alpha1/apis/informers/externalversions/persistentip/v1alpha1/ipamlease.go b/pkg/crd/persistentip/v1alpha1/apis/informers/externalversions/persistentip/v1alpha1/ipamclaim.go similarity index 71% rename from pkg/crd/persistentip/v1alpha1/apis/informers/externalversions/persistentip/v1alpha1/ipamlease.go rename to pkg/crd/persistentip/v1alpha1/apis/informers/externalversions/persistentip/v1alpha1/ipamclaim.go index e842266..05e1b23 100644 --- a/pkg/crd/persistentip/v1alpha1/apis/informers/externalversions/persistentip/v1alpha1/ipamlease.go +++ b/pkg/crd/persistentip/v1alpha1/apis/informers/externalversions/persistentip/v1alpha1/ipamclaim.go @@ -32,59 +32,59 @@ import ( cache "k8s.io/client-go/tools/cache" ) -// IPAMLeaseInformer provides access to a shared informer and lister for -// IPAMLeases. -type IPAMLeaseInformer interface { +// IPAMClaimInformer provides access to a shared informer and lister for +// IPAMClaims. +type IPAMClaimInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha1.IPAMLeaseLister + Lister() v1alpha1.IPAMClaimLister } -type iPAMLeaseInformer struct { +type iPAMClaimInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } -// NewIPAMLeaseInformer constructs a new informer for IPAMLease type. +// NewIPAMClaimInformer constructs a new informer for IPAMClaim 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 NewIPAMLeaseInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredIPAMLeaseInformer(client, namespace, resyncPeriod, indexers, nil) +func NewIPAMClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIPAMClaimInformer(client, namespace, resyncPeriod, indexers, nil) } -// NewFilteredIPAMLeaseInformer constructs a new informer for IPAMLease type. +// NewFilteredIPAMClaimInformer constructs a new informer for IPAMClaim 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 NewFilteredIPAMLeaseInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { +func NewFilteredIPAMClaimInformer(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.K8sV1alpha1().IPAMLeases(namespace).List(context.TODO(), options) + return client.K8sV1alpha1().IPAMClaims(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.K8sV1alpha1().IPAMLeases(namespace).Watch(context.TODO(), options) + return client.K8sV1alpha1().IPAMClaims(namespace).Watch(context.TODO(), options) }, }, - &persistentipv1alpha1.IPAMLease{}, + &persistentipv1alpha1.IPAMClaim{}, resyncPeriod, indexers, ) } -func (f *iPAMLeaseInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredIPAMLeaseInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +func (f *iPAMClaimInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIPAMClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } -func (f *iPAMLeaseInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&persistentipv1alpha1.IPAMLease{}, f.defaultInformer) +func (f *iPAMClaimInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&persistentipv1alpha1.IPAMClaim{}, f.defaultInformer) } -func (f *iPAMLeaseInformer) Lister() v1alpha1.IPAMLeaseLister { - return v1alpha1.NewIPAMLeaseLister(f.Informer().GetIndexer()) +func (f *iPAMClaimInformer) Lister() v1alpha1.IPAMClaimLister { + return v1alpha1.NewIPAMClaimLister(f.Informer().GetIndexer()) } diff --git a/pkg/crd/persistentip/v1alpha1/apis/listers/persistentip/v1alpha1/expansion_generated.go b/pkg/crd/persistentip/v1alpha1/apis/listers/persistentip/v1alpha1/expansion_generated.go index 6e2fa29..32e1d45 100644 --- a/pkg/crd/persistentip/v1alpha1/apis/listers/persistentip/v1alpha1/expansion_generated.go +++ b/pkg/crd/persistentip/v1alpha1/apis/listers/persistentip/v1alpha1/expansion_generated.go @@ -18,10 +18,10 @@ limitations under the License. package v1alpha1 -// IPAMLeaseListerExpansion allows custom methods to be added to -// IPAMLeaseLister. -type IPAMLeaseListerExpansion interface{} +// IPAMClaimListerExpansion allows custom methods to be added to +// IPAMClaimLister. +type IPAMClaimListerExpansion interface{} -// IPAMLeaseNamespaceListerExpansion allows custom methods to be added to -// IPAMLeaseNamespaceLister. -type IPAMLeaseNamespaceListerExpansion interface{} +// IPAMClaimNamespaceListerExpansion allows custom methods to be added to +// IPAMClaimNamespaceLister. +type IPAMClaimNamespaceListerExpansion interface{} diff --git a/pkg/crd/persistentip/v1alpha1/apis/listers/persistentip/v1alpha1/ipamclaim.go b/pkg/crd/persistentip/v1alpha1/apis/listers/persistentip/v1alpha1/ipamclaim.go new file mode 100644 index 0000000..750d764 --- /dev/null +++ b/pkg/crd/persistentip/v1alpha1/apis/listers/persistentip/v1alpha1/ipamclaim.go @@ -0,0 +1,99 @@ +/* +Copyright 2023 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/maiqueb/persistentips/pkg/crd/persistentip/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// IPAMClaimLister helps list IPAMClaims. +// All objects returned here must be treated as read-only. +type IPAMClaimLister interface { + // List lists all IPAMClaims in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.IPAMClaim, err error) + // IPAMClaims returns an object that can list and get IPAMClaims. + IPAMClaims(namespace string) IPAMClaimNamespaceLister + IPAMClaimListerExpansion +} + +// iPAMClaimLister implements the IPAMClaimLister interface. +type iPAMClaimLister struct { + indexer cache.Indexer +} + +// NewIPAMClaimLister returns a new IPAMClaimLister. +func NewIPAMClaimLister(indexer cache.Indexer) IPAMClaimLister { + return &iPAMClaimLister{indexer: indexer} +} + +// List lists all IPAMClaims in the indexer. +func (s *iPAMClaimLister) List(selector labels.Selector) (ret []*v1alpha1.IPAMClaim, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.IPAMClaim)) + }) + return ret, err +} + +// IPAMClaims returns an object that can list and get IPAMClaims. +func (s *iPAMClaimLister) IPAMClaims(namespace string) IPAMClaimNamespaceLister { + return iPAMClaimNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// IPAMClaimNamespaceLister helps list and get IPAMClaims. +// All objects returned here must be treated as read-only. +type IPAMClaimNamespaceLister interface { + // List lists all IPAMClaims in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.IPAMClaim, err error) + // Get retrieves the IPAMClaim from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.IPAMClaim, error) + IPAMClaimNamespaceListerExpansion +} + +// iPAMClaimNamespaceLister implements the IPAMClaimNamespaceLister +// interface. +type iPAMClaimNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all IPAMClaims in the indexer for a given namespace. +func (s iPAMClaimNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.IPAMClaim, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.IPAMClaim)) + }) + return ret, err +} + +// Get retrieves the IPAMClaim from the indexer for a given namespace and name. +func (s iPAMClaimNamespaceLister) Get(name string) (*v1alpha1.IPAMClaim, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("ipamclaim"), name) + } + return obj.(*v1alpha1.IPAMClaim), nil +} diff --git a/pkg/crd/persistentip/v1alpha1/apis/listers/persistentip/v1alpha1/ipamlease.go b/pkg/crd/persistentip/v1alpha1/apis/listers/persistentip/v1alpha1/ipamlease.go deleted file mode 100644 index 10d5f5b..0000000 --- a/pkg/crd/persistentip/v1alpha1/apis/listers/persistentip/v1alpha1/ipamlease.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2023 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/maiqueb/persistentips/pkg/crd/persistentip/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// IPAMLeaseLister helps list IPAMLeases. -// All objects returned here must be treated as read-only. -type IPAMLeaseLister interface { - // List lists all IPAMLeases in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.IPAMLease, err error) - // IPAMLeases returns an object that can list and get IPAMLeases. - IPAMLeases(namespace string) IPAMLeaseNamespaceLister - IPAMLeaseListerExpansion -} - -// iPAMLeaseLister implements the IPAMLeaseLister interface. -type iPAMLeaseLister struct { - indexer cache.Indexer -} - -// NewIPAMLeaseLister returns a new IPAMLeaseLister. -func NewIPAMLeaseLister(indexer cache.Indexer) IPAMLeaseLister { - return &iPAMLeaseLister{indexer: indexer} -} - -// List lists all IPAMLeases in the indexer. -func (s *iPAMLeaseLister) List(selector labels.Selector) (ret []*v1alpha1.IPAMLease, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.IPAMLease)) - }) - return ret, err -} - -// IPAMLeases returns an object that can list and get IPAMLeases. -func (s *iPAMLeaseLister) IPAMLeases(namespace string) IPAMLeaseNamespaceLister { - return iPAMLeaseNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// IPAMLeaseNamespaceLister helps list and get IPAMLeases. -// All objects returned here must be treated as read-only. -type IPAMLeaseNamespaceLister interface { - // List lists all IPAMLeases in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.IPAMLease, err error) - // Get retrieves the IPAMLease from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.IPAMLease, error) - IPAMLeaseNamespaceListerExpansion -} - -// iPAMLeaseNamespaceLister implements the IPAMLeaseNamespaceLister -// interface. -type iPAMLeaseNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all IPAMLeases in the indexer for a given namespace. -func (s iPAMLeaseNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.IPAMLease, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.IPAMLease)) - }) - return ret, err -} - -// Get retrieves the IPAMLease from the indexer for a given namespace and name. -func (s iPAMLeaseNamespaceLister) Get(name string) (*v1alpha1.IPAMLease, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("ipamlease"), name) - } - return obj.(*v1alpha1.IPAMLease), nil -} diff --git a/pkg/crd/persistentip/v1alpha1/register.go b/pkg/crd/persistentip/v1alpha1/register.go index 231a5e1..bdd796c 100644 --- a/pkg/crd/persistentip/v1alpha1/register.go +++ b/pkg/crd/persistentip/v1alpha1/register.go @@ -33,8 +33,8 @@ func init() { // Adds the list of known types to api.Scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, - &IPAMLease{}, - &IPAMLeaseList{}, + &IPAMClaim{}, + &IPAMClaimList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/pkg/crd/persistentip/v1alpha1/types.go b/pkg/crd/persistentip/v1alpha1/types.go index f64b4fd..8bf7c2f 100644 --- a/pkg/crd/persistentip/v1alpha1/types.go +++ b/pkg/crd/persistentip/v1alpha1/types.go @@ -14,36 +14,36 @@ import ( // +genclient // +kubebuilder:object:root=true -// +kubebuilder:resource:path=ipamleases,singular=ipamlease,scope=Namespaced +// +kubebuilder:resource:path=ipamclaims,singular=ipamclaim,scope=Namespaced // +kubebuilder:storageversion // +kubebuilder:subresource:status // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// IPAMLease is the Schema for the IPAMLease API -type IPAMLease struct { +// IPAMClaim is the Schema for the IPAMClaim API +type IPAMClaim struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec IPAMLeaseSpec `json:"spec,omitempty"` - Status IPAMLeaseStatus `json:"status,omitempty"` + Spec IPAMClaimSpec `json:"spec,omitempty"` + Status IPAMClaimStatus `json:"status,omitempty"` } -type IPAMLeaseSpec struct { +type IPAMClaimSpec struct { // The network attachment definition name for which this persistent allocation was created Network string `json:"network"` // The pod interface name for which this allocation was created Interface string `json:"interface"` } -type IPAMLeaseStatus struct { +type IPAMClaimStatus struct { // The list of IP addresses (v4, v6) that were allocated for the pod interface IPs []string `json:"ips"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type IPAMLeaseList struct { +type IPAMClaimList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []IPAMLease `json:"items"` + Items []IPAMClaim `json:"items"` } diff --git a/pkg/crd/persistentip/v1alpha1/zz_generated.deepcopy.go b/pkg/crd/persistentip/v1alpha1/zz_generated.deepcopy.go index 1481a4a..737efd7 100644 --- a/pkg/crd/persistentip/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/crd/persistentip/v1alpha1/zz_generated.deepcopy.go @@ -9,7 +9,7 @@ import ( ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAMLease) DeepCopyInto(out *IPAMLease) { +func (in *IPAMClaim) DeepCopyInto(out *IPAMClaim) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -17,18 +17,18 @@ func (in *IPAMLease) DeepCopyInto(out *IPAMLease) { in.Status.DeepCopyInto(&out.Status) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAMLease. -func (in *IPAMLease) DeepCopy() *IPAMLease { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAMClaim. +func (in *IPAMClaim) DeepCopy() *IPAMClaim { if in == nil { return nil } - out := new(IPAMLease) + out := new(IPAMClaim) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *IPAMLease) DeepCopyObject() runtime.Object { +func (in *IPAMClaim) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -36,31 +36,31 @@ func (in *IPAMLease) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAMLeaseList) DeepCopyInto(out *IPAMLeaseList) { +func (in *IPAMClaimList) DeepCopyInto(out *IPAMClaimList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]IPAMLease, len(*in)) + *out = make([]IPAMClaim, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAMLeaseList. -func (in *IPAMLeaseList) DeepCopy() *IPAMLeaseList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAMClaimList. +func (in *IPAMClaimList) DeepCopy() *IPAMClaimList { if in == nil { return nil } - out := new(IPAMLeaseList) + out := new(IPAMClaimList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *IPAMLeaseList) DeepCopyObject() runtime.Object { +func (in *IPAMClaimList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -68,22 +68,22 @@ func (in *IPAMLeaseList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAMLeaseSpec) DeepCopyInto(out *IPAMLeaseSpec) { +func (in *IPAMClaimSpec) DeepCopyInto(out *IPAMClaimSpec) { *out = *in } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAMLeaseSpec. -func (in *IPAMLeaseSpec) DeepCopy() *IPAMLeaseSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAMClaimSpec. +func (in *IPAMClaimSpec) DeepCopy() *IPAMClaimSpec { if in == nil { return nil } - out := new(IPAMLeaseSpec) + out := new(IPAMClaimSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAMLeaseStatus) DeepCopyInto(out *IPAMLeaseStatus) { +func (in *IPAMClaimStatus) DeepCopyInto(out *IPAMClaimStatus) { *out = *in if in.IPs != nil { in, out := &in.IPs, &out.IPs @@ -92,12 +92,12 @@ func (in *IPAMLeaseStatus) DeepCopyInto(out *IPAMLeaseStatus) { } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAMLeaseStatus. -func (in *IPAMLeaseStatus) DeepCopy() *IPAMLeaseStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAMClaimStatus. +func (in *IPAMClaimStatus) DeepCopy() *IPAMClaimStatus { if in == nil { return nil } - out := new(IPAMLeaseStatus) + out := new(IPAMClaimStatus) in.DeepCopyInto(out) return out }