add federatednamespaces tenant API
Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
@@ -34,6 +34,7 @@ import (
|
||||
storagev1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/storage/v1alpha1"
|
||||
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tenant/v1alpha1"
|
||||
tenantv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tenant/v1alpha2"
|
||||
typesv1beta1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/types/v1beta1"
|
||||
)
|
||||
|
||||
type Interface interface {
|
||||
@@ -48,6 +49,7 @@ type Interface interface {
|
||||
StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface
|
||||
TenantV1alpha1() tenantv1alpha1.TenantV1alpha1Interface
|
||||
TenantV1alpha2() tenantv1alpha2.TenantV1alpha2Interface
|
||||
TypesV1beta1() typesv1beta1.TypesV1beta1Interface
|
||||
}
|
||||
|
||||
// Clientset contains the clients for groups. Each group has exactly one
|
||||
@@ -64,6 +66,7 @@ type Clientset struct {
|
||||
storageV1alpha1 *storagev1alpha1.StorageV1alpha1Client
|
||||
tenantV1alpha1 *tenantv1alpha1.TenantV1alpha1Client
|
||||
tenantV1alpha2 *tenantv1alpha2.TenantV1alpha2Client
|
||||
typesV1beta1 *typesv1beta1.TypesV1beta1Client
|
||||
}
|
||||
|
||||
// AuditingV1alpha1 retrieves the AuditingV1alpha1Client
|
||||
@@ -116,6 +119,11 @@ func (c *Clientset) TenantV1alpha2() tenantv1alpha2.TenantV1alpha2Interface {
|
||||
return c.tenantV1alpha2
|
||||
}
|
||||
|
||||
// TypesV1beta1 retrieves the TypesV1beta1Client
|
||||
func (c *Clientset) TypesV1beta1() typesv1beta1.TypesV1beta1Interface {
|
||||
return c.typesV1beta1
|
||||
}
|
||||
|
||||
// Discovery retrieves the DiscoveryClient
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
if c == nil {
|
||||
@@ -177,6 +185,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.typesV1beta1, err = typesv1beta1.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
@@ -199,6 +211,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||
cs.storageV1alpha1 = storagev1alpha1.NewForConfigOrDie(c)
|
||||
cs.tenantV1alpha1 = tenantv1alpha1.NewForConfigOrDie(c)
|
||||
cs.tenantV1alpha2 = tenantv1alpha2.NewForConfigOrDie(c)
|
||||
cs.typesV1beta1 = typesv1beta1.NewForConfigOrDie(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
||||
return &cs
|
||||
@@ -217,6 +230,7 @@ func New(c rest.Interface) *Clientset {
|
||||
cs.storageV1alpha1 = storagev1alpha1.New(c)
|
||||
cs.tenantV1alpha1 = tenantv1alpha1.New(c)
|
||||
cs.tenantV1alpha2 = tenantv1alpha2.New(c)
|
||||
cs.typesV1beta1 = typesv1beta1.New(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||
return &cs
|
||||
|
||||
@@ -45,6 +45,8 @@ import (
|
||||
faketenantv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tenant/v1alpha1/fake"
|
||||
tenantv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tenant/v1alpha2"
|
||||
faketenantv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tenant/v1alpha2/fake"
|
||||
typesv1beta1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/types/v1beta1"
|
||||
faketypesv1beta1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/types/v1beta1/fake"
|
||||
)
|
||||
|
||||
// NewSimpleClientset returns a clientset that will respond with the provided objects.
|
||||
@@ -143,3 +145,8 @@ func (c *Clientset) TenantV1alpha1() tenantv1alpha1.TenantV1alpha1Interface {
|
||||
func (c *Clientset) TenantV1alpha2() tenantv1alpha2.TenantV1alpha2Interface {
|
||||
return &faketenantv1alpha2.FakeTenantV1alpha2{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// TypesV1beta1 retrieves the TypesV1beta1Client
|
||||
func (c *Clientset) TypesV1beta1() typesv1beta1.TypesV1beta1Interface {
|
||||
return &faketypesv1beta1.FakeTypesV1beta1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import (
|
||||
storagev1alpha1 "kubesphere.io/kubesphere/pkg/apis/storage/v1alpha1"
|
||||
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
|
||||
tenantv1alpha2 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha2"
|
||||
typesv1beta1 "kubesphere.io/kubesphere/pkg/apis/types/v1beta1"
|
||||
)
|
||||
|
||||
var scheme = runtime.NewScheme()
|
||||
@@ -50,6 +51,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
storagev1alpha1.AddToScheme,
|
||||
tenantv1alpha1.AddToScheme,
|
||||
tenantv1alpha2.AddToScheme,
|
||||
typesv1beta1.AddToScheme,
|
||||
}
|
||||
|
||||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
||||
|
||||
@@ -34,6 +34,7 @@ import (
|
||||
storagev1alpha1 "kubesphere.io/kubesphere/pkg/apis/storage/v1alpha1"
|
||||
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
|
||||
tenantv1alpha2 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha2"
|
||||
typesv1beta1 "kubesphere.io/kubesphere/pkg/apis/types/v1beta1"
|
||||
)
|
||||
|
||||
var Scheme = runtime.NewScheme()
|
||||
@@ -50,6 +51,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
storagev1alpha1.AddToScheme,
|
||||
tenantv1alpha1.AddToScheme,
|
||||
tenantv1alpha2.AddToScheme,
|
||||
typesv1beta1.AddToScheme,
|
||||
}
|
||||
|
||||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
||||
|
||||
20
pkg/client/clientset/versioned/typed/types/v1beta1/doc.go
Normal file
20
pkg/client/clientset/versioned/typed/types/v1beta1/doc.go
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
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.
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1beta1
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
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 has the automatically generated clients.
|
||||
package fake
|
||||
@@ -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"
|
||||
v1beta1 "kubesphere.io/kubesphere/pkg/apis/types/v1beta1"
|
||||
)
|
||||
|
||||
// FakeFederatedNamespaces implements FederatedNamespaceInterface
|
||||
type FakeFederatedNamespaces struct {
|
||||
Fake *FakeTypesV1beta1
|
||||
}
|
||||
|
||||
var federatednamespacesResource = schema.GroupVersionResource{Group: "types.kubefed.io", Version: "v1beta1", Resource: "federatednamespaces"}
|
||||
|
||||
var federatednamespacesKind = schema.GroupVersionKind{Group: "types.kubefed.io", Version: "v1beta1", Kind: "FederatedNamespace"}
|
||||
|
||||
// Get takes name of the federatedNamespace, and returns the corresponding federatedNamespace object, and an error if there is any.
|
||||
func (c *FakeFederatedNamespaces) Get(name string, options v1.GetOptions) (result *v1beta1.FederatedNamespace, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(federatednamespacesResource, name), &v1beta1.FederatedNamespace{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.FederatedNamespace), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of FederatedNamespaces that match those selectors.
|
||||
func (c *FakeFederatedNamespaces) List(opts v1.ListOptions) (result *v1beta1.FederatedNamespaceList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(federatednamespacesResource, federatednamespacesKind, opts), &v1beta1.FederatedNamespaceList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1beta1.FederatedNamespaceList{ListMeta: obj.(*v1beta1.FederatedNamespaceList).ListMeta}
|
||||
for _, item := range obj.(*v1beta1.FederatedNamespaceList).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 federatedNamespaces.
|
||||
func (c *FakeFederatedNamespaces) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(federatednamespacesResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a federatedNamespace and creates it. Returns the server's representation of the federatedNamespace, and an error, if there is any.
|
||||
func (c *FakeFederatedNamespaces) Create(federatedNamespace *v1beta1.FederatedNamespace) (result *v1beta1.FederatedNamespace, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(federatednamespacesResource, federatedNamespace), &v1beta1.FederatedNamespace{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.FederatedNamespace), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a federatedNamespace and updates it. Returns the server's representation of the federatedNamespace, and an error, if there is any.
|
||||
func (c *FakeFederatedNamespaces) Update(federatedNamespace *v1beta1.FederatedNamespace) (result *v1beta1.FederatedNamespace, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(federatednamespacesResource, federatedNamespace), &v1beta1.FederatedNamespace{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.FederatedNamespace), err
|
||||
}
|
||||
|
||||
// Delete takes name of the federatedNamespace and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeFederatedNamespaces) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteAction(federatednamespacesResource, name), &v1beta1.FederatedNamespace{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeFederatedNamespaces) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(federatednamespacesResource, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1beta1.FederatedNamespaceList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched federatedNamespace.
|
||||
func (c *FakeFederatedNamespaces) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.FederatedNamespace, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(federatednamespacesResource, name, pt, data, subresources...), &v1beta1.FederatedNamespace{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1beta1.FederatedNamespace), err
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
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 (
|
||||
rest "k8s.io/client-go/rest"
|
||||
testing "k8s.io/client-go/testing"
|
||||
v1beta1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/types/v1beta1"
|
||||
)
|
||||
|
||||
type FakeTypesV1beta1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeTypesV1beta1) FederatedNamespaces() v1beta1.FederatedNamespaceInterface {
|
||||
return &FakeFederatedNamespaces{c}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeTypesV1beta1) RESTClient() rest.Interface {
|
||||
var ret *rest.RESTClient
|
||||
return ret
|
||||
}
|
||||
@@ -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 v1beta1
|
||||
|
||||
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"
|
||||
v1beta1 "kubesphere.io/kubesphere/pkg/apis/types/v1beta1"
|
||||
scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme"
|
||||
)
|
||||
|
||||
// FederatedNamespacesGetter has a method to return a FederatedNamespaceInterface.
|
||||
// A group's client should implement this interface.
|
||||
type FederatedNamespacesGetter interface {
|
||||
FederatedNamespaces() FederatedNamespaceInterface
|
||||
}
|
||||
|
||||
// FederatedNamespaceInterface has methods to work with FederatedNamespace resources.
|
||||
type FederatedNamespaceInterface interface {
|
||||
Create(*v1beta1.FederatedNamespace) (*v1beta1.FederatedNamespace, error)
|
||||
Update(*v1beta1.FederatedNamespace) (*v1beta1.FederatedNamespace, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string, options v1.GetOptions) (*v1beta1.FederatedNamespace, error)
|
||||
List(opts v1.ListOptions) (*v1beta1.FederatedNamespaceList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.FederatedNamespace, err error)
|
||||
FederatedNamespaceExpansion
|
||||
}
|
||||
|
||||
// federatedNamespaces implements FederatedNamespaceInterface
|
||||
type federatedNamespaces struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newFederatedNamespaces returns a FederatedNamespaces
|
||||
func newFederatedNamespaces(c *TypesV1beta1Client) *federatedNamespaces {
|
||||
return &federatedNamespaces{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the federatedNamespace, and returns the corresponding federatedNamespace object, and an error if there is any.
|
||||
func (c *federatedNamespaces) Get(name string, options v1.GetOptions) (result *v1beta1.FederatedNamespace, err error) {
|
||||
result = &v1beta1.FederatedNamespace{}
|
||||
err = c.client.Get().
|
||||
Resource("federatednamespaces").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of FederatedNamespaces that match those selectors.
|
||||
func (c *federatedNamespaces) List(opts v1.ListOptions) (result *v1beta1.FederatedNamespaceList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1beta1.FederatedNamespaceList{}
|
||||
err = c.client.Get().
|
||||
Resource("federatednamespaces").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested federatedNamespaces.
|
||||
func (c *federatedNamespaces) 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("federatednamespaces").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a federatedNamespace and creates it. Returns the server's representation of the federatedNamespace, and an error, if there is any.
|
||||
func (c *federatedNamespaces) Create(federatedNamespace *v1beta1.FederatedNamespace) (result *v1beta1.FederatedNamespace, err error) {
|
||||
result = &v1beta1.FederatedNamespace{}
|
||||
err = c.client.Post().
|
||||
Resource("federatednamespaces").
|
||||
Body(federatedNamespace).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a federatedNamespace and updates it. Returns the server's representation of the federatedNamespace, and an error, if there is any.
|
||||
func (c *federatedNamespaces) Update(federatedNamespace *v1beta1.FederatedNamespace) (result *v1beta1.FederatedNamespace, err error) {
|
||||
result = &v1beta1.FederatedNamespace{}
|
||||
err = c.client.Put().
|
||||
Resource("federatednamespaces").
|
||||
Name(federatedNamespace.Name).
|
||||
Body(federatedNamespace).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the federatedNamespace and deletes it. Returns an error if one occurs.
|
||||
func (c *federatedNamespaces) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("federatednamespaces").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *federatedNamespaces) 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("federatednamespaces").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched federatedNamespace.
|
||||
func (c *federatedNamespaces) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.FederatedNamespace, err error) {
|
||||
result = &v1beta1.FederatedNamespace{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("federatednamespaces").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
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 v1beta1
|
||||
|
||||
type FederatedNamespaceExpansion interface{}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
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 v1beta1
|
||||
|
||||
import (
|
||||
rest "k8s.io/client-go/rest"
|
||||
v1beta1 "kubesphere.io/kubesphere/pkg/apis/types/v1beta1"
|
||||
"kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme"
|
||||
)
|
||||
|
||||
type TypesV1beta1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
FederatedNamespacesGetter
|
||||
}
|
||||
|
||||
// TypesV1beta1Client is used to interact with features provided by the types.kubefed.io group.
|
||||
type TypesV1beta1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *TypesV1beta1Client) FederatedNamespaces() FederatedNamespaceInterface {
|
||||
return newFederatedNamespaces(c)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new TypesV1beta1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*TypesV1beta1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := rest.RESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &TypesV1beta1Client{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new TypesV1beta1Client for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *TypesV1beta1Client {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// New creates a new TypesV1beta1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *TypesV1beta1Client {
|
||||
return &TypesV1beta1Client{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv := v1beta1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *TypesV1beta1Client) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.restClient
|
||||
}
|
||||
@@ -37,6 +37,7 @@ import (
|
||||
servicemesh "kubesphere.io/kubesphere/pkg/client/informers/externalversions/servicemesh"
|
||||
storage "kubesphere.io/kubesphere/pkg/client/informers/externalversions/storage"
|
||||
tenant "kubesphere.io/kubesphere/pkg/client/informers/externalversions/tenant"
|
||||
types "kubesphere.io/kubesphere/pkg/client/informers/externalversions/types"
|
||||
)
|
||||
|
||||
// SharedInformerOption defines the functional option type for SharedInformerFactory.
|
||||
@@ -187,6 +188,7 @@ type SharedInformerFactory interface {
|
||||
Servicemesh() servicemesh.Interface
|
||||
Storage() storage.Interface
|
||||
Tenant() tenant.Interface
|
||||
Types() types.Interface
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) Auditing() auditing.Interface {
|
||||
@@ -220,3 +222,7 @@ func (f *sharedInformerFactory) Storage() storage.Interface {
|
||||
func (f *sharedInformerFactory) Tenant() tenant.Interface {
|
||||
return tenant.New(f, f.namespace, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) Types() types.Interface {
|
||||
return types.New(f, f.namespace, f.tweakListOptions)
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import (
|
||||
storagev1alpha1 "kubesphere.io/kubesphere/pkg/apis/storage/v1alpha1"
|
||||
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
|
||||
tenantv1alpha2 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha2"
|
||||
v1beta1 "kubesphere.io/kubesphere/pkg/apis/types/v1beta1"
|
||||
)
|
||||
|
||||
// GenericInformer is type of SharedIndexInformer which will locate and delegate to other
|
||||
@@ -125,6 +126,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
||||
case tenantv1alpha2.SchemeGroupVersion.WithResource("workspacetemplates"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Tenant().V1alpha2().WorkspaceTemplates().Informer()}, nil
|
||||
|
||||
// Group=types.kubefed.io, Version=v1beta1
|
||||
case v1beta1.SchemeGroupVersion.WithResource("federatednamespaces"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Types().V1beta1().FederatedNamespaces().Informer()}, nil
|
||||
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("no informer found for %v", resource)
|
||||
|
||||
46
pkg/client/informers/externalversions/types/interface.go
Normal file
46
pkg/client/informers/externalversions/types/interface.go
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
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 types
|
||||
|
||||
import (
|
||||
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v1beta1 "kubesphere.io/kubesphere/pkg/client/informers/externalversions/types/v1beta1"
|
||||
)
|
||||
|
||||
// Interface provides access to each of this group's versions.
|
||||
type Interface interface {
|
||||
// V1beta1 provides access to shared informers for resources in V1beta1.
|
||||
V1beta1() v1beta1.Interface
|
||||
}
|
||||
|
||||
type group struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
namespace string
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// New returns a new Interface.
|
||||
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
|
||||
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||
}
|
||||
|
||||
// V1beta1 returns a new v1beta1.Interface.
|
||||
func (g *group) V1beta1() v1beta1.Interface {
|
||||
return v1beta1.New(g.factory, g.namespace, g.tweakListOptions)
|
||||
}
|
||||
@@ -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 v1beta1
|
||||
|
||||
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"
|
||||
typesv1beta1 "kubesphere.io/kubesphere/pkg/apis/types/v1beta1"
|
||||
versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
|
||||
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v1beta1 "kubesphere.io/kubesphere/pkg/client/listers/types/v1beta1"
|
||||
)
|
||||
|
||||
// FederatedNamespaceInformer provides access to a shared informer and lister for
|
||||
// FederatedNamespaces.
|
||||
type FederatedNamespaceInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1beta1.FederatedNamespaceLister
|
||||
}
|
||||
|
||||
type federatedNamespaceInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// NewFederatedNamespaceInformer constructs a new informer for FederatedNamespace 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 NewFederatedNamespaceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredFederatedNamespaceInformer(client, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredFederatedNamespaceInformer constructs a new informer for FederatedNamespace 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 NewFilteredFederatedNamespaceInformer(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.TypesV1beta1().FederatedNamespaces().List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.TypesV1beta1().FederatedNamespaces().Watch(options)
|
||||
},
|
||||
},
|
||||
&typesv1beta1.FederatedNamespace{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *federatedNamespaceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredFederatedNamespaceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *federatedNamespaceInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&typesv1beta1.FederatedNamespace{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *federatedNamespaceInformer) Lister() v1beta1.FederatedNamespaceLister {
|
||||
return v1beta1.NewFederatedNamespaceLister(f.Informer().GetIndexer())
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
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 v1beta1
|
||||
|
||||
import (
|
||||
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
|
||||
)
|
||||
|
||||
// Interface provides access to all the informers in this group version.
|
||||
type Interface interface {
|
||||
// FederatedNamespaces returns a FederatedNamespaceInformer.
|
||||
FederatedNamespaces() FederatedNamespaceInformer
|
||||
}
|
||||
|
||||
type version struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
namespace string
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// New returns a new Interface.
|
||||
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
|
||||
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||
}
|
||||
|
||||
// FederatedNamespaces returns a FederatedNamespaceInformer.
|
||||
func (v *version) FederatedNamespaces() FederatedNamespaceInformer {
|
||||
return &federatedNamespaceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
23
pkg/client/listers/types/v1beta1/expansion_generated.go
Normal file
23
pkg/client/listers/types/v1beta1/expansion_generated.go
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
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 v1beta1
|
||||
|
||||
// FederatedNamespaceListerExpansion allows custom methods to be added to
|
||||
// FederatedNamespaceLister.
|
||||
type FederatedNamespaceListerExpansion interface{}
|
||||
65
pkg/client/listers/types/v1beta1/federatednamespace.go
Normal file
65
pkg/client/listers/types/v1beta1/federatednamespace.go
Normal 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 v1beta1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
v1beta1 "kubesphere.io/kubesphere/pkg/apis/types/v1beta1"
|
||||
)
|
||||
|
||||
// FederatedNamespaceLister helps list FederatedNamespaces.
|
||||
type FederatedNamespaceLister interface {
|
||||
// List lists all FederatedNamespaces in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1beta1.FederatedNamespace, err error)
|
||||
// Get retrieves the FederatedNamespace from the index for a given name.
|
||||
Get(name string) (*v1beta1.FederatedNamespace, error)
|
||||
FederatedNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// federatedNamespaceLister implements the FederatedNamespaceLister interface.
|
||||
type federatedNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewFederatedNamespaceLister returns a new FederatedNamespaceLister.
|
||||
func NewFederatedNamespaceLister(indexer cache.Indexer) FederatedNamespaceLister {
|
||||
return &federatedNamespaceLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all FederatedNamespaces in the indexer.
|
||||
func (s *federatedNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.FederatedNamespace, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1beta1.FederatedNamespace))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the FederatedNamespace from the index for a given name.
|
||||
func (s *federatedNamespaceLister) Get(name string) (*v1beta1.FederatedNamespace, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1beta1.Resource("federatednamespace"), name)
|
||||
}
|
||||
return obj.(*v1beta1.FederatedNamespace), nil
|
||||
}
|
||||
Reference in New Issue
Block a user