add cluster api group (#1992)
This commit is contained in:
@@ -24,34 +24,39 @@ import (
|
||||
discovery "k8s.io/client-go/discovery"
|
||||
rest "k8s.io/client-go/rest"
|
||||
flowcontrol "k8s.io/client-go/util/flowcontrol"
|
||||
clusterv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/cluster/v1alpha1"
|
||||
devopsv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/devops/v1alpha1"
|
||||
iamv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/iam/v1alpha2"
|
||||
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"
|
||||
towerv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tower/v1alpha1"
|
||||
)
|
||||
|
||||
type Interface interface {
|
||||
Discovery() discovery.DiscoveryInterface
|
||||
ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface
|
||||
DevopsV1alpha1() devopsv1alpha1.DevopsV1alpha1Interface
|
||||
IamV1alpha2() iamv1alpha2.IamV1alpha2Interface
|
||||
NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface
|
||||
ServicemeshV1alpha2() servicemeshv1alpha2.ServicemeshV1alpha2Interface
|
||||
TenantV1alpha1() tenantv1alpha1.TenantV1alpha1Interface
|
||||
TowerV1alpha1() towerv1alpha1.TowerV1alpha1Interface
|
||||
}
|
||||
|
||||
// Clientset contains the clients for groups. Each group has exactly one
|
||||
// version included in a Clientset.
|
||||
type Clientset struct {
|
||||
*discovery.DiscoveryClient
|
||||
clusterV1alpha1 *clusterv1alpha1.ClusterV1alpha1Client
|
||||
devopsV1alpha1 *devopsv1alpha1.DevopsV1alpha1Client
|
||||
iamV1alpha2 *iamv1alpha2.IamV1alpha2Client
|
||||
networkV1alpha1 *networkv1alpha1.NetworkV1alpha1Client
|
||||
servicemeshV1alpha2 *servicemeshv1alpha2.ServicemeshV1alpha2Client
|
||||
tenantV1alpha1 *tenantv1alpha1.TenantV1alpha1Client
|
||||
towerV1alpha1 *towerv1alpha1.TowerV1alpha1Client
|
||||
}
|
||||
|
||||
// ClusterV1alpha1 retrieves the ClusterV1alpha1Client
|
||||
func (c *Clientset) ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface {
|
||||
return c.clusterV1alpha1
|
||||
}
|
||||
|
||||
// DevopsV1alpha1 retrieves the DevopsV1alpha1Client
|
||||
@@ -79,11 +84,6 @@ func (c *Clientset) TenantV1alpha1() tenantv1alpha1.TenantV1alpha1Interface {
|
||||
return c.tenantV1alpha1
|
||||
}
|
||||
|
||||
// TowerV1alpha1 retrieves the TowerV1alpha1Client
|
||||
func (c *Clientset) TowerV1alpha1() towerv1alpha1.TowerV1alpha1Interface {
|
||||
return c.towerV1alpha1
|
||||
}
|
||||
|
||||
// Discovery retrieves the DiscoveryClient
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
if c == nil {
|
||||
@@ -105,6 +105,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||
}
|
||||
var cs Clientset
|
||||
var err error
|
||||
cs.clusterV1alpha1, err = clusterv1alpha1.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.devopsV1alpha1, err = devopsv1alpha1.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -125,10 +129,6 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.towerV1alpha1, err = towerv1alpha1.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
@@ -141,12 +141,12 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||
var cs Clientset
|
||||
cs.clusterV1alpha1 = clusterv1alpha1.NewForConfigOrDie(c)
|
||||
cs.devopsV1alpha1 = devopsv1alpha1.NewForConfigOrDie(c)
|
||||
cs.iamV1alpha2 = iamv1alpha2.NewForConfigOrDie(c)
|
||||
cs.networkV1alpha1 = networkv1alpha1.NewForConfigOrDie(c)
|
||||
cs.servicemeshV1alpha2 = servicemeshv1alpha2.NewForConfigOrDie(c)
|
||||
cs.tenantV1alpha1 = tenantv1alpha1.NewForConfigOrDie(c)
|
||||
cs.towerV1alpha1 = towerv1alpha1.NewForConfigOrDie(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
||||
return &cs
|
||||
@@ -155,12 +155,12 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||
// New creates a new Clientset for the given RESTClient.
|
||||
func New(c rest.Interface) *Clientset {
|
||||
var cs Clientset
|
||||
cs.clusterV1alpha1 = clusterv1alpha1.New(c)
|
||||
cs.devopsV1alpha1 = devopsv1alpha1.New(c)
|
||||
cs.iamV1alpha2 = iamv1alpha2.New(c)
|
||||
cs.networkV1alpha1 = networkv1alpha1.New(c)
|
||||
cs.servicemeshV1alpha2 = servicemeshv1alpha2.New(c)
|
||||
cs.tenantV1alpha1 = tenantv1alpha1.New(c)
|
||||
cs.towerV1alpha1 = towerv1alpha1.New(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||
return &cs
|
||||
|
||||
@@ -25,6 +25,8 @@ import (
|
||||
fakediscovery "k8s.io/client-go/discovery/fake"
|
||||
"k8s.io/client-go/testing"
|
||||
clientset "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
|
||||
clusterv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/cluster/v1alpha1"
|
||||
fakeclusterv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/cluster/v1alpha1/fake"
|
||||
devopsv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/devops/v1alpha1"
|
||||
fakedevopsv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/devops/v1alpha1/fake"
|
||||
iamv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/iam/v1alpha2"
|
||||
@@ -35,8 +37,6 @@ 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"
|
||||
towerv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tower/v1alpha1"
|
||||
faketowerv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tower/v1alpha1/fake"
|
||||
)
|
||||
|
||||
// NewSimpleClientset returns a clientset that will respond with the provided objects.
|
||||
@@ -86,6 +86,11 @@ func (c *Clientset) Tracker() testing.ObjectTracker {
|
||||
|
||||
var _ clientset.Interface = &Clientset{}
|
||||
|
||||
// ClusterV1alpha1 retrieves the ClusterV1alpha1Client
|
||||
func (c *Clientset) ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface {
|
||||
return &fakeclusterv1alpha1.FakeClusterV1alpha1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// DevopsV1alpha1 retrieves the DevopsV1alpha1Client
|
||||
func (c *Clientset) DevopsV1alpha1() devopsv1alpha1.DevopsV1alpha1Interface {
|
||||
return &fakedevopsv1alpha1.FakeDevopsV1alpha1{Fake: &c.Fake}
|
||||
@@ -110,8 +115,3 @@ func (c *Clientset) ServicemeshV1alpha2() servicemeshv1alpha2.ServicemeshV1alpha
|
||||
func (c *Clientset) TenantV1alpha1() tenantv1alpha1.TenantV1alpha1Interface {
|
||||
return &faketenantv1alpha1.FakeTenantV1alpha1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// TowerV1alpha1 retrieves the TowerV1alpha1Client
|
||||
func (c *Clientset) TowerV1alpha1() towerv1alpha1.TowerV1alpha1Interface {
|
||||
return &faketowerv1alpha1.FakeTowerV1alpha1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
@@ -24,24 +24,24 @@ import (
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
clusterv1alpha1 "kubesphere.io/kubesphere/pkg/apis/cluster/v1alpha1"
|
||||
devopsv1alpha1 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha1"
|
||||
iamv1alpha2 "kubesphere.io/kubesphere/pkg/apis/iam/v1alpha2"
|
||||
networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
|
||||
servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2"
|
||||
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
|
||||
towerv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tower/v1alpha1"
|
||||
)
|
||||
|
||||
var scheme = runtime.NewScheme()
|
||||
var codecs = serializer.NewCodecFactory(scheme)
|
||||
var parameterCodec = runtime.NewParameterCodec(scheme)
|
||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
clusterv1alpha1.AddToScheme,
|
||||
devopsv1alpha1.AddToScheme,
|
||||
iamv1alpha2.AddToScheme,
|
||||
networkv1alpha1.AddToScheme,
|
||||
servicemeshv1alpha2.AddToScheme,
|
||||
tenantv1alpha1.AddToScheme,
|
||||
towerv1alpha1.AddToScheme,
|
||||
}
|
||||
|
||||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
||||
|
||||
@@ -24,24 +24,24 @@ import (
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
clusterv1alpha1 "kubesphere.io/kubesphere/pkg/apis/cluster/v1alpha1"
|
||||
devopsv1alpha1 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha1"
|
||||
iamv1alpha2 "kubesphere.io/kubesphere/pkg/apis/iam/v1alpha2"
|
||||
networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
|
||||
servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2"
|
||||
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
|
||||
towerv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tower/v1alpha1"
|
||||
)
|
||||
|
||||
var Scheme = runtime.NewScheme()
|
||||
var Codecs = serializer.NewCodecFactory(Scheme)
|
||||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
clusterv1alpha1.AddToScheme,
|
||||
devopsv1alpha1.AddToScheme,
|
||||
iamv1alpha2.AddToScheme,
|
||||
networkv1alpha1.AddToScheme,
|
||||
servicemeshv1alpha2.AddToScheme,
|
||||
tenantv1alpha1.AddToScheme,
|
||||
towerv1alpha1.AddToScheme,
|
||||
}
|
||||
|
||||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
||||
|
||||
@@ -25,14 +25,14 @@ import (
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
v1alpha1 "kubesphere.io/kubesphere/pkg/apis/tower/v1alpha1"
|
||||
v1alpha1 "kubesphere.io/kubesphere/pkg/apis/cluster/v1alpha1"
|
||||
scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme"
|
||||
)
|
||||
|
||||
// AgentsGetter has a method to return a AgentInterface.
|
||||
// A group's client should implement this interface.
|
||||
type AgentsGetter interface {
|
||||
Agents(namespace string) AgentInterface
|
||||
Agents() AgentInterface
|
||||
}
|
||||
|
||||
// AgentInterface has methods to work with Agent resources.
|
||||
@@ -52,14 +52,12 @@ type AgentInterface interface {
|
||||
// agents implements AgentInterface
|
||||
type agents struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newAgents returns a Agents
|
||||
func newAgents(c *TowerV1alpha1Client, namespace string) *agents {
|
||||
func newAgents(c *ClusterV1alpha1Client) *agents {
|
||||
return &agents{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +65,6 @@ func newAgents(c *TowerV1alpha1Client, namespace string) *agents {
|
||||
func (c *agents) Get(name string, options v1.GetOptions) (result *v1alpha1.Agent, err error) {
|
||||
result = &v1alpha1.Agent{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("agents").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
@@ -84,7 +81,6 @@ func (c *agents) List(opts v1.ListOptions) (result *v1alpha1.AgentList, err erro
|
||||
}
|
||||
result = &v1alpha1.AgentList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("agents").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
@@ -101,7 +97,6 @@ func (c *agents) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("agents").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
@@ -112,7 +107,6 @@ func (c *agents) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
func (c *agents) Create(agent *v1alpha1.Agent) (result *v1alpha1.Agent, err error) {
|
||||
result = &v1alpha1.Agent{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("agents").
|
||||
Body(agent).
|
||||
Do().
|
||||
@@ -124,7 +118,6 @@ func (c *agents) Create(agent *v1alpha1.Agent) (result *v1alpha1.Agent, err erro
|
||||
func (c *agents) Update(agent *v1alpha1.Agent) (result *v1alpha1.Agent, err error) {
|
||||
result = &v1alpha1.Agent{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("agents").
|
||||
Name(agent.Name).
|
||||
Body(agent).
|
||||
@@ -139,7 +132,6 @@ func (c *agents) Update(agent *v1alpha1.Agent) (result *v1alpha1.Agent, err erro
|
||||
func (c *agents) UpdateStatus(agent *v1alpha1.Agent) (result *v1alpha1.Agent, err error) {
|
||||
result = &v1alpha1.Agent{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("agents").
|
||||
Name(agent.Name).
|
||||
SubResource("status").
|
||||
@@ -152,7 +144,6 @@ func (c *agents) UpdateStatus(agent *v1alpha1.Agent) (result *v1alpha1.Agent, er
|
||||
// Delete takes name of the agent and deletes it. Returns an error if one occurs.
|
||||
func (c *agents) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("agents").
|
||||
Name(name).
|
||||
Body(options).
|
||||
@@ -167,7 +158,6 @@ func (c *agents) DeleteCollection(options *v1.DeleteOptions, listOptions v1.List
|
||||
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("agents").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
@@ -180,7 +170,6 @@ func (c *agents) DeleteCollection(options *v1.DeleteOptions, listOptions v1.List
|
||||
func (c *agents) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Agent, err error) {
|
||||
result = &v1alpha1.Agent{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("agents").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
180
pkg/client/clientset/versioned/typed/cluster/v1alpha1/cluster.go
Normal file
180
pkg/client/clientset/versioned/typed/cluster/v1alpha1/cluster.go
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
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 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/cluster/v1alpha1"
|
||||
scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme"
|
||||
)
|
||||
|
||||
// ClustersGetter has a method to return a ClusterInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ClustersGetter interface {
|
||||
Clusters() ClusterInterface
|
||||
}
|
||||
|
||||
// ClusterInterface has methods to work with Cluster resources.
|
||||
type ClusterInterface interface {
|
||||
Create(*v1alpha1.Cluster) (*v1alpha1.Cluster, error)
|
||||
Update(*v1alpha1.Cluster) (*v1alpha1.Cluster, error)
|
||||
UpdateStatus(*v1alpha1.Cluster) (*v1alpha1.Cluster, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string, options v1.GetOptions) (*v1alpha1.Cluster, error)
|
||||
List(opts v1.ListOptions) (*v1alpha1.ClusterList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error)
|
||||
ClusterExpansion
|
||||
}
|
||||
|
||||
// clusters implements ClusterInterface
|
||||
type clusters struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newClusters returns a Clusters
|
||||
func newClusters(c *ClusterV1alpha1Client) *clusters {
|
||||
return &clusters{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any.
|
||||
func (c *clusters) Get(name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) {
|
||||
result = &v1alpha1.Cluster{}
|
||||
err = c.client.Get().
|
||||
Resource("clusters").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Clusters that match those selectors.
|
||||
func (c *clusters) List(opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.ClusterList{}
|
||||
err = c.client.Get().
|
||||
Resource("clusters").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested clusters.
|
||||
func (c *clusters) 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("clusters").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any.
|
||||
func (c *clusters) Create(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
|
||||
result = &v1alpha1.Cluster{}
|
||||
err = c.client.Post().
|
||||
Resource("clusters").
|
||||
Body(cluster).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any.
|
||||
func (c *clusters) Update(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
|
||||
result = &v1alpha1.Cluster{}
|
||||
err = c.client.Put().
|
||||
Resource("clusters").
|
||||
Name(cluster.Name).
|
||||
Body(cluster).
|
||||
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 *clusters) UpdateStatus(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
|
||||
result = &v1alpha1.Cluster{}
|
||||
err = c.client.Put().
|
||||
Resource("clusters").
|
||||
Name(cluster.Name).
|
||||
SubResource("status").
|
||||
Body(cluster).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the cluster and deletes it. Returns an error if one occurs.
|
||||
func (c *clusters) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("clusters").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *clusters) 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("clusters").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched cluster.
|
||||
func (c *clusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error) {
|
||||
result = &v1alpha1.Cluster{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("clusters").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
@@ -20,26 +20,31 @@ package v1alpha1
|
||||
|
||||
import (
|
||||
rest "k8s.io/client-go/rest"
|
||||
v1alpha1 "kubesphere.io/kubesphere/pkg/apis/tower/v1alpha1"
|
||||
v1alpha1 "kubesphere.io/kubesphere/pkg/apis/cluster/v1alpha1"
|
||||
"kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme"
|
||||
)
|
||||
|
||||
type TowerV1alpha1Interface interface {
|
||||
type ClusterV1alpha1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
AgentsGetter
|
||||
ClustersGetter
|
||||
}
|
||||
|
||||
// TowerV1alpha1Client is used to interact with features provided by the tower.kubesphere.io group.
|
||||
type TowerV1alpha1Client struct {
|
||||
// ClusterV1alpha1Client is used to interact with features provided by the cluster.kubesphere.io group.
|
||||
type ClusterV1alpha1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *TowerV1alpha1Client) Agents(namespace string) AgentInterface {
|
||||
return newAgents(c, namespace)
|
||||
func (c *ClusterV1alpha1Client) Agents() AgentInterface {
|
||||
return newAgents(c)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new TowerV1alpha1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*TowerV1alpha1Client, error) {
|
||||
func (c *ClusterV1alpha1Client) Clusters() ClusterInterface {
|
||||
return newClusters(c)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new ClusterV1alpha1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*ClusterV1alpha1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
@@ -48,12 +53,12 @@ func NewForConfig(c *rest.Config) (*TowerV1alpha1Client, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &TowerV1alpha1Client{client}, nil
|
||||
return &ClusterV1alpha1Client{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new TowerV1alpha1Client for the given config and
|
||||
// NewForConfigOrDie creates a new ClusterV1alpha1Client for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *TowerV1alpha1Client {
|
||||
func NewForConfigOrDie(c *rest.Config) *ClusterV1alpha1Client {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -61,9 +66,9 @@ func NewForConfigOrDie(c *rest.Config) *TowerV1alpha1Client {
|
||||
return client
|
||||
}
|
||||
|
||||
// New creates a new TowerV1alpha1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *TowerV1alpha1Client {
|
||||
return &TowerV1alpha1Client{c}
|
||||
// New creates a new ClusterV1alpha1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *ClusterV1alpha1Client {
|
||||
return &ClusterV1alpha1Client{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
@@ -81,7 +86,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *TowerV1alpha1Client) RESTClient() rest.Interface {
|
||||
func (c *ClusterV1alpha1Client) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -25,24 +25,22 @@ import (
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
v1alpha1 "kubesphere.io/kubesphere/pkg/apis/tower/v1alpha1"
|
||||
v1alpha1 "kubesphere.io/kubesphere/pkg/apis/cluster/v1alpha1"
|
||||
)
|
||||
|
||||
// FakeAgents implements AgentInterface
|
||||
type FakeAgents struct {
|
||||
Fake *FakeTowerV1alpha1
|
||||
ns string
|
||||
Fake *FakeClusterV1alpha1
|
||||
}
|
||||
|
||||
var agentsResource = schema.GroupVersionResource{Group: "tower.kubesphere.io", Version: "v1alpha1", Resource: "agents"}
|
||||
var agentsResource = schema.GroupVersionResource{Group: "cluster.kubesphere.io", Version: "v1alpha1", Resource: "agents"}
|
||||
|
||||
var agentsKind = schema.GroupVersionKind{Group: "tower.kubesphere.io", Version: "v1alpha1", Kind: "Agent"}
|
||||
var agentsKind = schema.GroupVersionKind{Group: "cluster.kubesphere.io", Version: "v1alpha1", Kind: "Agent"}
|
||||
|
||||
// Get takes name of the agent, and returns the corresponding agent object, and an error if there is any.
|
||||
func (c *FakeAgents) Get(name string, options v1.GetOptions) (result *v1alpha1.Agent, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(agentsResource, c.ns, name), &v1alpha1.Agent{})
|
||||
|
||||
Invokes(testing.NewRootGetAction(agentsResource, name), &v1alpha1.Agent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -52,8 +50,7 @@ func (c *FakeAgents) Get(name string, options v1.GetOptions) (result *v1alpha1.A
|
||||
// List takes label and field selectors, and returns the list of Agents that match those selectors.
|
||||
func (c *FakeAgents) List(opts v1.ListOptions) (result *v1alpha1.AgentList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(agentsResource, agentsKind, c.ns, opts), &v1alpha1.AgentList{})
|
||||
|
||||
Invokes(testing.NewRootListAction(agentsResource, agentsKind, opts), &v1alpha1.AgentList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -74,15 +71,13 @@ func (c *FakeAgents) List(opts v1.ListOptions) (result *v1alpha1.AgentList, err
|
||||
// Watch returns a watch.Interface that watches the requested agents.
|
||||
func (c *FakeAgents) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(agentsResource, c.ns, opts))
|
||||
|
||||
InvokesWatch(testing.NewRootWatchAction(agentsResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a agent and creates it. Returns the server's representation of the agent, and an error, if there is any.
|
||||
func (c *FakeAgents) Create(agent *v1alpha1.Agent) (result *v1alpha1.Agent, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(agentsResource, c.ns, agent), &v1alpha1.Agent{})
|
||||
|
||||
Invokes(testing.NewRootCreateAction(agentsResource, agent), &v1alpha1.Agent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -92,8 +87,7 @@ func (c *FakeAgents) Create(agent *v1alpha1.Agent) (result *v1alpha1.Agent, err
|
||||
// Update takes the representation of a agent and updates it. Returns the server's representation of the agent, and an error, if there is any.
|
||||
func (c *FakeAgents) Update(agent *v1alpha1.Agent) (result *v1alpha1.Agent, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(agentsResource, c.ns, agent), &v1alpha1.Agent{})
|
||||
|
||||
Invokes(testing.NewRootUpdateAction(agentsResource, agent), &v1alpha1.Agent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -104,8 +98,7 @@ func (c *FakeAgents) Update(agent *v1alpha1.Agent) (result *v1alpha1.Agent, err
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeAgents) UpdateStatus(agent *v1alpha1.Agent) (*v1alpha1.Agent, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(agentsResource, "status", c.ns, agent), &v1alpha1.Agent{})
|
||||
|
||||
Invokes(testing.NewRootUpdateSubresourceAction(agentsResource, "status", agent), &v1alpha1.Agent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -115,14 +108,13 @@ func (c *FakeAgents) UpdateStatus(agent *v1alpha1.Agent) (*v1alpha1.Agent, error
|
||||
// Delete takes name of the agent and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeAgents) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(agentsResource, c.ns, name), &v1alpha1.Agent{})
|
||||
|
||||
Invokes(testing.NewRootDeleteAction(agentsResource, name), &v1alpha1.Agent{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeAgents) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(agentsResource, c.ns, listOptions)
|
||||
action := testing.NewRootDeleteCollectionAction(agentsResource, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.AgentList{})
|
||||
return err
|
||||
@@ -131,8 +123,7 @@ func (c *FakeAgents) DeleteCollection(options *v1.DeleteOptions, listOptions v1.
|
||||
// Patch applies the patch and returns the patched agent.
|
||||
func (c *FakeAgents) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Agent, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(agentsResource, c.ns, name, pt, data, subresources...), &v1alpha1.Agent{})
|
||||
|
||||
Invokes(testing.NewRootPatchSubresourceAction(agentsResource, name, pt, data, subresources...), &v1alpha1.Agent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
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"
|
||||
v1alpha1 "kubesphere.io/kubesphere/pkg/apis/cluster/v1alpha1"
|
||||
)
|
||||
|
||||
// FakeClusters implements ClusterInterface
|
||||
type FakeClusters struct {
|
||||
Fake *FakeClusterV1alpha1
|
||||
}
|
||||
|
||||
var clustersResource = schema.GroupVersionResource{Group: "cluster.kubesphere.io", Version: "v1alpha1", Resource: "clusters"}
|
||||
|
||||
var clustersKind = schema.GroupVersionKind{Group: "cluster.kubesphere.io", Version: "v1alpha1", Kind: "Cluster"}
|
||||
|
||||
// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any.
|
||||
func (c *FakeClusters) Get(name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(clustersResource, name), &v1alpha1.Cluster{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Cluster), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Clusters that match those selectors.
|
||||
func (c *FakeClusters) List(opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(clustersResource, clustersKind, opts), &v1alpha1.ClusterList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.ClusterList{ListMeta: obj.(*v1alpha1.ClusterList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.ClusterList).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 clusters.
|
||||
func (c *FakeClusters) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(clustersResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any.
|
||||
func (c *FakeClusters) Create(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(clustersResource, cluster), &v1alpha1.Cluster{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Cluster), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any.
|
||||
func (c *FakeClusters) Update(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(clustersResource, cluster), &v1alpha1.Cluster{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Cluster), 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 *FakeClusters) UpdateStatus(cluster *v1alpha1.Cluster) (*v1alpha1.Cluster, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateSubresourceAction(clustersResource, "status", cluster), &v1alpha1.Cluster{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Cluster), err
|
||||
}
|
||||
|
||||
// Delete takes name of the cluster and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeClusters) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteAction(clustersResource, name), &v1alpha1.Cluster{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeClusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(clustersResource, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched cluster.
|
||||
func (c *FakeClusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(clustersResource, name, pt, data, subresources...), &v1alpha1.Cluster{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Cluster), err
|
||||
}
|
||||
@@ -21,20 +21,24 @@ package fake
|
||||
import (
|
||||
rest "k8s.io/client-go/rest"
|
||||
testing "k8s.io/client-go/testing"
|
||||
v1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tower/v1alpha1"
|
||||
v1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/cluster/v1alpha1"
|
||||
)
|
||||
|
||||
type FakeTowerV1alpha1 struct {
|
||||
type FakeClusterV1alpha1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeTowerV1alpha1) Agents(namespace string) v1alpha1.AgentInterface {
|
||||
return &FakeAgents{c, namespace}
|
||||
func (c *FakeClusterV1alpha1) Agents() v1alpha1.AgentInterface {
|
||||
return &FakeAgents{c}
|
||||
}
|
||||
|
||||
func (c *FakeClusterV1alpha1) Clusters() v1alpha1.ClusterInterface {
|
||||
return &FakeClusters{c}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeTowerV1alpha1) RESTClient() rest.Interface {
|
||||
func (c *FakeClusterV1alpha1) RESTClient() rest.Interface {
|
||||
var ret *rest.RESTClient
|
||||
return ret
|
||||
}
|
||||
@@ -19,3 +19,5 @@ limitations under the License.
|
||||
package v1alpha1
|
||||
|
||||
type AgentExpansion interface{}
|
||||
|
||||
type ClusterExpansion interface{}
|
||||
Reference in New Issue
Block a user