diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index ab694436a..958f7fd7e 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -26,6 +26,7 @@ import ( miniov1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/minio.rook.io/v1alpha1" nfsv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/nfs.rook.io/v1alpha1" rookv1alpha2 "github.com/rook/rook/pkg/client/clientset/versioned/typed/rook.io/v1alpha2" + yugabytedbv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -40,6 +41,7 @@ type Interface interface { MinioV1alpha1() miniov1alpha1.MinioV1alpha1Interface NfsV1alpha1() nfsv1alpha1.NfsV1alpha1Interface RookV1alpha2() rookv1alpha2.RookV1alpha2Interface + YugabytedbV1alpha1() yugabytedbv1alpha1.YugabytedbV1alpha1Interface } // Clientset contains the clients for groups. Each group has exactly one @@ -53,6 +55,7 @@ type Clientset struct { minioV1alpha1 *miniov1alpha1.MinioV1alpha1Client nfsV1alpha1 *nfsv1alpha1.NfsV1alpha1Client rookV1alpha2 *rookv1alpha2.RookV1alpha2Client + yugabytedbV1alpha1 *yugabytedbv1alpha1.YugabytedbV1alpha1Client } // CassandraV1alpha1 retrieves the CassandraV1alpha1Client @@ -90,6 +93,11 @@ func (c *Clientset) RookV1alpha2() rookv1alpha2.RookV1alpha2Interface { return c.rookV1alpha2 } +// YugabytedbV1alpha1 retrieves the YugabytedbV1alpha1Client +func (c *Clientset) YugabytedbV1alpha1() yugabytedbv1alpha1.YugabytedbV1alpha1Interface { + return c.yugabytedbV1alpha1 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -134,6 +142,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } + cs.yugabytedbV1alpha1, err = yugabytedbv1alpha1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) if err != nil { @@ -153,6 +165,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { cs.minioV1alpha1 = miniov1alpha1.NewForConfigOrDie(c) cs.nfsV1alpha1 = nfsv1alpha1.NewForConfigOrDie(c) cs.rookV1alpha2 = rookv1alpha2.NewForConfigOrDie(c) + cs.yugabytedbV1alpha1 = yugabytedbv1alpha1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -168,6 +181,7 @@ func New(c rest.Interface) *Clientset { cs.minioV1alpha1 = miniov1alpha1.New(c) cs.nfsV1alpha1 = nfsv1alpha1.New(c) cs.rookV1alpha2 = rookv1alpha2.New(c) + cs.yugabytedbV1alpha1 = yugabytedbv1alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 9485e6329..a807c0bdb 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -34,6 +34,8 @@ import ( fakenfsv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/nfs.rook.io/v1alpha1/fake" rookv1alpha2 "github.com/rook/rook/pkg/client/clientset/versioned/typed/rook.io/v1alpha2" fakerookv1alpha2 "github.com/rook/rook/pkg/client/clientset/versioned/typed/rook.io/v1alpha2/fake" + yugabytedbv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1" + fakeyugabytedbv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -117,3 +119,8 @@ func (c *Clientset) NfsV1alpha1() nfsv1alpha1.NfsV1alpha1Interface { func (c *Clientset) RookV1alpha2() rookv1alpha2.RookV1alpha2Interface { return &fakerookv1alpha2.FakeRookV1alpha2{Fake: &c.Fake} } + +// YugabytedbV1alpha1 retrieves the YugabytedbV1alpha1Client +func (c *Clientset) YugabytedbV1alpha1() yugabytedbv1alpha1.YugabytedbV1alpha1Interface { + return &fakeyugabytedbv1alpha1.FakeYugabytedbV1alpha1{Fake: &c.Fake} +} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 55fe6aebb..d3e948649 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -26,6 +26,7 @@ import ( miniov1alpha1 "github.com/rook/rook/pkg/apis/minio.rook.io/v1alpha1" nfsv1alpha1 "github.com/rook/rook/pkg/apis/nfs.rook.io/v1alpha1" rookv1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + yugabytedbv1alpha1 "github.com/rook/rook/pkg/apis/yugabytedb.rook.io/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -44,6 +45,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ miniov1alpha1.AddToScheme, nfsv1alpha1.AddToScheme, rookv1alpha2.AddToScheme, + yugabytedbv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index c82a44ef6..5d800eef3 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -26,6 +26,7 @@ import ( miniov1alpha1 "github.com/rook/rook/pkg/apis/minio.rook.io/v1alpha1" nfsv1alpha1 "github.com/rook/rook/pkg/apis/nfs.rook.io/v1alpha1" rookv1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + yugabytedbv1alpha1 "github.com/rook/rook/pkg/apis/yugabytedb.rook.io/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -44,6 +45,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ miniov1alpha1.AddToScheme, nfsv1alpha1.AddToScheme, rookv1alpha2.AddToScheme, + yugabytedbv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/doc.go new file mode 100644 index 000000000..df51baa4d --- /dev/null +++ b/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes 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 v1alpha1 diff --git a/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/fake/doc.go new file mode 100644 index 000000000..16f443990 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes 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 diff --git a/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/fake/fake_ybcluster.go b/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/fake/fake_ybcluster.go new file mode 100644 index 000000000..1db69e4b2 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/fake/fake_ybcluster.go @@ -0,0 +1,128 @@ +/* +Copyright The Kubernetes 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 ( + v1alpha1 "github.com/rook/rook/pkg/apis/yugabytedb.rook.io/v1alpha1" + 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" +) + +// FakeYBClusters implements YBClusterInterface +type FakeYBClusters struct { + Fake *FakeYugabytedbV1alpha1 + ns string +} + +var ybclustersResource = schema.GroupVersionResource{Group: "yugabytedb.rook.io", Version: "v1alpha1", Resource: "ybclusters"} + +var ybclustersKind = schema.GroupVersionKind{Group: "yugabytedb.rook.io", Version: "v1alpha1", Kind: "YBCluster"} + +// Get takes name of the yBCluster, and returns the corresponding yBCluster object, and an error if there is any. +func (c *FakeYBClusters) Get(name string, options v1.GetOptions) (result *v1alpha1.YBCluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(ybclustersResource, c.ns, name), &v1alpha1.YBCluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.YBCluster), err +} + +// List takes label and field selectors, and returns the list of YBClusters that match those selectors. +func (c *FakeYBClusters) List(opts v1.ListOptions) (result *v1alpha1.YBClusterList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(ybclustersResource, ybclustersKind, c.ns, opts), &v1alpha1.YBClusterList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.YBClusterList{ListMeta: obj.(*v1alpha1.YBClusterList).ListMeta} + for _, item := range obj.(*v1alpha1.YBClusterList).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 yBClusters. +func (c *FakeYBClusters) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(ybclustersResource, c.ns, opts)) + +} + +// Create takes the representation of a yBCluster and creates it. Returns the server's representation of the yBCluster, and an error, if there is any. +func (c *FakeYBClusters) Create(yBCluster *v1alpha1.YBCluster) (result *v1alpha1.YBCluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(ybclustersResource, c.ns, yBCluster), &v1alpha1.YBCluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.YBCluster), err +} + +// Update takes the representation of a yBCluster and updates it. Returns the server's representation of the yBCluster, and an error, if there is any. +func (c *FakeYBClusters) Update(yBCluster *v1alpha1.YBCluster) (result *v1alpha1.YBCluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(ybclustersResource, c.ns, yBCluster), &v1alpha1.YBCluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.YBCluster), err +} + +// Delete takes name of the yBCluster and deletes it. Returns an error if one occurs. +func (c *FakeYBClusters) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(ybclustersResource, c.ns, name), &v1alpha1.YBCluster{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeYBClusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(ybclustersResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.YBClusterList{}) + return err +} + +// Patch applies the patch and returns the patched yBCluster. +func (c *FakeYBClusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.YBCluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(ybclustersResource, c.ns, name, pt, data, subresources...), &v1alpha1.YBCluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.YBCluster), err +} diff --git a/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/fake/fake_yugabytedb.rook.io_client.go b/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/fake/fake_yugabytedb.rook.io_client.go new file mode 100644 index 000000000..e29e6c29f --- /dev/null +++ b/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/fake/fake_yugabytedb.rook.io_client.go @@ -0,0 +1,40 @@ +/* +Copyright The Kubernetes 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 ( + v1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeYugabytedbV1alpha1 struct { + *testing.Fake +} + +func (c *FakeYugabytedbV1alpha1) YBClusters(namespace string) v1alpha1.YBClusterInterface { + return &FakeYBClusters{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeYugabytedbV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/generated_expansion.go new file mode 100644 index 000000000..861e36933 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/generated_expansion.go @@ -0,0 +1,21 @@ +/* +Copyright The Kubernetes 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 + +type YBClusterExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/ybcluster.go b/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/ybcluster.go new file mode 100644 index 000000000..c0bc415f0 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/ybcluster.go @@ -0,0 +1,174 @@ +/* +Copyright The Kubernetes 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" + + v1alpha1 "github.com/rook/rook/pkg/apis/yugabytedb.rook.io/v1alpha1" + scheme "github.com/rook/rook/pkg/client/clientset/versioned/scheme" + 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" +) + +// YBClustersGetter has a method to return a YBClusterInterface. +// A group's client should implement this interface. +type YBClustersGetter interface { + YBClusters(namespace string) YBClusterInterface +} + +// YBClusterInterface has methods to work with YBCluster resources. +type YBClusterInterface interface { + Create(*v1alpha1.YBCluster) (*v1alpha1.YBCluster, error) + Update(*v1alpha1.YBCluster) (*v1alpha1.YBCluster, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.YBCluster, error) + List(opts v1.ListOptions) (*v1alpha1.YBClusterList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.YBCluster, err error) + YBClusterExpansion +} + +// yBClusters implements YBClusterInterface +type yBClusters struct { + client rest.Interface + ns string +} + +// newYBClusters returns a YBClusters +func newYBClusters(c *YugabytedbV1alpha1Client, namespace string) *yBClusters { + return &yBClusters{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the yBCluster, and returns the corresponding yBCluster object, and an error if there is any. +func (c *yBClusters) Get(name string, options v1.GetOptions) (result *v1alpha1.YBCluster, err error) { + result = &v1alpha1.YBCluster{} + err = c.client.Get(). + Namespace(c.ns). + Resource("ybclusters"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of YBClusters that match those selectors. +func (c *yBClusters) List(opts v1.ListOptions) (result *v1alpha1.YBClusterList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.YBClusterList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("ybclusters"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested yBClusters. +func (c *yBClusters) 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(). + Namespace(c.ns). + Resource("ybclusters"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a yBCluster and creates it. Returns the server's representation of the yBCluster, and an error, if there is any. +func (c *yBClusters) Create(yBCluster *v1alpha1.YBCluster) (result *v1alpha1.YBCluster, err error) { + result = &v1alpha1.YBCluster{} + err = c.client.Post(). + Namespace(c.ns). + Resource("ybclusters"). + Body(yBCluster). + Do(). + Into(result) + return +} + +// Update takes the representation of a yBCluster and updates it. Returns the server's representation of the yBCluster, and an error, if there is any. +func (c *yBClusters) Update(yBCluster *v1alpha1.YBCluster) (result *v1alpha1.YBCluster, err error) { + result = &v1alpha1.YBCluster{} + err = c.client.Put(). + Namespace(c.ns). + Resource("ybclusters"). + Name(yBCluster.Name). + Body(yBCluster). + Do(). + Into(result) + return +} + +// Delete takes name of the yBCluster and deletes it. Returns an error if one occurs. +func (c *yBClusters) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("ybclusters"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *yBClusters) 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(). + Namespace(c.ns). + Resource("ybclusters"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched yBCluster. +func (c *yBClusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.YBCluster, err error) { + result = &v1alpha1.YBCluster{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("ybclusters"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/yugabytedb.rook.io_client.go b/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/yugabytedb.rook.io_client.go new file mode 100644 index 000000000..19573ad4f --- /dev/null +++ b/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1/yugabytedb.rook.io_client.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes 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 ( + v1alpha1 "github.com/rook/rook/pkg/apis/yugabytedb.rook.io/v1alpha1" + "github.com/rook/rook/pkg/client/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type YugabytedbV1alpha1Interface interface { + RESTClient() rest.Interface + YBClustersGetter +} + +// YugabytedbV1alpha1Client is used to interact with features provided by the yugabytedb.rook.io group. +type YugabytedbV1alpha1Client struct { + restClient rest.Interface +} + +func (c *YugabytedbV1alpha1Client) YBClusters(namespace string) YBClusterInterface { + return newYBClusters(c, namespace) +} + +// NewForConfig creates a new YugabytedbV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*YugabytedbV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &YugabytedbV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new YugabytedbV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *YugabytedbV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new YugabytedbV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *YugabytedbV1alpha1Client { + return &YugabytedbV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + 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 *YugabytedbV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index 680c111f1..8154965c8 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -32,6 +32,7 @@ import ( miniorookio "github.com/rook/rook/pkg/client/informers/externalversions/minio.rook.io" nfsrookio "github.com/rook/rook/pkg/client/informers/externalversions/nfs.rook.io" rookio "github.com/rook/rook/pkg/client/informers/externalversions/rook.io" + yugabytedbrookio "github.com/rook/rook/pkg/client/informers/externalversions/yugabytedb.rook.io" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -185,6 +186,7 @@ type SharedInformerFactory interface { Minio() miniorookio.Interface Nfs() nfsrookio.Interface Rook() rookio.Interface + Yugabytedb() yugabytedbrookio.Interface } func (f *sharedInformerFactory) Cassandra() cassandrarookio.Interface { @@ -214,3 +216,7 @@ func (f *sharedInformerFactory) Nfs() nfsrookio.Interface { func (f *sharedInformerFactory) Rook() rookio.Interface { return rookio.New(f, f.namespace, f.tweakListOptions) } + +func (f *sharedInformerFactory) Yugabytedb() yugabytedbrookio.Interface { + return yugabytedbrookio.New(f, f.namespace, f.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 5417fa012..8446b0995 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -28,6 +28,7 @@ import ( miniorookiov1alpha1 "github.com/rook/rook/pkg/apis/minio.rook.io/v1alpha1" nfsrookiov1alpha1 "github.com/rook/rook/pkg/apis/nfs.rook.io/v1alpha1" v1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + yugabytedbrookiov1alpha1 "github.com/rook/rook/pkg/apis/yugabytedb.rook.io/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -108,6 +109,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1alpha2.SchemeGroupVersion.WithResource("volumes"): return &genericInformer{resource: resource.GroupResource(), informer: f.Rook().V1alpha2().Volumes().Informer()}, nil + // Group=yugabytedb.rook.io, Version=v1alpha1 + case yugabytedbrookiov1alpha1.SchemeGroupVersion.WithResource("ybclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Yugabytedb().V1alpha1().YBClusters().Informer()}, nil + } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/pkg/client/informers/externalversions/yugabytedb.rook.io/interface.go b/pkg/client/informers/externalversions/yugabytedb.rook.io/interface.go new file mode 100644 index 000000000..2425aa9cb --- /dev/null +++ b/pkg/client/informers/externalversions/yugabytedb.rook.io/interface.go @@ -0,0 +1,46 @@ +/* +Copyright The Kubernetes 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 yugabytedb + +import ( + internalinterfaces "github.com/rook/rook/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/rook/rook/pkg/client/informers/externalversions/yugabytedb.rook.io/v1alpha1" +) + +// 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 +} + +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} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/yugabytedb.rook.io/v1alpha1/interface.go b/pkg/client/informers/externalversions/yugabytedb.rook.io/v1alpha1/interface.go new file mode 100644 index 000000000..0674e9f20 --- /dev/null +++ b/pkg/client/informers/externalversions/yugabytedb.rook.io/v1alpha1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "github.com/rook/rook/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // YBClusters returns a YBClusterInformer. + YBClusters() YBClusterInformer +} + +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} +} + +// YBClusters returns a YBClusterInformer. +func (v *version) YBClusters() YBClusterInformer { + return &yBClusterInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/yugabytedb.rook.io/v1alpha1/ybcluster.go b/pkg/client/informers/externalversions/yugabytedb.rook.io/v1alpha1/ybcluster.go new file mode 100644 index 000000000..382242f5b --- /dev/null +++ b/pkg/client/informers/externalversions/yugabytedb.rook.io/v1alpha1/ybcluster.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + yugabytedbrookiov1alpha1 "github.com/rook/rook/pkg/apis/yugabytedb.rook.io/v1alpha1" + versioned "github.com/rook/rook/pkg/client/clientset/versioned" + internalinterfaces "github.com/rook/rook/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/rook/rook/pkg/client/listers/yugabytedb.rook.io/v1alpha1" + 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" +) + +// YBClusterInformer provides access to a shared informer and lister for +// YBClusters. +type YBClusterInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.YBClusterLister +} + +type yBClusterInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewYBClusterInformer constructs a new informer for YBCluster 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 NewYBClusterInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredYBClusterInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredYBClusterInformer constructs a new informer for YBCluster 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 NewFilteredYBClusterInformer(client versioned.Interface, namespace string, 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.YugabytedbV1alpha1().YBClusters(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.YugabytedbV1alpha1().YBClusters(namespace).Watch(options) + }, + }, + &yugabytedbrookiov1alpha1.YBCluster{}, + resyncPeriod, + indexers, + ) +} + +func (f *yBClusterInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredYBClusterInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *yBClusterInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&yugabytedbrookiov1alpha1.YBCluster{}, f.defaultInformer) +} + +func (f *yBClusterInformer) Lister() v1alpha1.YBClusterLister { + return v1alpha1.NewYBClusterLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/listers/yugabytedb.rook.io/v1alpha1/expansion_generated.go b/pkg/client/listers/yugabytedb.rook.io/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..b36b9de69 --- /dev/null +++ b/pkg/client/listers/yugabytedb.rook.io/v1alpha1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// YBClusterListerExpansion allows custom methods to be added to +// YBClusterLister. +type YBClusterListerExpansion interface{} + +// YBClusterNamespaceListerExpansion allows custom methods to be added to +// YBClusterNamespaceLister. +type YBClusterNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/yugabytedb.rook.io/v1alpha1/ybcluster.go b/pkg/client/listers/yugabytedb.rook.io/v1alpha1/ybcluster.go new file mode 100644 index 000000000..0db53d0df --- /dev/null +++ b/pkg/client/listers/yugabytedb.rook.io/v1alpha1/ybcluster.go @@ -0,0 +1,94 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/rook/rook/pkg/apis/yugabytedb.rook.io/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// YBClusterLister helps list YBClusters. +type YBClusterLister interface { + // List lists all YBClusters in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.YBCluster, err error) + // YBClusters returns an object that can list and get YBClusters. + YBClusters(namespace string) YBClusterNamespaceLister + YBClusterListerExpansion +} + +// yBClusterLister implements the YBClusterLister interface. +type yBClusterLister struct { + indexer cache.Indexer +} + +// NewYBClusterLister returns a new YBClusterLister. +func NewYBClusterLister(indexer cache.Indexer) YBClusterLister { + return &yBClusterLister{indexer: indexer} +} + +// List lists all YBClusters in the indexer. +func (s *yBClusterLister) List(selector labels.Selector) (ret []*v1alpha1.YBCluster, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.YBCluster)) + }) + return ret, err +} + +// YBClusters returns an object that can list and get YBClusters. +func (s *yBClusterLister) YBClusters(namespace string) YBClusterNamespaceLister { + return yBClusterNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// YBClusterNamespaceLister helps list and get YBClusters. +type YBClusterNamespaceLister interface { + // List lists all YBClusters in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.YBCluster, err error) + // Get retrieves the YBCluster from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.YBCluster, error) + YBClusterNamespaceListerExpansion +} + +// yBClusterNamespaceLister implements the YBClusterNamespaceLister +// interface. +type yBClusterNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all YBClusters in the indexer for a given namespace. +func (s yBClusterNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.YBCluster, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.YBCluster)) + }) + return ret, err +} + +// Get retrieves the YBCluster from the indexer for a given namespace and name. +func (s yBClusterNamespaceLister) Get(name string) (*v1alpha1.YBCluster, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("ybcluster"), name) + } + return obj.(*v1alpha1.YBCluster), nil +}