improve IAM module

Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
hongming
2020-05-22 09:35:05 +08:00
parent 0d12529051
commit 8f93266ec0
640 changed files with 50221 additions and 18179 deletions

View File

@@ -31,6 +31,7 @@ import (
networkv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/network/v1alpha1"
servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/servicemesh/v1alpha2"
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tenant/v1alpha1"
tenantv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tenant/v1alpha2"
)
type Interface interface {
@@ -42,6 +43,7 @@ type Interface interface {
NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface
ServicemeshV1alpha2() servicemeshv1alpha2.ServicemeshV1alpha2Interface
TenantV1alpha1() tenantv1alpha1.TenantV1alpha1Interface
TenantV1alpha2() tenantv1alpha2.TenantV1alpha2Interface
}
// Clientset contains the clients for groups. Each group has exactly one
@@ -55,6 +57,7 @@ type Clientset struct {
networkV1alpha1 *networkv1alpha1.NetworkV1alpha1Client
servicemeshV1alpha2 *servicemeshv1alpha2.ServicemeshV1alpha2Client
tenantV1alpha1 *tenantv1alpha1.TenantV1alpha1Client
tenantV1alpha2 *tenantv1alpha2.TenantV1alpha2Client
}
// ClusterV1alpha1 retrieves the ClusterV1alpha1Client
@@ -92,6 +95,11 @@ func (c *Clientset) TenantV1alpha1() tenantv1alpha1.TenantV1alpha1Interface {
return c.tenantV1alpha1
}
// TenantV1alpha2 retrieves the TenantV1alpha2Client
func (c *Clientset) TenantV1alpha2() tenantv1alpha2.TenantV1alpha2Interface {
return c.tenantV1alpha2
}
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
if c == nil {
@@ -141,6 +149,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
if err != nil {
return nil, err
}
cs.tenantV1alpha2, err = tenantv1alpha2.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil {
@@ -160,6 +172,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
cs.networkV1alpha1 = networkv1alpha1.NewForConfigOrDie(c)
cs.servicemeshV1alpha2 = servicemeshv1alpha2.NewForConfigOrDie(c)
cs.tenantV1alpha1 = tenantv1alpha1.NewForConfigOrDie(c)
cs.tenantV1alpha2 = tenantv1alpha2.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &cs
@@ -175,6 +188,7 @@ func New(c rest.Interface) *Clientset {
cs.networkV1alpha1 = networkv1alpha1.New(c)
cs.servicemeshV1alpha2 = servicemeshv1alpha2.New(c)
cs.tenantV1alpha1 = tenantv1alpha1.New(c)
cs.tenantV1alpha2 = tenantv1alpha2.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &cs

View File

@@ -39,6 +39,8 @@ import (
fakeservicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/servicemesh/v1alpha2/fake"
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tenant/v1alpha1"
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"
)
// NewSimpleClientset returns a clientset that will respond with the provided objects.
@@ -122,3 +124,8 @@ func (c *Clientset) ServicemeshV1alpha2() servicemeshv1alpha2.ServicemeshV1alpha
func (c *Clientset) TenantV1alpha1() tenantv1alpha1.TenantV1alpha1Interface {
return &faketenantv1alpha1.FakeTenantV1alpha1{Fake: &c.Fake}
}
// TenantV1alpha2 retrieves the TenantV1alpha2Client
func (c *Clientset) TenantV1alpha2() tenantv1alpha2.TenantV1alpha2Interface {
return &faketenantv1alpha2.FakeTenantV1alpha2{Fake: &c.Fake}
}

View File

@@ -31,6 +31,7 @@ import (
networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2"
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
tenantv1alpha2 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha2"
)
var scheme = runtime.NewScheme()
@@ -44,6 +45,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{
networkv1alpha1.AddToScheme,
servicemeshv1alpha2.AddToScheme,
tenantv1alpha1.AddToScheme,
tenantv1alpha2.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition

View File

@@ -31,6 +31,7 @@ import (
networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2"
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
tenantv1alpha2 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha2"
)
var Scheme = runtime.NewScheme()
@@ -44,6 +45,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{
networkv1alpha1.AddToScheme,
servicemeshv1alpha2.AddToScheme,
tenantv1alpha1.AddToScheme,
tenantv1alpha2.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition

View File

@@ -0,0 +1,20 @@
/*
Copyright 2019 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 v1alpha2

View File

@@ -0,0 +1,20 @@
/*
Copyright 2019 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

View File

@@ -0,0 +1,40 @@
/*
Copyright 2019 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"
v1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tenant/v1alpha2"
)
type FakeTenantV1alpha2 struct {
*testing.Fake
}
func (c *FakeTenantV1alpha2) WorkspaceTemplates() v1alpha2.WorkspaceTemplateInterface {
return &FakeWorkspaceTemplates{c}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeTenantV1alpha2) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View File

@@ -0,0 +1,120 @@
/*
Copyright 2019 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"
v1alpha2 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha2"
)
// FakeWorkspaceTemplates implements WorkspaceTemplateInterface
type FakeWorkspaceTemplates struct {
Fake *FakeTenantV1alpha2
}
var workspacetemplatesResource = schema.GroupVersionResource{Group: "tenant.kubesphere.io", Version: "v1alpha2", Resource: "workspacetemplates"}
var workspacetemplatesKind = schema.GroupVersionKind{Group: "tenant.kubesphere.io", Version: "v1alpha2", Kind: "WorkspaceTemplate"}
// Get takes name of the workspaceTemplate, and returns the corresponding workspaceTemplate object, and an error if there is any.
func (c *FakeWorkspaceTemplates) Get(name string, options v1.GetOptions) (result *v1alpha2.WorkspaceTemplate, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootGetAction(workspacetemplatesResource, name), &v1alpha2.WorkspaceTemplate{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.WorkspaceTemplate), err
}
// List takes label and field selectors, and returns the list of WorkspaceTemplates that match those selectors.
func (c *FakeWorkspaceTemplates) List(opts v1.ListOptions) (result *v1alpha2.WorkspaceTemplateList, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootListAction(workspacetemplatesResource, workspacetemplatesKind, opts), &v1alpha2.WorkspaceTemplateList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha2.WorkspaceTemplateList{ListMeta: obj.(*v1alpha2.WorkspaceTemplateList).ListMeta}
for _, item := range obj.(*v1alpha2.WorkspaceTemplateList).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 workspaceTemplates.
func (c *FakeWorkspaceTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchAction(workspacetemplatesResource, opts))
}
// Create takes the representation of a workspaceTemplate and creates it. Returns the server's representation of the workspaceTemplate, and an error, if there is any.
func (c *FakeWorkspaceTemplates) Create(workspaceTemplate *v1alpha2.WorkspaceTemplate) (result *v1alpha2.WorkspaceTemplate, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(workspacetemplatesResource, workspaceTemplate), &v1alpha2.WorkspaceTemplate{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.WorkspaceTemplate), err
}
// Update takes the representation of a workspaceTemplate and updates it. Returns the server's representation of the workspaceTemplate, and an error, if there is any.
func (c *FakeWorkspaceTemplates) Update(workspaceTemplate *v1alpha2.WorkspaceTemplate) (result *v1alpha2.WorkspaceTemplate, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(workspacetemplatesResource, workspaceTemplate), &v1alpha2.WorkspaceTemplate{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.WorkspaceTemplate), err
}
// Delete takes name of the workspaceTemplate and deletes it. Returns an error if one occurs.
func (c *FakeWorkspaceTemplates) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteAction(workspacetemplatesResource, name), &v1alpha2.WorkspaceTemplate{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeWorkspaceTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(workspacetemplatesResource, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha2.WorkspaceTemplateList{})
return err
}
// Patch applies the patch and returns the patched workspaceTemplate.
func (c *FakeWorkspaceTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.WorkspaceTemplate, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(workspacetemplatesResource, name, pt, data, subresources...), &v1alpha2.WorkspaceTemplate{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.WorkspaceTemplate), err
}

View File

@@ -0,0 +1,21 @@
/*
Copyright 2019 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 v1alpha2
type WorkspaceTemplateExpansion interface{}

View File

@@ -0,0 +1,89 @@
/*
Copyright 2019 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 v1alpha2
import (
rest "k8s.io/client-go/rest"
v1alpha2 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha2"
"kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme"
)
type TenantV1alpha2Interface interface {
RESTClient() rest.Interface
WorkspaceTemplatesGetter
}
// TenantV1alpha2Client is used to interact with features provided by the tenant.kubesphere.io group.
type TenantV1alpha2Client struct {
restClient rest.Interface
}
func (c *TenantV1alpha2Client) WorkspaceTemplates() WorkspaceTemplateInterface {
return newWorkspaceTemplates(c)
}
// NewForConfig creates a new TenantV1alpha2Client for the given config.
func NewForConfig(c *rest.Config) (*TenantV1alpha2Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &TenantV1alpha2Client{client}, nil
}
// NewForConfigOrDie creates a new TenantV1alpha2Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *TenantV1alpha2Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new TenantV1alpha2Client for the given RESTClient.
func New(c rest.Interface) *TenantV1alpha2Client {
return &TenantV1alpha2Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha2.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 *TenantV1alpha2Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@@ -0,0 +1,164 @@
/*
Copyright 2019 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 v1alpha2
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"
v1alpha2 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha2"
scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme"
)
// WorkspaceTemplatesGetter has a method to return a WorkspaceTemplateInterface.
// A group's client should implement this interface.
type WorkspaceTemplatesGetter interface {
WorkspaceTemplates() WorkspaceTemplateInterface
}
// WorkspaceTemplateInterface has methods to work with WorkspaceTemplate resources.
type WorkspaceTemplateInterface interface {
Create(*v1alpha2.WorkspaceTemplate) (*v1alpha2.WorkspaceTemplate, error)
Update(*v1alpha2.WorkspaceTemplate) (*v1alpha2.WorkspaceTemplate, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha2.WorkspaceTemplate, error)
List(opts v1.ListOptions) (*v1alpha2.WorkspaceTemplateList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.WorkspaceTemplate, err error)
WorkspaceTemplateExpansion
}
// workspaceTemplates implements WorkspaceTemplateInterface
type workspaceTemplates struct {
client rest.Interface
}
// newWorkspaceTemplates returns a WorkspaceTemplates
func newWorkspaceTemplates(c *TenantV1alpha2Client) *workspaceTemplates {
return &workspaceTemplates{
client: c.RESTClient(),
}
}
// Get takes name of the workspaceTemplate, and returns the corresponding workspaceTemplate object, and an error if there is any.
func (c *workspaceTemplates) Get(name string, options v1.GetOptions) (result *v1alpha2.WorkspaceTemplate, err error) {
result = &v1alpha2.WorkspaceTemplate{}
err = c.client.Get().
Resource("workspacetemplates").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of WorkspaceTemplates that match those selectors.
func (c *workspaceTemplates) List(opts v1.ListOptions) (result *v1alpha2.WorkspaceTemplateList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha2.WorkspaceTemplateList{}
err = c.client.Get().
Resource("workspacetemplates").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested workspaceTemplates.
func (c *workspaceTemplates) 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("workspacetemplates").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
}
// Create takes the representation of a workspaceTemplate and creates it. Returns the server's representation of the workspaceTemplate, and an error, if there is any.
func (c *workspaceTemplates) Create(workspaceTemplate *v1alpha2.WorkspaceTemplate) (result *v1alpha2.WorkspaceTemplate, err error) {
result = &v1alpha2.WorkspaceTemplate{}
err = c.client.Post().
Resource("workspacetemplates").
Body(workspaceTemplate).
Do().
Into(result)
return
}
// Update takes the representation of a workspaceTemplate and updates it. Returns the server's representation of the workspaceTemplate, and an error, if there is any.
func (c *workspaceTemplates) Update(workspaceTemplate *v1alpha2.WorkspaceTemplate) (result *v1alpha2.WorkspaceTemplate, err error) {
result = &v1alpha2.WorkspaceTemplate{}
err = c.client.Put().
Resource("workspacetemplates").
Name(workspaceTemplate.Name).
Body(workspaceTemplate).
Do().
Into(result)
return
}
// Delete takes name of the workspaceTemplate and deletes it. Returns an error if one occurs.
func (c *workspaceTemplates) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Resource("workspacetemplates").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *workspaceTemplates) 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("workspacetemplates").
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Error()
}
// Patch applies the patch and returns the patched workspaceTemplate.
func (c *workspaceTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.WorkspaceTemplate, err error) {
result = &v1alpha2.WorkspaceTemplate{}
err = c.client.Patch(pt).
Resource("workspacetemplates").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@@ -30,6 +30,7 @@ import (
networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2"
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
tenantv1alpha2 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha2"
)
// GenericInformer is type of SharedIndexInformer which will locate and delegate to other
@@ -104,6 +105,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
case tenantv1alpha1.SchemeGroupVersion.WithResource("workspaces"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Tenant().V1alpha1().Workspaces().Informer()}, nil
// Group=tenant.kubesphere.io, Version=v1alpha2
case tenantv1alpha2.SchemeGroupVersion.WithResource("workspacetemplates"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Tenant().V1alpha2().WorkspaceTemplates().Informer()}, nil
}
return nil, fmt.Errorf("no informer found for %v", resource)

View File

@@ -21,12 +21,15 @@ package tenant
import (
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "kubesphere.io/kubesphere/pkg/client/informers/externalversions/tenant/v1alpha1"
v1alpha2 "kubesphere.io/kubesphere/pkg/client/informers/externalversions/tenant/v1alpha2"
)
// Interface provides access to each of this group's versions.
type Interface interface {
// V1alpha1 provides access to shared informers for resources in V1alpha1.
V1alpha1() v1alpha1.Interface
// V1alpha2 provides access to shared informers for resources in V1alpha2.
V1alpha2() v1alpha2.Interface
}
type group struct {
@@ -44,3 +47,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
func (g *group) V1alpha1() v1alpha1.Interface {
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
}
// V1alpha2 returns a new v1alpha2.Interface.
func (g *group) V1alpha2() v1alpha2.Interface {
return v1alpha2.New(g.factory, g.namespace, g.tweakListOptions)
}

View File

@@ -0,0 +1,45 @@
/*
Copyright 2019 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 v1alpha2
import (
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
)
// Interface provides access to all the informers in this group version.
type Interface interface {
// WorkspaceTemplates returns a WorkspaceTemplateInformer.
WorkspaceTemplates() WorkspaceTemplateInformer
}
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}
}
// WorkspaceTemplates returns a WorkspaceTemplateInformer.
func (v *version) WorkspaceTemplates() WorkspaceTemplateInformer {
return &workspaceTemplateInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}

View File

@@ -0,0 +1,88 @@
/*
Copyright 2019 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 v1alpha2
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"
tenantv1alpha2 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha2"
versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
v1alpha2 "kubesphere.io/kubesphere/pkg/client/listers/tenant/v1alpha2"
)
// WorkspaceTemplateInformer provides access to a shared informer and lister for
// WorkspaceTemplates.
type WorkspaceTemplateInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha2.WorkspaceTemplateLister
}
type workspaceTemplateInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewWorkspaceTemplateInformer constructs a new informer for WorkspaceTemplate 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 NewWorkspaceTemplateInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredWorkspaceTemplateInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredWorkspaceTemplateInformer constructs a new informer for WorkspaceTemplate 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 NewFilteredWorkspaceTemplateInformer(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.TenantV1alpha2().WorkspaceTemplates().List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.TenantV1alpha2().WorkspaceTemplates().Watch(options)
},
},
&tenantv1alpha2.WorkspaceTemplate{},
resyncPeriod,
indexers,
)
}
func (f *workspaceTemplateInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredWorkspaceTemplateInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *workspaceTemplateInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&tenantv1alpha2.WorkspaceTemplate{}, f.defaultInformer)
}
func (f *workspaceTemplateInformer) Lister() v1alpha2.WorkspaceTemplateLister {
return v1alpha2.NewWorkspaceTemplateLister(f.Informer().GetIndexer())
}

View File

@@ -0,0 +1,23 @@
/*
Copyright 2019 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 v1alpha2
// WorkspaceTemplateListerExpansion allows custom methods to be added to
// WorkspaceTemplateLister.
type WorkspaceTemplateListerExpansion interface{}

View File

@@ -0,0 +1,65 @@
/*
Copyright 2019 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 v1alpha2
import (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
v1alpha2 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha2"
)
// WorkspaceTemplateLister helps list WorkspaceTemplates.
type WorkspaceTemplateLister interface {
// List lists all WorkspaceTemplates in the indexer.
List(selector labels.Selector) (ret []*v1alpha2.WorkspaceTemplate, err error)
// Get retrieves the WorkspaceTemplate from the index for a given name.
Get(name string) (*v1alpha2.WorkspaceTemplate, error)
WorkspaceTemplateListerExpansion
}
// workspaceTemplateLister implements the WorkspaceTemplateLister interface.
type workspaceTemplateLister struct {
indexer cache.Indexer
}
// NewWorkspaceTemplateLister returns a new WorkspaceTemplateLister.
func NewWorkspaceTemplateLister(indexer cache.Indexer) WorkspaceTemplateLister {
return &workspaceTemplateLister{indexer: indexer}
}
// List lists all WorkspaceTemplates in the indexer.
func (s *workspaceTemplateLister) List(selector labels.Selector) (ret []*v1alpha2.WorkspaceTemplate, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha2.WorkspaceTemplate))
})
return ret, err
}
// Get retrieves the WorkspaceTemplate from the index for a given name.
func (s *workspaceTemplateLister) Get(name string) (*v1alpha2.WorkspaceTemplate, error) {
obj, exists, err := s.indexer.GetByKey(name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha2.Resource("workspacetemplate"), name)
}
return obj.(*v1alpha2.WorkspaceTemplate), nil
}