Update code generator script

The script we were using is fully deprecated so we need to upgrade
to a new code generator.
This commit is contained in:
Thomas Ferrandiz 2024-12-09 13:17:43 +00:00
parent 5bc9a84a84
commit daa12ca505
47 changed files with 343 additions and 750 deletions

View File

@ -36,7 +36,7 @@ jobs:
- name: Generate code
if: steps.changed-files.outputs.any_changed == 'true'
run: chmod +x vendor/k8s.io/code-generator/generate-internal-groups.sh && ./hack/generate-code.sh && hack/verify-codegen.sh
run: ./hack/generate-code.sh && hack/verify-codegen.sh
- name: Run go fmt
if: steps.changed-files.outputs.any_changed == 'true'

View File

@ -19,9 +19,9 @@ import (
nadclient "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned"
nadinformers "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/informers/externalversions"
wbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
wbinformers "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/informers/externalversions"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/controlloop"
wbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
wbinformers "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/informers/externalversions"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/logging"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/reconciler"
)

View File

@ -13,8 +13,8 @@ import (
"k8s.io/client-go/tools/clientcmd"
"k8s.io/klog/v2"
clientset "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
informers "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/informers/externalversions"
clientset "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
informers "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/informers/externalversions"
node_controller "github.com/k8snetworkplumbingwg/whereabouts/pkg/node-controller"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/node-controller/signals"
)

View File

@ -25,9 +25,9 @@ import (
"github.com/k8snetworkplumbingwg/whereabouts/pkg/allocate"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
wbclientset "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned/fake"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/config"
wbclientset "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned/fake"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/storage/kubernetes"
whereaboutstypes "github.com/k8snetworkplumbingwg/whereabouts/pkg/types"
)

View File

