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)
}