implement ippool

1. support vlan ippool management
2. support calico ippool management

Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
This commit is contained in:
Duan Jiong
2020-04-20 19:01:34 +08:00
parent a7d31930f8
commit 43d1d6f243
91 changed files with 7837 additions and 29 deletions

View File

@@ -0,0 +1,120 @@
/*
Copyright 2020 The KubeSphere 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 (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
)
// FakeIPAMBlocks implements IPAMBlockInterface
type FakeIPAMBlocks struct {
Fake *FakeNetworkV1alpha1
}
var ipamblocksResource = schema.GroupVersionResource{Group: "network.kubesphere.io", Version: "v1alpha1", Resource: "ipamblocks"}
var ipamblocksKind = schema.GroupVersionKind{Group: "network.kubesphere.io", Version: "v1alpha1", Kind: "IPAMBlock"}
// Get takes name of the iPAMBlock, and returns the corresponding iPAMBlock object, and an error if there is any.
func (c *FakeIPAMBlocks) Get(name string, options v1.GetOptions) (result *v1alpha1.IPAMBlock, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootGetAction(ipamblocksResource, name), &v1alpha1.IPAMBlock{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.IPAMBlock), err
}
// List takes label and field selectors, and returns the list of IPAMBlocks that match those selectors.
func (c *FakeIPAMBlocks) List(opts v1.ListOptions) (result *v1alpha1.IPAMBlockList, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootListAction(ipamblocksResource, ipamblocksKind, opts), &v1alpha1.IPAMBlockList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.IPAMBlockList{ListMeta: obj.(*v1alpha1.IPAMBlockList).ListMeta}
for _, item := range obj.(*v1alpha1.IPAMBlockList).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 iPAMBlocks.
func (c *FakeIPAMBlocks) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchAction(ipamblocksResource, opts))
}
// Create takes the representation of a iPAMBlock and creates it. Returns the server's representation of the iPAMBlock, and an error, if there is any.
func (c *FakeIPAMBlocks) Create(iPAMBlock *v1alpha1.IPAMBlock) (result *v1alpha1.IPAMBlock, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(ipamblocksResource, iPAMBlock), &v1alpha1.IPAMBlock{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.IPAMBlock), err
}
// Update takes the representation of a iPAMBlock and updates it. Returns the server's representation of the iPAMBlock, and an error, if there is any.
func (c *FakeIPAMBlocks) Update(iPAMBlock *v1alpha1.IPAMBlock) (result *v1alpha1.IPAMBlock, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(ipamblocksResource, iPAMBlock), &v1alpha1.IPAMBlock{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.IPAMBlock), err
}
// Delete takes name of the iPAMBlock and deletes it. Returns an error if one occurs.
func (c *FakeIPAMBlocks) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteAction(ipamblocksResource, name), &v1alpha1.IPAMBlock{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeIPAMBlocks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(ipamblocksResource, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha1.IPAMBlockList{})
return err
}
// Patch applies the patch and returns the patched iPAMBlock.
func (c *FakeIPAMBlocks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.IPAMBlock, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(ipamblocksResource, name, pt, data, subresources...), &v1alpha1.IPAMBlock{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.IPAMBlock), err
}

View File

@@ -0,0 +1,120 @@
/*
Copyright 2020 The KubeSphere 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 (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
)
// FakeIPAMHandles implements IPAMHandleInterface
type FakeIPAMHandles struct {
Fake *FakeNetworkV1alpha1
}
var ipamhandlesResource = schema.GroupVersionResource{Group: "network.kubesphere.io", Version: "v1alpha1", Resource: "ipamhandles"}
var ipamhandlesKind = schema.GroupVersionKind{Group: "network.kubesphere.io", Version: "v1alpha1", Kind: "IPAMHandle"}
// Get takes name of the iPAMHandle, and returns the corresponding iPAMHandle object, and an error if there is any.
func (c *FakeIPAMHandles) Get(name string, options v1.GetOptions) (result *v1alpha1.IPAMHandle, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootGetAction(ipamhandlesResource, name), &v1alpha1.IPAMHandle{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.IPAMHandle), err
}
// List takes label and field selectors, and returns the list of IPAMHandles that match those selectors.
func (c *FakeIPAMHandles) List(opts v1.ListOptions) (result *v1alpha1.IPAMHandleList, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootListAction(ipamhandlesResource, ipamhandlesKind, opts), &v1alpha1.IPAMHandleList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.IPAMHandleList{ListMeta: obj.(*v1alpha1.IPAMHandleList).ListMeta}
for _, item := range obj.(*v1alpha1.IPAMHandleList).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 iPAMHandles.
func (c *FakeIPAMHandles) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchAction(ipamhandlesResource, opts))
}
// Create takes the representation of a iPAMHandle and creates it. Returns the server's representation of the iPAMHandle, and an error, if there is any.
func (c *FakeIPAMHandles) Create(iPAMHandle *v1alpha1.IPAMHandle) (result *v1alpha1.IPAMHandle, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(ipamhandlesResource, iPAMHandle), &v1alpha1.IPAMHandle{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.IPAMHandle), err
}
// Update takes the representation of a iPAMHandle and updates it. Returns the server's representation of the iPAMHandle, and an error, if there is any.
func (c *FakeIPAMHandles) Update(iPAMHandle *v1alpha1.IPAMHandle) (result *v1alpha1.IPAMHandle, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(ipamhandlesResource, iPAMHandle), &v1alpha1.IPAMHandle{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.IPAMHandle), err
}
// Delete takes name of the iPAMHandle and deletes it. Returns an error if one occurs.
func (c *FakeIPAMHandles) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteAction(ipamhandlesResource, name), &v1alpha1.IPAMHandle{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeIPAMHandles) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(ipamhandlesResource, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha1.IPAMHandleList{})
return err
}
// Patch applies the patch and returns the patched iPAMHandle.
func (c *FakeIPAMHandles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.IPAMHandle, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(ipamhandlesResource, name, pt, data, subresources...), &v1alpha1.IPAMHandle{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.IPAMHandle), err
}

View File

@@ -0,0 +1,131 @@
/*
Copyright 2020 The KubeSphere 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 (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
)
// FakeIPPools implements IPPoolInterface
type FakeIPPools struct {
Fake *FakeNetworkV1alpha1
}
var ippoolsResource = schema.GroupVersionResource{Group: "network.kubesphere.io", Version: "v1alpha1", Resource: "ippools"}
var ippoolsKind = schema.GroupVersionKind{Group: "network.kubesphere.io", Version: "v1alpha1", Kind: "IPPool"}
// Get takes name of the iPPool, and returns the corresponding iPPool object, and an error if there is any.
func (c *FakeIPPools) Get(name string, options v1.GetOptions) (result *v1alpha1.IPPool, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootGetAction(ippoolsResource, name), &v1alpha1.IPPool{})
if obj == nil {
return nil, 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(opts v1.ListOptions) (result *v1alpha1.IPPoolList, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootListAction(ippoolsResource, ippoolsKind, opts), &v1alpha1.IPPoolList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.IPPoolList{ListMeta: obj.(*v1alpha1.IPPoolList).ListMeta}
for _, item := range obj.(*v1alpha1.IPPoolList).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 iPPools.
func (c *FakeIPPools) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchAction(ippoolsResource, 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(iPPool *v1alpha1.IPPool) (result *v1alpha1.IPPool, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(ippoolsResource, iPPool), &v1alpha1.IPPool{})
if obj == nil {
return nil, 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(iPPool *v1alpha1.IPPool) (result *v1alpha1.IPPool, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(ippoolsResource, iPPool), &v1alpha1.IPPool{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.IPPool), 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 *FakeIPPools) UpdateStatus(iPPool *v1alpha1.IPPool) (*v1alpha1.IPPool, error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceAction(ippoolsResource, "status", iPPool), &v1alpha1.IPPool{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.IPPool), err
}
// Delete takes name of the iPPool and deletes it. Returns an error if one occurs.
func (c *FakeIPPools) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteAction(ippoolsResource, name), &v1alpha1.IPPool{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeIPPools) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(ippoolsResource, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha1.IPPoolList{})
return err
}
// Patch applies the patch and returns the patched iPPool.
func (c *FakeIPPools) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.IPPool, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(ippoolsResource, name, pt, data, subresources...), &v1alpha1.IPPool{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.IPPool), err
}

View File

@@ -28,6 +28,18 @@ type FakeNetworkV1alpha1 struct {
*testing.Fake
}
func (c *FakeNetworkV1alpha1) IPAMBlocks() v1alpha1.IPAMBlockInterface {
return &FakeIPAMBlocks{c}
}
func (c *FakeNetworkV1alpha1) IPAMHandles() v1alpha1.IPAMHandleInterface {
return &FakeIPAMHandles{c}
}
func (c *FakeNetworkV1alpha1) IPPools() v1alpha1.IPPoolInterface {
return &FakeIPPools{c}
}
func (c *FakeNetworkV1alpha1) NamespaceNetworkPolicies(namespace string) v1alpha1.NamespaceNetworkPolicyInterface {
return &FakeNamespaceNetworkPolicies{c, namespace}
}

View File

@@ -18,4 +18,10 @@ limitations under the License.
package v1alpha1
type IPAMBlockExpansion interface{}
type IPAMHandleExpansion interface{}
type IPPoolExpansion interface{}
type NamespaceNetworkPolicyExpansion interface{}

View File

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

View File

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

View File

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

View File

@@ -26,6 +26,9 @@ import (
type NetworkV1alpha1Interface interface {
RESTClient() rest.Interface
IPAMBlocksGetter
IPAMHandlesGetter
IPPoolsGetter
NamespaceNetworkPoliciesGetter
}
@@ -34,6 +37,18 @@ type NetworkV1alpha1Client struct {
restClient rest.Interface
}
func (c *NetworkV1alpha1Client) IPAMBlocks() IPAMBlockInterface {
return newIPAMBlocks(c)
}
func (c *NetworkV1alpha1Client) IPAMHandles() IPAMHandleInterface {
return newIPAMHandles(c)
}
func (c *NetworkV1alpha1Client) IPPools() IPPoolInterface {
return newIPPools(c)
}
func (c *NetworkV1alpha1Client) NamespaceNetworkPolicies(namespace string) NamespaceNetworkPolicyInterface {
return newNamespaceNetworkPolicies(c, namespace)
}

View File

@@ -109,6 +109,12 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Iam().V1alpha2().WorkspaceRoleBindings().Informer()}, nil
// Group=network.kubesphere.io, Version=v1alpha1
case networkv1alpha1.SchemeGroupVersion.WithResource("ipamblocks"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Network().V1alpha1().IPAMBlocks().Informer()}, nil
case networkv1alpha1.SchemeGroupVersion.WithResource("ipamhandles"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Network().V1alpha1().IPAMHandles().Informer()}, nil
case networkv1alpha1.SchemeGroupVersion.WithResource("ippools"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Network().V1alpha1().IPPools().Informer()}, nil
case networkv1alpha1.SchemeGroupVersion.WithResource("namespacenetworkpolicies"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Network().V1alpha1().NamespaceNetworkPolicies().Informer()}, nil

View File

@@ -24,6 +24,12 @@ import (
// Interface provides access to all the informers in this group version.
type Interface interface {
// IPAMBlocks returns a IPAMBlockInformer.
IPAMBlocks() IPAMBlockInformer
// IPAMHandles returns a IPAMHandleInformer.
IPAMHandles() IPAMHandleInformer
// IPPools returns a IPPoolInformer.
IPPools() IPPoolInformer
// NamespaceNetworkPolicies returns a NamespaceNetworkPolicyInformer.
NamespaceNetworkPolicies() NamespaceNetworkPolicyInformer
}
@@ -39,6 +45,21 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// IPAMBlocks returns a IPAMBlockInformer.
func (v *version) IPAMBlocks() IPAMBlockInformer {
return &iPAMBlockInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// IPAMHandles returns a IPAMHandleInformer.
func (v *version) IPAMHandles() IPAMHandleInformer {
return &iPAMHandleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// IPPools returns a IPPoolInformer.
func (v *version) IPPools() IPPoolInformer {
return &iPPoolInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// NamespaceNetworkPolicies returns a NamespaceNetworkPolicyInformer.
func (v *version) NamespaceNetworkPolicies() NamespaceNetworkPolicyInformer {
return &namespaceNetworkPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}

View File

@@ -0,0 +1,88 @@
/*
Copyright 2020 The KubeSphere Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
import (
time "time"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "kubesphere.io/kubesphere/pkg/client/listers/network/v1alpha1"
)
// IPAMBlockInformer provides access to a shared informer and lister for
// IPAMBlocks.
type IPAMBlockInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.IPAMBlockLister
}
type iPAMBlockInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewIPAMBlockInformer constructs a new informer for IPAMBlock 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 NewIPAMBlockInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredIPAMBlockInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredIPAMBlockInformer constructs a new informer for IPAMBlock 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 NewFilteredIPAMBlockInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NetworkV1alpha1().IPAMBlocks().List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NetworkV1alpha1().IPAMBlocks().Watch(options)
},
},
&networkv1alpha1.IPAMBlock{},
resyncPeriod,
indexers,
)
}
func (f *iPAMBlockInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredIPAMBlockInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *iPAMBlockInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&networkv1alpha1.IPAMBlock{}, f.defaultInformer)
}
func (f *iPAMBlockInformer) Lister() v1alpha1.IPAMBlockLister {
return v1alpha1.NewIPAMBlockLister(f.Informer().GetIndexer())
}

View File

@@ -0,0 +1,88 @@
/*
Copyright 2020 The KubeSphere Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
import (
time "time"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "kubesphere.io/kubesphere/pkg/client/listers/network/v1alpha1"
)
// IPAMHandleInformer provides access to a shared informer and lister for
// IPAMHandles.
type IPAMHandleInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.IPAMHandleLister
}
type iPAMHandleInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewIPAMHandleInformer constructs a new informer for IPAMHandle 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 NewIPAMHandleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredIPAMHandleInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredIPAMHandleInformer constructs a new informer for IPAMHandle 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 NewFilteredIPAMHandleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NetworkV1alpha1().IPAMHandles().List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NetworkV1alpha1().IPAMHandles().Watch(options)
},
},
&networkv1alpha1.IPAMHandle{},
resyncPeriod,
indexers,
)
}
func (f *iPAMHandleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredIPAMHandleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *iPAMHandleInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&networkv1alpha1.IPAMHandle{}, f.defaultInformer)
}
func (f *iPAMHandleInformer) Lister() v1alpha1.IPAMHandleLister {
return v1alpha1.NewIPAMHandleLister(f.Informer().GetIndexer())
}

View File

@@ -0,0 +1,88 @@
/*
Copyright 2020 The KubeSphere Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
import (
time "time"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "kubesphere.io/kubesphere/pkg/client/listers/network/v1alpha1"
)
// IPPoolInformer provides access to a shared informer and lister for
// IPPools.
type IPPoolInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.IPPoolLister
}
type iPPoolInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewIPPoolInformer constructs a new informer for IPPool 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 NewIPPoolInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredIPPoolInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredIPPoolInformer constructs a new informer for IPPool 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 NewFilteredIPPoolInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NetworkV1alpha1().IPPools().List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NetworkV1alpha1().IPPools().Watch(options)
},
},
&networkv1alpha1.IPPool{},
resyncPeriod,
indexers,
)
}
func (f *iPPoolInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredIPPoolInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *iPPoolInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&networkv1alpha1.IPPool{}, f.defaultInformer)
}
func (f *iPPoolInformer) Lister() v1alpha1.IPPoolLister {
return v1alpha1.NewIPPoolLister(f.Informer().GetIndexer())
}

View File

@@ -18,6 +18,18 @@ limitations under the License.
package v1alpha1
// IPAMBlockListerExpansion allows custom methods to be added to
// IPAMBlockLister.
type IPAMBlockListerExpansion interface{}
// IPAMHandleListerExpansion allows custom methods to be added to
// IPAMHandleLister.
type IPAMHandleListerExpansion interface{}
// IPPoolListerExpansion allows custom methods to be added to
// IPPoolLister.
type IPPoolListerExpansion interface{}
// NamespaceNetworkPolicyListerExpansion allows custom methods to be added to
// NamespaceNetworkPolicyLister.
type NamespaceNetworkPolicyListerExpansion interface{}

View File

@@ -0,0 +1,65 @@
/*
Copyright 2020 The KubeSphere 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 (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
v1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
)
// IPAMBlockLister helps list IPAMBlocks.
type IPAMBlockLister interface {
// List lists all IPAMBlocks in the indexer.
List(selector labels.Selector) (ret []*v1alpha1.IPAMBlock, err error)
// Get retrieves the IPAMBlock from the index for a given name.
Get(name string) (*v1alpha1.IPAMBlock, error)
IPAMBlockListerExpansion
}
// iPAMBlockLister implements the IPAMBlockLister interface.
type iPAMBlockLister struct {
indexer cache.Indexer
}
// NewIPAMBlockLister returns a new IPAMBlockLister.
func NewIPAMBlockLister(indexer cache.Indexer) IPAMBlockLister {
return &iPAMBlockLister{indexer: indexer}
}
// List lists all IPAMBlocks in the indexer.
func (s *iPAMBlockLister) List(selector labels.Selector) (ret []*v1alpha1.IPAMBlock, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.IPAMBlock))
})
return ret, err
}
// Get retrieves the IPAMBlock from the index for a given name.
func (s *iPAMBlockLister) Get(name string) (*v1alpha1.IPAMBlock, error) {
obj, exists, err := s.indexer.GetByKey(name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("ipamblock"), name)
}
return obj.(*v1alpha1.IPAMBlock), nil
}

View File

@@ -0,0 +1,65 @@
/*
Copyright 2020 The KubeSphere 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 (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
v1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
)
// IPAMHandleLister helps list IPAMHandles.
type IPAMHandleLister interface {
// List lists all IPAMHandles in the indexer.
List(selector labels.Selector) (ret []*v1alpha1.IPAMHandle, err error)
// Get retrieves the IPAMHandle from the index for a given name.
Get(name string) (*v1alpha1.IPAMHandle, error)
IPAMHandleListerExpansion
}
// iPAMHandleLister implements the IPAMHandleLister interface.
type iPAMHandleLister struct {
indexer cache.Indexer
}
// NewIPAMHandleLister returns a new IPAMHandleLister.
func NewIPAMHandleLister(indexer cache.Indexer) IPAMHandleLister {
return &iPAMHandleLister{indexer: indexer}
}
// List lists all IPAMHandles in the indexer.
func (s *iPAMHandleLister) List(selector labels.Selector) (ret []*v1alpha1.IPAMHandle, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.IPAMHandle))
})
return ret, err
}
// Get retrieves the IPAMHandle from the index for a given name.
func (s *iPAMHandleLister) Get(name string) (*v1alpha1.IPAMHandle, error) {
obj, exists, err := s.indexer.GetByKey(name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("ipamhandle"), name)
}
return obj.(*v1alpha1.IPAMHandle), nil
}

View File

@@ -0,0 +1,65 @@
/*
Copyright 2020 The KubeSphere 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 (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
v1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
)
// IPPoolLister helps list IPPools.
type IPPoolLister interface {
// List lists all IPPools in the indexer.
List(selector labels.Selector) (ret []*v1alpha1.IPPool, err error)
// Get retrieves the IPPool from the index for a given name.
Get(name string) (*v1alpha1.IPPool, error)
IPPoolListerExpansion
}
// iPPoolLister implements the IPPoolLister interface.
type iPPoolLister struct {
indexer cache.Indexer
}
// 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
}
// Get retrieves the IPPool from the index for a given name.
func (s *iPPoolLister) Get(name string) (*v1alpha1.IPPool, error) {
obj, exists, err := s.indexer.GetByKey(name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("ippool"), name)
}
return obj.(*v1alpha1.IPPool), nil
}