@ -17,7 +17,7 @@ import (
"github.com/k8snetworkplumbingwg/whereabouts/e2e/entities"
whereaboutscnicncfiov1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
wbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
wbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
)
const (

View File

@ -20,11 +20,15 @@ set -o pipefail
SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
bash ./vendor/k8s.io/code-generator/generate-groups.sh "client,informer,lister" \
github.com/k8snetworkplumbingwg/whereabouts/pkg/client \
github.com/k8snetworkplumbingwg/whereabouts/pkg/api \
whereabouts.cni.cncf.io:v1alpha1 \
--go-header-file "${SCRIPT_ROOT}"/hack/boilerplate.go.txt
CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}
source "${CODEGEN_PKG}/kube_codegen.sh"
cp -r github.com/k8snetworkplumbingwg/whereabouts/pkg/client/* pkg/client
THIS_PKG="github.com/k8snetworkplumbingwg/whereabouts"
kube::codegen::gen_client \
--with-watch \
--output-dir "${SCRIPT_ROOT}/pkg/generated" \
--output-pkg "${THIS_PKG}/pkg/generated" \
--boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
"${SCRIPT_ROOT}/pkg/api"

View File

@ -4,13 +4,12 @@ set -o errexit
set -o nounset
set -o pipefail
SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")/..
SCRIPT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
DIFFROOT="${SCRIPT_ROOT}/pkg"
TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/pkg"
_tmp="${SCRIPT_ROOT}/_tmp"
TMP_DIFFROOT="$(mktemp -d -t "$(basename "$0").XXXXXX")/pkg"
cleanup() {
rm -rf "${_tmp}"
rm -rf "${TMP_DIFFROOT}"
}
trap "cleanup" EXIT SIGINT
@ -20,6 +19,7 @@ mkdir -p "${TMP_DIFFROOT}"
cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}"
"${SCRIPT_ROOT}/hack/update-codegen.sh"
echo "diffing ${DIFFROOT} against freshly generated codegen"
ret=0
diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$?

View File

@ -1,177 +0,0 @@
/*
Copyright 2024 The Kubernetes Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
scheme "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// IPPoolsGetter has a method to return a IPPoolInterface.
// A group's client should implement this interface.
type IPPoolsGetter interface {
IPPools(namespace string) IPPoolInterface
}
// IPPoolInterface has methods to work with IPPool resources.
type IPPoolInterface interface {
Create(ctx context.Context, iPPool *v1alpha1.IPPool, opts v1.CreateOptions) (*v1alpha1.IPPool, error)
Update(ctx context.Context, iPPool *v1alpha1.IPPool, opts v1.UpdateOptions) (*v1alpha1.IPPool, 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.IPPool, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.IPPoolList, 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.IPPool, err error)
IPPoolExpansion
}
// iPPools implements IPPoolInterface
type iPPools struct {
client rest.Interface
ns string
}
// newIPPools returns a IPPools
func newIPPools(c *WhereaboutsV1alpha1Client, namespace string) *iPPools {
return &iPPools{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the iPPool, and returns the corresponding iPPool object, and an error if there is any.
func (c *iPPools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IPPool, err error) {
result = &v1alpha1.IPPool{}
err = c.client.Get().
Namespace(c.ns).
Resource("ippools").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of IPPools that match those selectors.
func (c *iPPools) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IPPoolList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.IPPoolList{}
err = c.client.Get().
Namespace(c.ns).
Resource("ippools").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested iPPools.
func (c *iPPools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("ippools").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a iPPool and creates it. Returns the server's representation of the iPPool, and an error, if there is any.
func (c *iPPools) Create(ctx context.Context, iPPool *v1alpha1.IPPool, opts v1.CreateOptions) (result *v1alpha1.IPPool, err error) {
result = &v1alpha1.IPPool{}
err = c.client.Post().
Namespace(c.ns).
Resource("ippools").
VersionedParams(&opts, scheme.ParameterCodec).
Body(iPPool).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a iPPool and updates it. Returns the server's representation of the iPPool, and an error, if there is any.
func (c *iPPools) Update(ctx context.Context, iPPool *v1alpha1.IPPool, opts v1.UpdateOptions) (result *v1alpha1.IPPool, err error) {
result = &v1alpha1.IPPool{}
err = c.client.Put().
Namespace(c.ns).
Resource("ippools").
Name(iPPool.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(iPPool).
Do(ctx).
Into(result)
return
}
// Delete takes name of the iPPool and deletes it. Returns an error if one occurs.
func (c *iPPools) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("ippools").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *iPPools) 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("ippools").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched iPPool.
func (c *iPPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPPool, err error) {
result = &v1alpha1.IPPool{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("ippools").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -1,194 +0,0 @@
/*
Copyright 2024 The Kubernetes Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
scheme "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// NodeSlicePoolsGetter has a method to return a NodeSlicePoolInterface.
// A group's client should implement this interface.
type NodeSlicePoolsGetter interface {
NodeSlicePools(namespace string) NodeSlicePoolInterface
}
// NodeSlicePoolInterface has methods to work with NodeSlicePool resources.
type NodeSlicePoolInterface interface {
Create(ctx context.Context, nodeSlicePool *v1alpha1.NodeSlicePool, opts v1.CreateOptions) (*v1alpha1.NodeSlicePool, error)
Update(ctx context.Context, nodeSlicePool *v1alpha1.NodeSlicePool, opts v1.UpdateOptions) (*v1alpha1.NodeSlicePool, error)
UpdateStatus(ctx context.Context, nodeSlicePool *v1alpha1.NodeSlicePool, opts v1.UpdateOptions) (*v1alpha1.NodeSlicePool, 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.NodeSlicePool, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NodeSlicePoolList, 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.NodeSlicePool, err error)
NodeSlicePoolExpansion
}
// nodeSlicePools implements NodeSlicePoolInterface
type nodeSlicePools struct {
client rest.Interface
ns string
}
// newNodeSlicePools returns a NodeSlicePools
func newNodeSlicePools(c *WhereaboutsV1alpha1Client, namespace string) *nodeSlicePools {
return &nodeSlicePools{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the nodeSlicePool, and returns the corresponding nodeSlicePool object, and an error if there is any.
func (c *nodeSlicePools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeSlicePool, err error) {
result = &v1alpha1.NodeSlicePool{}
err = c.client.Get().
Namespace(c.ns).
Resource("nodeslicepools").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of NodeSlicePools that match those selectors.
func (c *nodeSlicePools) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeSlicePoolList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.NodeSlicePoolList{}
err = c.client.Get().
Namespace(c.ns).
Resource("nodeslicepools").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested nodeSlicePools.
func (c *nodeSlicePools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("nodeslicepools").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a nodeSlicePool and creates it. Returns the server's representation of the nodeSlicePool, and an error, if there is any.
func (c *nodeSlicePools) Create(ctx context.Context, nodeSlicePool *v1alpha1.NodeSlicePool, opts v1.CreateOptions) (result *v1alpha1.NodeSlicePool, err error) {
result = &v1alpha1.NodeSlicePool{}
err = c.client.Post().
Namespace(c.ns).
Resource("nodeslicepools").
VersionedParams(&opts, scheme.ParameterCodec).
Body(nodeSlicePool).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a nodeSlicePool and updates it. Returns the server's representation of the nodeSlicePool, and an error, if there is any.
func (c *nodeSlicePools) Update(ctx context.Context, nodeSlicePool *v1alpha1.NodeSlicePool, opts v1.UpdateOptions) (result *v1alpha1.NodeSlicePool, err error) {
result = &v1alpha1.NodeSlicePool{}
err = c.client.Put().
Namespace(c.ns).
Resource("nodeslicepools").
Name(nodeSlicePool.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(nodeSlicePool).
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 *nodeSlicePools) UpdateStatus(ctx context.Context, nodeSlicePool *v1alpha1.NodeSlicePool, opts v1.UpdateOptions) (result *v1alpha1.NodeSlicePool, err error) {
result = &v1alpha1.NodeSlicePool{}
err = c.client.Put().
Namespace(c.ns).
Resource("nodeslicepools").
Name(nodeSlicePool.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(nodeSlicePool).
Do(ctx).
Into(result)
return
}
// Delete takes name of the nodeSlicePool and deletes it. Returns an error if one occurs.
func (c *nodeSlicePools) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("nodeslicepools").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *nodeSlicePools) 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("nodeslicepools").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched nodeSlicePool.
func (c *nodeSlicePools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeSlicePool, err error) {
result = &v1alpha1.NodeSlicePool{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("nodeslicepools").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -1,177 +0,0 @@
/*
Copyright 2024 The Kubernetes Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
scheme "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// OverlappingRangeIPReservationsGetter has a method to return a OverlappingRangeIPReservationInterface.
// A group's client should implement this interface.
type OverlappingRangeIPReservationsGetter interface {
OverlappingRangeIPReservations(namespace string) OverlappingRangeIPReservationInterface
}
// OverlappingRangeIPReservationInterface has methods to work with OverlappingRangeIPReservation resources.
type OverlappingRangeIPReservationInterface interface {
Create(ctx context.Context, overlappingRangeIPReservation *v1alpha1.OverlappingRangeIPReservation, opts v1.CreateOptions) (*v1alpha1.OverlappingRangeIPReservation, error)
Update(ctx context.Context, overlappingRangeIPReservation *v1alpha1.OverlappingRangeIPReservation, opts v1.UpdateOptions) (*v1alpha1.OverlappingRangeIPReservation, 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.OverlappingRangeIPReservation, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.OverlappingRangeIPReservationList, 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.OverlappingRangeIPReservation, err error)
OverlappingRangeIPReservationExpansion
}
// overlappingRangeIPReservations implements OverlappingRangeIPReservationInterface
type overlappingRangeIPReservations struct {
client rest.Interface
ns string
}
// newOverlappingRangeIPReservations returns a OverlappingRangeIPReservations
func newOverlappingRangeIPReservations(c *WhereaboutsV1alpha1Client, namespace string) *overlappingRangeIPReservations {
return &overlappingRangeIPReservations{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the overlappingRangeIPReservation, and returns the corresponding overlappingRangeIPReservation object, and an error if there is any.
func (c *overlappingRangeIPReservations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.OverlappingRangeIPReservation, err error) {
result = &v1alpha1.OverlappingRangeIPReservation{}
err = c.client.Get().
Namespace(c.ns).
Resource("overlappingrangeipreservations").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of OverlappingRangeIPReservations that match those selectors.
func (c *overlappingRangeIPReservations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.OverlappingRangeIPReservationList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.OverlappingRangeIPReservationList{}
err = c.client.Get().
Namespace(c.ns).
Resource("overlappingrangeipreservations").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested overlappingRangeIPReservations.
func (c *overlappingRangeIPReservations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("overlappingrangeipreservations").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a overlappingRangeIPReservation and creates it. Returns the server's representation of the overlappingRangeIPReservation, and an error, if there is any.
func (c *overlappingRangeIPReservations) Create(ctx context.Context, overlappingRangeIPReservation *v1alpha1.OverlappingRangeIPReservation, opts v1.CreateOptions) (result *v1alpha1.OverlappingRangeIPReservation, err error) {
result = &v1alpha1.OverlappingRangeIPReservation{}
err = c.client.Post().
Namespace(c.ns).
Resource("overlappingrangeipreservations").
VersionedParams(&opts, scheme.ParameterCodec).
Body(overlappingRangeIPReservation).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a overlappingRangeIPReservation and updates it. Returns the server's representation of the overlappingRangeIPReservation, and an error, if there is any.
func (c *overlappingRangeIPReservations) Update(ctx context.Context, overlappingRangeIPReservation *v1alpha1.OverlappingRangeIPReservation, opts v1.UpdateOptions) (result *v1alpha1.OverlappingRangeIPReservation, err error) {
result = &v1alpha1.OverlappingRangeIPReservation{}
err = c.client.Put().
Namespace(c.ns).
Resource("overlappingrangeipreservations").
Name(overlappingRangeIPReservation.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(overlappingRangeIPReservation).
Do(ctx).
Into(result)
return
}
// Delete takes name of the overlappingRangeIPReservation and deletes it. Returns an error if one occurs.
func (c *overlappingRangeIPReservations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("overlappingrangeipreservations").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *overlappingRangeIPReservations) 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("overlappingrangeipreservations").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched overlappingRangeIPReservation.
func (c *overlappingRangeIPReservations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.OverlappingRangeIPReservation, err error) {
result = &v1alpha1.OverlappingRangeIPReservation{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("overlappingrangeipreservations").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -18,8 +18,8 @@ import (
nadinformers "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/informers/externalversions"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
wbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
wbinformers "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/informers/externalversions"
wbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
wbinformers "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/informers/externalversions"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/types"
)

View File

@ -28,10 +28,10 @@ import (
"github.com/pkg/errors"
whereaboutsv1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
wbclientset "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
wbinformers "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/informers/externalversions"
wblister "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/listers/whereabouts.cni.cncf.io/v1alpha1"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/config"
wbclientset "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
wbinformers "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/informers/externalversions"
wblister "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/listers/whereabouts.cni.cncf.io/v1alpha1"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/iphelpers"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/logging"
wbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/storage/kubernetes"

View File

@ -24,8 +24,8 @@ import (
fakenadclient "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/fake"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
wbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
fakewbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned/fake"
wbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
fakewbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned/fake"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/storage/kubernetes"
)

View File

@ -21,7 +21,7 @@ import (
"fmt"
"net/http"
whereaboutsv1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned/typed/whereabouts.cni.cncf.io/v1alpha1"
whereaboutsv1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned/typed/whereabouts.cni.cncf.io/v1alpha1"
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol"

View File

@ -18,9 +18,9 @@ limitations under the License.
package fake
import (
clientset "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
whereaboutsv1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned/typed/whereabouts.cni.cncf.io/v1alpha1"
fakewhereaboutsv1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned/typed/whereabouts.cni.cncf.io/v1alpha1/fake"
clientset "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
whereaboutsv1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned/typed/whereabouts.cni.cncf.io/v1alpha1"
fakewhereaboutsv1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned/typed/whereabouts.cni.cncf.io/v1alpha1/fake"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/discovery"
@ -30,8 +30,12 @@ import (
// NewSimpleClientset returns a clientset that will respond with the provided objects.
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
// without applying any validations and/or defaults. It shouldn't be considered a replacement
// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement
// for a real clientset and is mostly useful in simple unit tests.
//
// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves
// server side apply testing. NewClientset is only available when apply configurations are generated (e.g.
// via --with-applyconfig).
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
for _, obj := range objects {

View File

@ -40,22 +40,24 @@ var ippoolsKind = v1alpha1.SchemeGroupVersion.WithKind("IPPool")
// Get takes name of the iPPool, and returns the corresponding iPPool object, and an error if there is any.
func (c *FakeIPPools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IPPool, err error) {
emptyResult := &v1alpha1.IPPool{}
obj, err := c.Fake.
Invokes(testing.NewGetAction(ippoolsResource, c.ns, name), &v1alpha1.IPPool{})
Invokes(testing.NewGetActionWithOptions(ippoolsResource, c.ns, name, options), emptyResult)
if obj == nil {
return nil, err
return emptyResult, err
}
return obj.(*v1alpha1.IPPool), err
}
// List takes label and field selectors, and returns the list of IPPools that match those selectors.
func (c *FakeIPPools) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IPPoolList, err error) {
emptyResult := &v1alpha1.IPPoolList{}
obj, err := c.Fake.
Invokes(testing.NewListAction(ippoolsResource, ippoolsKind, c.ns, opts), &v1alpha1.IPPoolList{})
Invokes(testing.NewListActionWithOptions(ippoolsResource, ippoolsKind, c.ns, opts), emptyResult)
if obj == nil {
return nil, err
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
@ -74,28 +76,30 @@ func (c *FakeIPPools) List(ctx context.Context, opts v1.ListOptions) (result *v1
// Watch returns a watch.Interface that watches the requested iPPools.
func (c *FakeIPPools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(ippoolsResource, c.ns, opts))
InvokesWatch(testing.NewWatchActionWithOptions(ippoolsResource, c.ns, opts))
}
// Create takes the representation of a iPPool and creates it. Returns the server's representation of the iPPool, and an error, if there is any.
func (c *FakeIPPools) Create(ctx context.Context, iPPool *v1alpha1.IPPool, opts v1.CreateOptions) (result *v1alpha1.IPPool, err error) {
emptyResult := &v1alpha1.IPPool{}
obj, err := c.Fake.
Invokes(testing.NewCreateAction(ippoolsResource, c.ns, iPPool), &v1alpha1.IPPool{})
Invokes(testing.NewCreateActionWithOptions(ippoolsResource, c.ns, iPPool, opts), emptyResult)
if obj == nil {
return nil, err
return emptyResult, err
}
return obj.(*v1alpha1.IPPool), err
}
// Update takes the representation of a iPPool and updates it. Returns the server's representation of the iPPool, and an error, if there is any.
func (c *FakeIPPools) Update(ctx context.Context, iPPool *v1alpha1.IPPool, opts v1.UpdateOptions) (result *v1alpha1.IPPool, err error) {
emptyResult := &v1alpha1.IPPool{}
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(ippoolsResource, c.ns, iPPool), &v1alpha1.IPPool{})
Invokes(testing.NewUpdateActionWithOptions(ippoolsResource, c.ns, iPPool, opts), emptyResult)
if obj == nil {
return nil, err
return emptyResult, err
}
return obj.(*v1alpha1.IPPool), err
}
@ -110,7 +114,7 @@ func (c *FakeIPPools) Delete(ctx context.Context, name string, opts v1.DeleteOpt
// DeleteCollection deletes a collection of objects.
func (c *FakeIPPools) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(ippoolsResource, c.ns, listOpts)
action := testing.NewDeleteCollectionActionWithOptions(ippoolsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.IPPoolList{})
return err
@ -118,11 +122,12 @@ func (c *FakeIPPools) DeleteCollection(ctx context.Context, opts v1.DeleteOption
// Patch applies the patch and returns the patched iPPool.
func (c *FakeIPPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPPool, err error) {
emptyResult := &v1alpha1.IPPool{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(ippoolsResource, c.ns, name, pt, data, subresources...), &v1alpha1.IPPool{})
Invokes(testing.NewPatchSubresourceActionWithOptions(ippoolsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return nil, err
return emptyResult, err
}
return obj.(*v1alpha1.IPPool), err
}

View File

@ -40,22 +40,24 @@ var nodeslicepoolsKind = v1alpha1.SchemeGroupVersion.WithKind("NodeSlicePool")
// Get takes name of the nodeSlicePool, and returns the corresponding nodeSlicePool object, and an error if there is any.
func (c *FakeNodeSlicePools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeSlicePool, err error) {
emptyResult := &v1alpha1.NodeSlicePool{}
obj, err := c.Fake.
Invokes(testing.NewGetAction(nodeslicepoolsResource, c.ns, name), &v1alpha1.NodeSlicePool{})
Invokes(testing.NewGetActionWithOptions(nodeslicepoolsResource, c.ns, name, options), emptyResult)
if obj == nil {
return nil, err
return emptyResult, err
}
return obj.(*v1alpha1.NodeSlicePool), err
}
// List takes label and field selectors, and returns the list of NodeSlicePools that match those selectors.
func (c *FakeNodeSlicePools) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeSlicePoolList, err error) {
emptyResult := &v1alpha1.NodeSlicePoolList{}
obj, err := c.Fake.
Invokes(testing.NewListAction(nodeslicepoolsResource, nodeslicepoolsKind, c.ns, opts), &v1alpha1.NodeSlicePoolList{})
Invokes(testing.NewListActionWithOptions(nodeslicepoolsResource, nodeslicepoolsKind, c.ns, opts), emptyResult)
if obj == nil {
return nil, err
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
@ -74,40 +76,43 @@ func (c *FakeNodeSlicePools) List(ctx context.Context, opts v1.ListOptions) (res
// Watch returns a watch.Interface that watches the requested nodeSlicePools.
func (c *FakeNodeSlicePools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(nodeslicepoolsResource, c.ns, opts))
InvokesWatch(testing.NewWatchActionWithOptions(nodeslicepoolsResource, c.ns, opts))
}
// Create takes the representation of a nodeSlicePool and creates it. Returns the server's representation of the nodeSlicePool, and an error, if there is any.
func (c *FakeNodeSlicePools) Create(ctx context.Context, nodeSlicePool *v1alpha1.NodeSlicePool, opts v1.CreateOptions) (result *v1alpha1.NodeSlicePool, err error) {
emptyResult := &v1alpha1.NodeSlicePool{}
obj, err := c.Fake.
Invokes(testing.NewCreateAction(nodeslicepoolsResource, c.ns, nodeSlicePool), &v1alpha1.NodeSlicePool{})
Invokes(testing.NewCreateActionWithOptions(nodeslicepoolsResource, c.ns, nodeSlicePool, opts), emptyResult)
if obj == nil {
return nil, err
return emptyResult, err
}
return obj.(*v1alpha1.NodeSlicePool), err
}
// Update takes the representation of a nodeSlicePool and updates it. Returns the server's representation of the nodeSlicePool, and an error, if there is any.
func (c *FakeNodeSlicePools) Update(ctx context.Context, nodeSlicePool *v1alpha1.NodeSlicePool, opts v1.UpdateOptions) (result *v1alpha1.NodeSlicePool, err error) {
emptyResult := &v1alpha1.NodeSlicePool{}
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(nodeslicepoolsResource, c.ns, nodeSlicePool), &v1alpha1.NodeSlicePool{})
Invokes(testing.NewUpdateActionWithOptions(nodeslicepoolsResource, c.ns, nodeSlicePool, opts), emptyResult)
if obj == nil {
return nil, err
return emptyResult, err
}
return obj.(*v1alpha1.NodeSlicePool), 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 *FakeNodeSlicePools) UpdateStatus(ctx context.Context, nodeSlicePool *v1alpha1.NodeSlicePool, opts v1.UpdateOptions) (*v1alpha1.NodeSlicePool, error) {
func (c *FakeNodeSlicePools) UpdateStatus(ctx context.Context, nodeSlicePool *v1alpha1.NodeSlicePool, opts v1.UpdateOptions) (result *v1alpha1.NodeSlicePool, err error) {
emptyResult := &v1alpha1.NodeSlicePool{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(nodeslicepoolsResource, "status", c.ns, nodeSlicePool), &v1alpha1.NodeSlicePool{})
Invokes(testing.NewUpdateSubresourceActionWithOptions(nodeslicepoolsResource, "status", c.ns, nodeSlicePool, opts), emptyResult)
if obj == nil {
return nil, err
return emptyResult, err
}
return obj.(*v1alpha1.NodeSlicePool), err
}
@ -122,7 +127,7 @@ func (c *FakeNodeSlicePools) Delete(ctx context.Context, name string, opts v1.De
// DeleteCollection deletes a collection of objects.
func (c *FakeNodeSlicePools) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(nodeslicepoolsResource, c.ns, listOpts)
action := testing.NewDeleteCollectionActionWithOptions(nodeslicepoolsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.NodeSlicePoolList{})
return err
@ -130,11 +135,12 @@ func (c *FakeNodeSlicePools) DeleteCollection(ctx context.Context, opts v1.Delet
// Patch applies the patch and returns the patched nodeSlicePool.
func (c *FakeNodeSlicePools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeSlicePool, err error) {
emptyResult := &v1alpha1.NodeSlicePool{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(nodeslicepoolsResource, c.ns, name, pt, data, subresources...), &v1alpha1.NodeSlicePool{})
Invokes(testing.NewPatchSubresourceActionWithOptions(nodeslicepoolsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return nil, err
return emptyResult, err
}
return obj.(*v1alpha1.NodeSlicePool), err
}

View File

@ -40,22 +40,24 @@ var overlappingrangeipreservationsKind = v1alpha1.SchemeGroupVersion.WithKind("O
// Get takes name of the overlappingRangeIPReservation, and returns the corresponding overlappingRangeIPReservation object, and an error if there is any.
func (c *FakeOverlappingRangeIPReservations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.OverlappingRangeIPReservation, err error) {
emptyResult := &v1alpha1.OverlappingRangeIPReservation{}
obj, err := c.Fake.
Invokes(testing.NewGetAction(overlappingrangeipreservationsResource, c.ns, name), &v1alpha1.OverlappingRangeIPReservation{})
Invokes(testing.NewGetActionWithOptions(overlappingrangeipreservationsResource, c.ns, name, options), emptyResult)
if obj == nil {
return nil, err
return emptyResult, err
}
return obj.(*v1alpha1.OverlappingRangeIPReservation), err
}
// List takes label and field selectors, and returns the list of OverlappingRangeIPReservations that match those selectors.
func (c *FakeOverlappingRangeIPReservations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.OverlappingRangeIPReservationList, err error) {
emptyResult := &v1alpha1.OverlappingRangeIPReservationList{}
obj, err := c.Fake.
Invokes(testing.NewListAction(overlappingrangeipreservationsResource, overlappingrangeipreservationsKind, c.ns, opts), &v1alpha1.OverlappingRangeIPReservationList{})
Invokes(testing.NewListActionWithOptions(overlappingrangeipreservationsResource, overlappingrangeipreservationsKind, c.ns, opts), emptyResult)
if obj == nil {
return nil, err
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
@ -74,28 +76,30 @@ func (c *FakeOverlappingRangeIPReservations) List(ctx context.Context, opts v1.L
// Watch returns a watch.Interface that watches the requested overlappingRangeIPReservations.
func (c *FakeOverlappingRangeIPReservations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(overlappingrangeipreservationsResource, c.ns, opts))
InvokesWatch(testing.NewWatchActionWithOptions(overlappingrangeipreservationsResource, c.ns, opts))
}
// Create takes the representation of a overlappingRangeIPReservation and creates it. Returns the server's representation of the overlappingRangeIPReservation, and an error, if there is any.
func (c *FakeOverlappingRangeIPReservations) Create(ctx context.Context, overlappingRangeIPReservation *v1alpha1.OverlappingRangeIPReservation, opts v1.CreateOptions) (result *v1alpha1.OverlappingRangeIPReservation, err error) {
emptyResult := &v1alpha1.OverlappingRangeIPReservation{}
obj, err := c.Fake.
Invokes(testing.NewCreateAction(overlappingrangeipreservationsResource, c.ns, overlappingRangeIPReservation), &v1alpha1.OverlappingRangeIPReservation{})
Invokes(testing.NewCreateActionWithOptions(overlappingrangeipreservationsResource, c.ns, overlappingRangeIPReservation, opts), emptyResult)
if obj == nil {
return nil, err
return emptyResult, err
}
return obj.(*v1alpha1.OverlappingRangeIPReservation), err
}
// Update takes the representation of a overlappingRangeIPReservation and updates it. Returns the server's representation of the overlappingRangeIPReservation, and an error, if there is any.
func (c *FakeOverlappingRangeIPReservations) Update(ctx context.Context, overlappingRangeIPReservation *v1alpha1.OverlappingRangeIPReservation, opts v1.UpdateOptions) (result *v1alpha1.OverlappingRangeIPReservation, err error) {
emptyResult := &v1alpha1.OverlappingRangeIPReservation{}
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(overlappingrangeipreservationsResource, c.ns, overlappingRangeIPReservation), &v1alpha1.OverlappingRangeIPReservation{})
Invokes(testing.NewUpdateActionWithOptions(overlappingrangeipreservationsResource, c.ns, overlappingRangeIPReservation, opts), emptyResult)
if obj == nil {
return nil, err
return emptyResult, err
}
return obj.(*v1alpha1.OverlappingRangeIPReservation), err
}
@ -110,7 +114,7 @@ func (c *FakeOverlappingRangeIPReservations) Delete(ctx context.Context, name st
// DeleteCollection deletes a collection of objects.
func (c *FakeOverlappingRangeIPReservations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(overlappingrangeipreservationsResource, c.ns, listOpts)
action := testing.NewDeleteCollectionActionWithOptions(overlappingrangeipreservationsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.OverlappingRangeIPReservationList{})
return err
@ -118,11 +122,12 @@ func (c *FakeOverlappingRangeIPReservations) DeleteCollection(ctx context.Contex
// Patch applies the patch and returns the patched overlappingRangeIPReservation.
func (c *FakeOverlappingRangeIPReservations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.OverlappingRangeIPReservation, err error) {
emptyResult := &v1alpha1.OverlappingRangeIPReservation{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(overlappingrangeipreservationsResource, c.ns, name, pt, data, subresources...), &v1alpha1.OverlappingRangeIPReservation{})
Invokes(testing.NewPatchSubresourceActionWithOptions(overlappingrangeipreservationsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return nil, err
return emptyResult, err
}
return obj.(*v1alpha1.OverlappingRangeIPReservation), err
}

View File

@ -18,7 +18,7 @@ limitations under the License.
package fake
import (
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned/typed/whereabouts.cni.cncf.io/v1alpha1"
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned/typed/whereabouts.cni.cncf.io/v1alpha1"
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
)

View File

@ -0,0 +1,66 @@
/*
Copyright 2024 The Kubernetes Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
scheme "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
gentype "k8s.io/client-go/gentype"
)
// IPPoolsGetter has a method to return a IPPoolInterface.
// A group's client should implement this interface.
type IPPoolsGetter interface {
IPPools(namespace string) IPPoolInterface
}
// IPPoolInterface has methods to work with IPPool resources.
type IPPoolInterface interface {
Create(ctx context.Context, iPPool *v1alpha1.IPPool, opts v1.CreateOptions) (*v1alpha1.IPPool, error)
Update(ctx context.Context, iPPool *v1alpha1.IPPool, opts v1.UpdateOptions) (*v1alpha1.IPPool, 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.IPPool, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.IPPoolList, 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.IPPool, err error)
IPPoolExpansion
}
// iPPools implements IPPoolInterface
type iPPools struct {
*gentype.ClientWithList[*v1alpha1.IPPool, *v1alpha1.IPPoolList]
}
// newIPPools returns a IPPools
func newIPPools(c *WhereaboutsV1alpha1Client, namespace string) *iPPools {
return &iPPools{
gentype.NewClientWithList[*v1alpha1.IPPool, *v1alpha1.IPPoolList](
"ippools",
c.RESTClient(),
scheme.ParameterCodec,
namespace,
func() *v1alpha1.IPPool { return &v1alpha1.IPPool{} },
func() *v1alpha1.IPPoolList { return &v1alpha1.IPPoolList{} }),
}
}

View File

@ -0,0 +1,68 @@
/*
Copyright 2024 The Kubernetes Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
scheme "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
gentype "k8s.io/client-go/gentype"
)
// NodeSlicePoolsGetter has a method to return a NodeSlicePoolInterface.
// A group's client should implement this interface.
type NodeSlicePoolsGetter interface {
NodeSlicePools(namespace string) NodeSlicePoolInterface
}
// NodeSlicePoolInterface has methods to work with NodeSlicePool resources.
type NodeSlicePoolInterface interface {
Create(ctx context.Context, nodeSlicePool *v1alpha1.NodeSlicePool, opts v1.CreateOptions) (*v1alpha1.NodeSlicePool, error)
Update(ctx context.Context, nodeSlicePool *v1alpha1.NodeSlicePool, opts v1.UpdateOptions) (*v1alpha1.NodeSlicePool, error)
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
UpdateStatus(ctx context.Context, nodeSlicePool *v1alpha1.NodeSlicePool, opts v1.UpdateOptions) (*v1alpha1.NodeSlicePool, 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.NodeSlicePool, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NodeSlicePoolList, 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.NodeSlicePool, err error)
NodeSlicePoolExpansion
}
// nodeSlicePools implements NodeSlicePoolInterface
type nodeSlicePools struct {
*gentype.ClientWithList[*v1alpha1.NodeSlicePool, *v1alpha1.NodeSlicePoolList]
}
// newNodeSlicePools returns a NodeSlicePools
func newNodeSlicePools(c *WhereaboutsV1alpha1Client, namespace string) *nodeSlicePools {
return &nodeSlicePools{
gentype.NewClientWithList[*v1alpha1.NodeSlicePool, *v1alpha1.NodeSlicePoolList](
"nodeslicepools",
c.RESTClient(),
scheme.ParameterCodec,
namespace,
func() *v1alpha1.NodeSlicePool { return &v1alpha1.NodeSlicePool{} },
func() *v1alpha1.NodeSlicePoolList { return &v1alpha1.NodeSlicePoolList{} }),
}
}

View File

@ -0,0 +1,68 @@
/*
Copyright 2024 The Kubernetes Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
scheme "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
gentype "k8s.io/client-go/gentype"
)
// OverlappingRangeIPReservationsGetter has a method to return a OverlappingRangeIPReservationInterface.
// A group's client should implement this interface.
type OverlappingRangeIPReservationsGetter interface {
OverlappingRangeIPReservations(namespace string) OverlappingRangeIPReservationInterface
}
// OverlappingRangeIPReservationInterface has methods to work with OverlappingRangeIPReservation resources.
type OverlappingRangeIPReservationInterface interface {
Create(ctx context.Context, overlappingRangeIPReservation *v1alpha1.OverlappingRangeIPReservation, opts v1.CreateOptions) (*v1alpha1.OverlappingRangeIPReservation, error)
Update(ctx context.Context, overlappingRangeIPReservation *v1alpha1.OverlappingRangeIPReservation, opts v1.UpdateOptions) (*v1alpha1.OverlappingRangeIPReservation, 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.OverlappingRangeIPReservation, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.OverlappingRangeIPReservationList, 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.OverlappingRangeIPReservation, err error)
OverlappingRangeIPReservationExpansion
}
// overlappingRangeIPReservations implements OverlappingRangeIPReservationInterface
type overlappingRangeIPReservations struct {
*gentype.ClientWithList[*v1alpha1.OverlappingRangeIPReservation, *v1alpha1.OverlappingRangeIPReservationList]
}
// newOverlappingRangeIPReservations returns a OverlappingRangeIPReservations
func newOverlappingRangeIPReservations(c *WhereaboutsV1alpha1Client, namespace string) *overlappingRangeIPReservations {
return &overlappingRangeIPReservations{
gentype.NewClientWithList[*v1alpha1.OverlappingRangeIPReservation, *v1alpha1.OverlappingRangeIPReservationList](
"overlappingrangeipreservations",
c.RESTClient(),
scheme.ParameterCodec,
namespace,
func() *v1alpha1.OverlappingRangeIPReservation { return &v1alpha1.OverlappingRangeIPReservation{} },
func() *v1alpha1.OverlappingRangeIPReservationList {
return &v1alpha1.OverlappingRangeIPReservationList{}
}),
}
}

View File

@ -21,7 +21,7 @@ import (
"net/http"
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned/scheme"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned/scheme"
rest "k8s.io/client-go/rest"
)

View File

@ -22,9 +22,9 @@ import (
sync "sync"
time "time"
versioned "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
internalinterfaces "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/informers/externalversions/internalinterfaces"
whereaboutscnicncfio "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/informers/externalversions/whereabouts.cni.cncf.io"
versioned "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
internalinterfaces "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/informers/externalversions/internalinterfaces"
whereaboutscnicncfio "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/informers/externalversions/whereabouts.cni.cncf.io"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
@ -227,6 +227,7 @@ type SharedInformerFactory interface {
// Start initializes all requested informers. They are handled in goroutines
// which run until the stop channel gets closed.
// Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync.
Start(stopCh <-chan struct{})
// Shutdown marks a factory as shutting down. At that point no new

View File

@ -20,7 +20,7 @@ package internalinterfaces
import (
time "time"
versioned "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
versioned "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
cache "k8s.io/client-go/tools/cache"

View File

@ -18,8 +18,8 @@ limitations under the License.
package whereabouts
import (
internalinterfaces "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/informers/externalversions/whereabouts.cni.cncf.io/v1alpha1"
internalinterfaces "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/informers/externalversions/whereabouts.cni.cncf.io/v1alpha1"
)
// Interface provides access to each of this group's versions.

View File

@ -18,7 +18,7 @@ limitations under the License.
package v1alpha1
import (
internalinterfaces "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/informers/externalversions/internalinterfaces"
internalinterfaces "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/informers/externalversions/internalinterfaces"
)
// Interface provides access to all the informers in this group version.

View File

@ -22,9 +22,9 @@ import (
time "time"
whereaboutscnicncfiov1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
versioned "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
internalinterfaces "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/listers/whereabouts.cni.cncf.io/v1alpha1"
versioned "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
internalinterfaces "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/listers/whereabouts.cni.cncf.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"

View File

@ -22,9 +22,9 @@ import (
time "time"
whereaboutscnicncfiov1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
versioned "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
internalinterfaces "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/listers/whereabouts.cni.cncf.io/v1alpha1"
versioned "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
internalinterfaces "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/listers/whereabouts.cni.cncf.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"

View File

@ -22,9 +22,9 @@ import (
time "time"
whereaboutscnicncfiov1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
versioned "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
internalinterfaces "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/listers/whereabouts.cni.cncf.io/v1alpha1"
versioned "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
internalinterfaces "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/listers/whereabouts.cni.cncf.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"

View File

@ -19,8 +19,8 @@ package v1alpha1
import (
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/listers"
"k8s.io/client-go/tools/cache"
)
@ -37,25 +37,17 @@ type IPPoolLister interface {
// iPPoolLister implements the IPPoolLister interface.
type iPPoolLister struct {
indexer cache.Indexer
listers.ResourceIndexer[*v1alpha1.IPPool]
}
// NewIPPoolLister returns a new IPPoolLister.
func NewIPPoolLister(indexer cache.Indexer) IPPoolLister {
return &iPPoolLister{indexer: indexer}
}
// List lists all IPPools in the indexer.
func (s *iPPoolLister) List(selector labels.Selector) (ret []*v1alpha1.IPPool, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.IPPool))
})
return ret, err
return &iPPoolLister{listers.New[*v1alpha1.IPPool](indexer, v1alpha1.Resource("ippool"))}
}
// IPPools returns an object that can list and get IPPools.
func (s *iPPoolLister) IPPools(namespace string) IPPoolNamespaceLister {
return iPPoolNamespaceLister{indexer: s.indexer, namespace: namespace}
return iPPoolNamespaceLister{listers.NewNamespaced[*v1alpha1.IPPool](s.ResourceIndexer, namespace)}
}
// IPPoolNamespaceLister helps list and get IPPools.
@ -73,26 +65,5 @@ type IPPoolNamespaceLister interface {
// iPPoolNamespaceLister implements the IPPoolNamespaceLister
// interface.
type iPPoolNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all IPPools in the indexer for a given namespace.
func (s iPPoolNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.IPPool, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.IPPool))
})
return ret, err
}
// Get retrieves the IPPool from the indexer for a given namespace and name.
func (s iPPoolNamespaceLister) Get(name string) (*v1alpha1.IPPool, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("ippool"), name)
}
return obj.(*v1alpha1.IPPool), nil
listers.ResourceIndexer[*v1alpha1.IPPool]
}

View File

@ -19,8 +19,8 @@ package v1alpha1
import (
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/listers"
"k8s.io/client-go/tools/cache"
)
@ -37,25 +37,17 @@ type NodeSlicePoolLister interface {
// nodeSlicePoolLister implements the NodeSlicePoolLister interface.
type nodeSlicePoolLister struct {
indexer cache.Indexer
listers.ResourceIndexer[*v1alpha1.NodeSlicePool]
}
// NewNodeSlicePoolLister returns a new NodeSlicePoolLister.
func NewNodeSlicePoolLister(indexer cache.Indexer) NodeSlicePoolLister {
return &nodeSlicePoolLister{indexer: indexer}
}
// List lists all NodeSlicePools in the indexer.
func (s *nodeSlicePoolLister) List(selector labels.Selector) (ret []*v1alpha1.NodeSlicePool, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.NodeSlicePool))
})
return ret, err
return &nodeSlicePoolLister{listers.New[*v1alpha1.NodeSlicePool](indexer, v1alpha1.Resource("nodeslicepool"))}
}
// NodeSlicePools returns an object that can list and get NodeSlicePools.
func (s *nodeSlicePoolLister) NodeSlicePools(namespace string) NodeSlicePoolNamespaceLister {
return nodeSlicePoolNamespaceLister{indexer: s.indexer, namespace: namespace}
return nodeSlicePoolNamespaceLister{listers.NewNamespaced[*v1alpha1.NodeSlicePool](s.ResourceIndexer, namespace)}
}
// NodeSlicePoolNamespaceLister helps list and get NodeSlicePools.
@ -73,26 +65,5 @@ type NodeSlicePoolNamespaceLister interface {
// nodeSlicePoolNamespaceLister implements the NodeSlicePoolNamespaceLister
// interface.
type nodeSlicePoolNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all NodeSlicePools in the indexer for a given namespace.
func (s nodeSlicePoolNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.NodeSlicePool, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.NodeSlicePool))
})
return ret, err
}
// Get retrieves the NodeSlicePool from the indexer for a given namespace and name.
func (s nodeSlicePoolNamespaceLister) Get(name string) (*v1alpha1.NodeSlicePool, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("nodeslicepool"), name)
}
return obj.(*v1alpha1.NodeSlicePool), nil
listers.ResourceIndexer[*v1alpha1.NodeSlicePool]
}

View File

@ -19,8 +19,8 @@ package v1alpha1
import (
v1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/listers"
"k8s.io/client-go/tools/cache"
)
@ -37,25 +37,17 @@ type OverlappingRangeIPReservationLister interface {
// overlappingRangeIPReservationLister implements the OverlappingRangeIPReservationLister interface.
type overlappingRangeIPReservationLister struct {
indexer cache.Indexer
listers.ResourceIndexer[*v1alpha1.OverlappingRangeIPReservation]
}
// NewOverlappingRangeIPReservationLister returns a new OverlappingRangeIPReservationLister.
func NewOverlappingRangeIPReservationLister(indexer cache.Indexer) OverlappingRangeIPReservationLister {
return &overlappingRangeIPReservationLister{indexer: indexer}
}
// List lists all OverlappingRangeIPReservations in the indexer.
func (s *overlappingRangeIPReservationLister) List(selector labels.Selector) (ret []*v1alpha1.OverlappingRangeIPReservation, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.OverlappingRangeIPReservation))
})
return ret, err
return &overlappingRangeIPReservationLister{listers.New[*v1alpha1.OverlappingRangeIPReservation](indexer, v1alpha1.Resource("overlappingrangeipreservation"))}
}
// OverlappingRangeIPReservations returns an object that can list and get OverlappingRangeIPReservations.
func (s *overlappingRangeIPReservationLister) OverlappingRangeIPReservations(namespace string) OverlappingRangeIPReservationNamespaceLister {
return overlappingRangeIPReservationNamespaceLister{indexer: s.indexer, namespace: namespace}
return overlappingRangeIPReservationNamespaceLister{listers.NewNamespaced[*v1alpha1.OverlappingRangeIPReservation](s.ResourceIndexer, namespace)}
}
// OverlappingRangeIPReservationNamespaceLister helps list and get OverlappingRangeIPReservations.
@ -73,26 +65,5 @@ type OverlappingRangeIPReservationNamespaceLister interface {
// overlappingRangeIPReservationNamespaceLister implements the OverlappingRangeIPReservationNamespaceLister
// interface.
type overlappingRangeIPReservationNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all OverlappingRangeIPReservations in the indexer for a given namespace.
func (s overlappingRangeIPReservationNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.OverlappingRangeIPReservation, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.OverlappingRangeIPReservation))
})
return ret, err
}
// Get retrieves the OverlappingRangeIPReservation from the indexer for a given namespace and name.
func (s overlappingRangeIPReservationNamespaceLister) Get(name string) (*v1alpha1.OverlappingRangeIPReservation, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("overlappingrangeipreservation"), name)
}
return obj.(*v1alpha1.OverlappingRangeIPReservation), nil
listers.ResourceIndexer[*v1alpha1.OverlappingRangeIPReservation]
}

View File

@ -29,10 +29,10 @@ import (
nadlisters "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/listers/k8s.cni.cncf.io/v1"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
clientset "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
whereaboutsInformers "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/informers/externalversions/whereabouts.cni.cncf.io/v1alpha1"
whereaboutsListers "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/listers/whereabouts.cni.cncf.io/v1alpha1"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/config"
clientset "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
whereaboutsInformers "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/informers/externalversions/whereabouts.cni.cncf.io/v1alpha1"
whereaboutsListers "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/listers/whereabouts.cni.cncf.io/v1alpha1"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/iphelpers"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/types"
)

View File

@ -19,16 +19,17 @@ package node_controller
import (
"context"
"fmt"
"os"
"reflect"
"testing"
"time"
k8snetplumbersv1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/tools/cache"
"os"
"reflect"
"testing"
"time"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/diff"
@ -39,8 +40,8 @@ import (
k8snetplumbersv1fake "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/fake"
nadinformers "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/informers/externalversions"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned/fake"
informers "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/informers/externalversions"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned/fake"
informers "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/informers/externalversions"
)
var (

View File

@ -21,8 +21,8 @@ import (
k8sclient "k8s.io/client-go/kubernetes"
fakek8sclient "k8s.io/client-go/kubernetes/fake"
wbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
fakewbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned/fake"
wbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
fakewbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned/fake"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/storage/kubernetes"
)

View File

@ -11,7 +11,7 @@ import (
"k8s.io/client-go/tools/clientcmd"
whereaboutsv1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
wbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
wbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/logging"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/storage"
)

View File

@ -22,7 +22,7 @@ import (
"github.com/k8snetworkplumbingwg/whereabouts/pkg/allocate"
whereaboutsv1alpha1 "github.com/k8snetworkplumbingwg/whereabouts/pkg/api/whereabouts.cni.cncf.io/v1alpha1"
wbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/client/clientset/versioned"
wbclient "github.com/k8snetworkplumbingwg/whereabouts/pkg/generated/clientset/versioned"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/iphelpers"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/logging"
"github.com/k8snetworkplumbingwg/whereabouts/pkg/storage"