diff --git a/build/codegen/codegen.sh b/build/codegen/codegen.sh index 2468e06fd..9c423075b 100755 --- a/build/codegen/codegen.sh +++ b/build/codegen/codegen.sh @@ -23,7 +23,7 @@ cd "${scriptdir}/../../vendor/k8s.io/code-generator" && ./generate-groups.sh \ all \ github.com/rook/rook/pkg/client \ github.com/rook/rook/pkg/apis \ - "rook.io:v1alpha1,v1alpha2 ceph.rook.io:v1alpha1,v1beta1 cockroachdb.rook.io:v1alpha1 minio.rook.io:v1alpha1 nfs.rook.io:v1alpha1" + "rook.io:v1alpha1,v1alpha2 ceph.rook.io:v1alpha1,v1beta1 cockroachdb.rook.io:v1alpha1 minio.rook.io:v1alpha1 nfs.rook.io:v1alpha1 cassandra.rook.io:v1alpha1" # this seems busted in the release-1.8 branch # --go-header-file ${SCRIPT_ROOT}/build/codegen/header.txt diff --git a/pkg/apis/cassandra.rook.io/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/cassandra.rook.io/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000..f3aadb630 --- /dev/null +++ b/pkg/apis/cassandra.rook.io/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,228 @@ +// +build !ignore_autogenerated + +/* +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 deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Cluster) DeepCopyInto(out *Cluster) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster. +func (in *Cluster) DeepCopy() *Cluster { + if in == nil { + return nil + } + out := new(Cluster) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Cluster) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterList) DeepCopyInto(out *ClusterList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Cluster, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterList. +func (in *ClusterList) DeepCopy() *ClusterList { + if in == nil { + return nil + } + out := new(ClusterList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) { + *out = *in + if in.Repository != nil { + in, out := &in.Repository, &out.Repository + *out = new(string) + **out = **in + } + in.Datacenter.DeepCopyInto(&out.Datacenter) + if in.SidecarImage != nil { + in, out := &in.SidecarImage, &out.SidecarImage + *out = new(ImageSpec) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSpec. +func (in *ClusterSpec) DeepCopy() *ClusterSpec { + if in == nil { + return nil + } + out := new(ClusterSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) { + *out = *in + if in.Racks != nil { + in, out := &in.Racks, &out.Racks + *out = make(map[string]*RackStatus, len(*in)) + for key, val := range *in { + var outVal *RackStatus + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(RackStatus) + **out = **in + } + (*out)[key] = outVal + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus. +func (in *ClusterStatus) DeepCopy() *ClusterStatus { + if in == nil { + return nil + } + out := new(ClusterStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatacenterSpec) DeepCopyInto(out *DatacenterSpec) { + *out = *in + if in.Racks != nil { + in, out := &in.Racks, &out.Racks + *out = make([]RackSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatacenterSpec. +func (in *DatacenterSpec) DeepCopy() *DatacenterSpec { + if in == nil { + return nil + } + out := new(DatacenterSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageSpec) DeepCopyInto(out *ImageSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageSpec. +func (in *ImageSpec) DeepCopy() *ImageSpec { + if in == nil { + return nil + } + out := new(ImageSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RackSpec) DeepCopyInto(out *RackSpec) { + *out = *in + if in.ConfigMapName != nil { + in, out := &in.ConfigMapName, &out.ConfigMapName + *out = new(string) + **out = **in + } + in.Storage.DeepCopyInto(&out.Storage) + if in.Placement != nil { + in, out := &in.Placement, &out.Placement + *out = new(v1alpha2.Placement) + (*in).DeepCopyInto(*out) + } + in.Resources.DeepCopyInto(&out.Resources) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RackSpec. +func (in *RackSpec) DeepCopy() *RackSpec { + if in == nil { + return nil + } + out := new(RackSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RackStatus) DeepCopyInto(out *RackStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RackStatus. +func (in *RackStatus) DeepCopy() *RackStatus { + if in == nil { + return nil + } + out := new(RackStatus) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/rook.io/v1alpha2/zz_generated.deepcopy.go b/pkg/apis/rook.io/v1alpha2/zz_generated.deepcopy.go index 2efb4fc43..9161f6a82 100644 --- a/pkg/apis/rook.io/v1alpha2/zz_generated.deepcopy.go +++ b/pkg/apis/rook.io/v1alpha2/zz_generated.deepcopy.go @@ -283,6 +283,13 @@ func (in *Selection) DeepCopyInto(out *Selection) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.VolumeClaimTemplates != nil { + in, out := &in.VolumeClaimTemplates, &out.VolumeClaimTemplates + *out = make([]v1.PersistentVolumeClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 7a5a61e66..46738c9ec 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -19,6 +19,7 @@ limitations under the License. package versioned import ( + cassandrav1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1" cephv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/ceph.rook.io/v1alpha1" cephv1beta1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/ceph.rook.io/v1beta1" cockroachdbv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/cockroachdb.rook.io/v1alpha1" @@ -33,6 +34,9 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface + CassandraV1alpha1() cassandrav1alpha1.CassandraV1alpha1Interface + // Deprecated: please explicitly pick a version if possible. + Cassandra() cassandrav1alpha1.CassandraV1alpha1Interface CephV1alpha1() cephv1alpha1.CephV1alpha1Interface CephV1beta1() cephv1beta1.CephV1beta1Interface // Deprecated: please explicitly pick a version if possible. @@ -56,6 +60,7 @@ type Interface interface { // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient + cassandraV1alpha1 *cassandrav1alpha1.CassandraV1alpha1Client cephV1alpha1 *cephv1alpha1.CephV1alpha1Client cephV1beta1 *cephv1beta1.CephV1beta1Client cockroachdbV1alpha1 *cockroachdbv1alpha1.CockroachdbV1alpha1Client @@ -65,6 +70,17 @@ type Clientset struct { rookV1alpha2 *rookv1alpha2.RookV1alpha2Client } +// CassandraV1alpha1 retrieves the CassandraV1alpha1Client +func (c *Clientset) CassandraV1alpha1() cassandrav1alpha1.CassandraV1alpha1Interface { + return c.cassandraV1alpha1 +} + +// Deprecated: Cassandra retrieves the default version of CassandraClient. +// Please explicitly pick a version. +func (c *Clientset) Cassandra() cassandrav1alpha1.CassandraV1alpha1Interface { + return c.cassandraV1alpha1 +} + // CephV1alpha1 retrieves the CephV1alpha1Client func (c *Clientset) CephV1alpha1() cephv1alpha1.CephV1alpha1Interface { return c.cephV1alpha1 @@ -146,6 +162,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { } var cs Clientset var err error + cs.cassandraV1alpha1, err = cassandrav1alpha1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.cephV1alpha1, err = cephv1alpha1.NewForConfig(&configShallowCopy) if err != nil { return nil, err @@ -186,6 +206,7 @@ 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.cassandraV1alpha1 = cassandrav1alpha1.NewForConfigOrDie(c) cs.cephV1alpha1 = cephv1alpha1.NewForConfigOrDie(c) cs.cephV1beta1 = cephv1beta1.NewForConfigOrDie(c) cs.cockroachdbV1alpha1 = cockroachdbv1alpha1.NewForConfigOrDie(c) @@ -201,6 +222,7 @@ 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.cassandraV1alpha1 = cassandrav1alpha1.New(c) cs.cephV1alpha1 = cephv1alpha1.New(c) cs.cephV1beta1 = cephv1beta1.New(c) cs.cockroachdbV1alpha1 = cockroachdbv1alpha1.New(c) diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index f9c0e359a..cf787a2be 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -20,6 +20,8 @@ package fake import ( clientset "github.com/rook/rook/pkg/client/clientset/versioned" + cassandrav1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1" + fakecassandrav1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/fake" cephv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/ceph.rook.io/v1alpha1" fakecephv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/ceph.rook.io/v1alpha1/fake" cephv1beta1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/ceph.rook.io/v1beta1" @@ -83,6 +85,16 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface { var _ clientset.Interface = &Clientset{} +// CassandraV1alpha1 retrieves the CassandraV1alpha1Client +func (c *Clientset) CassandraV1alpha1() cassandrav1alpha1.CassandraV1alpha1Interface { + return &fakecassandrav1alpha1.FakeCassandraV1alpha1{Fake: &c.Fake} +} + +// Cassandra retrieves the CassandraV1alpha1Client +func (c *Clientset) Cassandra() cassandrav1alpha1.CassandraV1alpha1Interface { + return &fakecassandrav1alpha1.FakeCassandraV1alpha1{Fake: &c.Fake} +} + // CephV1alpha1 retrieves the CephV1alpha1Client func (c *Clientset) CephV1alpha1() cephv1alpha1.CephV1alpha1Interface { return &fakecephv1alpha1.FakeCephV1alpha1{Fake: &c.Fake} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index d413ddf7b..d0de7bb4f 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -19,6 +19,7 @@ limitations under the License. package fake import ( + cassandrav1alpha1 "github.com/rook/rook/pkg/apis/cassandra.rook.io/v1alpha1" cephv1alpha1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1alpha1" cephv1beta1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1beta1" cockroachdbv1alpha1 "github.com/rook/rook/pkg/apis/cockroachdb.rook.io/v1alpha1" @@ -56,6 +57,7 @@ func init() { // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. func AddToScheme(scheme *runtime.Scheme) { + cassandrav1alpha1.AddToScheme(scheme) cephv1alpha1.AddToScheme(scheme) cephv1beta1.AddToScheme(scheme) cockroachdbv1alpha1.AddToScheme(scheme) diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 23051f7d3..f33ad1348 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -19,6 +19,7 @@ limitations under the License. package scheme import ( + cassandrav1alpha1 "github.com/rook/rook/pkg/apis/cassandra.rook.io/v1alpha1" cephv1alpha1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1alpha1" cephv1beta1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1beta1" cockroachdbv1alpha1 "github.com/rook/rook/pkg/apis/cockroachdb.rook.io/v1alpha1" @@ -56,6 +57,7 @@ func init() { // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. func AddToScheme(scheme *runtime.Scheme) { + cassandrav1alpha1.AddToScheme(scheme) cephv1alpha1.AddToScheme(scheme) cephv1beta1.AddToScheme(scheme) cockroachdbv1alpha1.AddToScheme(scheme) diff --git a/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/cassandra.rook.io_client.go b/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/cassandra.rook.io_client.go new file mode 100644 index 000000000..b73de58e6 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/cassandra.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/cassandra.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 CassandraV1alpha1Interface interface { + RESTClient() rest.Interface + ClustersGetter +} + +// CassandraV1alpha1Client is used to interact with features provided by the cassandra.rook.io group. +type CassandraV1alpha1Client struct { + restClient rest.Interface +} + +func (c *CassandraV1alpha1Client) Clusters(namespace string) ClusterInterface { + return newClusters(c, namespace) +} + +// NewForConfig creates a new CassandraV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*CassandraV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &CassandraV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new CassandraV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *CassandraV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new CassandraV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *CassandraV1alpha1Client { + return &CassandraV1alpha1Client{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 *CassandraV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/cluster.go b/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/cluster.go new file mode 100644 index 000000000..0701fcb8d --- /dev/null +++ b/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/cluster.go @@ -0,0 +1,157 @@ +/* +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/cassandra.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" +) + +// ClustersGetter has a method to return a ClusterInterface. +// A group's client should implement this interface. +type ClustersGetter interface { + Clusters(namespace string) ClusterInterface +} + +// ClusterInterface has methods to work with Cluster resources. +type ClusterInterface interface { + Create(*v1alpha1.Cluster) (*v1alpha1.Cluster, error) + Update(*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 + ns string +} + +// newClusters returns a Clusters +func newClusters(c *CassandraV1alpha1Client, namespace string) *clusters { + return &clusters{ + client: c.RESTClient(), + ns: namespace, + } +} + +// 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(). + Namespace(c.ns). + 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) { + result = &v1alpha1.ClusterList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusters"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusters. +func (c *clusters) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("clusters"). + VersionedParams(&opts, scheme.ParameterCodec). + 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(). + Namespace(c.ns). + 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(). + Namespace(c.ns). + Resource("clusters"). + Name(cluster.Name). + 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(). + Namespace(c.ns). + 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 { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusters"). + VersionedParams(&listOptions, scheme.ParameterCodec). + 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). + Namespace(c.ns). + Resource("clusters"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/doc.go new file mode 100644 index 000000000..df51baa4d --- /dev/null +++ b/pkg/client/clientset/versioned/typed/cassandra.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/cassandra.rook.io/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/fake/doc.go new file mode 100644 index 000000000..16f443990 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/cassandra.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/cassandra.rook.io/v1alpha1/fake/fake_cassandra.rook.io_client.go b/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/fake/fake_cassandra.rook.io_client.go new file mode 100644 index 000000000..39a28ca2d --- /dev/null +++ b/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/fake/fake_cassandra.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/cassandra.rook.io/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeCassandraV1alpha1 struct { + *testing.Fake +} + +func (c *FakeCassandraV1alpha1) Clusters(namespace string) v1alpha1.ClusterInterface { + return &FakeClusters{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeCassandraV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/fake/fake_cluster.go b/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/fake/fake_cluster.go new file mode 100644 index 000000000..bee691161 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/fake/fake_cluster.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/cassandra.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" +) + +// FakeClusters implements ClusterInterface +type FakeClusters struct { + Fake *FakeCassandraV1alpha1 + ns string +} + +var clustersResource = schema.GroupVersionResource{Group: "cassandra.rook.io", Version: "v1alpha1", Resource: "clusters"} + +var clustersKind = schema.GroupVersionKind{Group: "cassandra.rook.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.NewGetAction(clustersResource, c.ns, 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.NewListAction(clustersResource, clustersKind, c.ns, 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.NewWatchAction(clustersResource, c.ns, 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.NewCreateAction(clustersResource, c.ns, 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.NewUpdateAction(clustersResource, c.ns, 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.NewDeleteAction(clustersResource, c.ns, name), &v1alpha1.Cluster{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(clustersResource, c.ns, 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.NewPatchSubresourceAction(clustersResource, c.ns, name, data, subresources...), &v1alpha1.Cluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Cluster), err +} diff --git a/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/cassandra.rook.io/v1alpha1/generated_expansion.go new file mode 100644 index 000000000..fcf4a3396 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/cassandra.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 ClusterExpansion interface{} diff --git a/pkg/client/informers/externalversions/cassandra.rook.io/interface.go b/pkg/client/informers/externalversions/cassandra.rook.io/interface.go new file mode 100644 index 000000000..e8a00018a --- /dev/null +++ b/pkg/client/informers/externalversions/cassandra.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 cassandra + +import ( + v1alpha1 "github.com/rook/rook/pkg/client/informers/externalversions/cassandra.rook.io/v1alpha1" + internalinterfaces "github.com/rook/rook/pkg/client/informers/externalversions/internalinterfaces" +) + +// 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/cassandra.rook.io/v1alpha1/cluster.go b/pkg/client/informers/externalversions/cassandra.rook.io/v1alpha1/cluster.go new file mode 100644 index 000000000..e2b9c8fda --- /dev/null +++ b/pkg/client/informers/externalversions/cassandra.rook.io/v1alpha1/cluster.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" + + cassandrarookiov1alpha1 "github.com/rook/rook/pkg/apis/cassandra.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/cassandra.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" +) + +// ClusterInformer provides access to a shared informer and lister for +// Clusters. +type ClusterInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ClusterLister +} + +type clusterInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewClusterInformer constructs a new informer for Cluster 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 NewClusterInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterInformer constructs a new informer for Cluster 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 NewFilteredClusterInformer(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.CassandraV1alpha1().Clusters(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CassandraV1alpha1().Clusters(namespace).Watch(options) + }, + }, + &cassandrarookiov1alpha1.Cluster{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&cassandrarookiov1alpha1.Cluster{}, f.defaultInformer) +} + +func (f *clusterInformer) Lister() v1alpha1.ClusterLister { + return v1alpha1.NewClusterLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/cassandra.rook.io/v1alpha1/interface.go b/pkg/client/informers/externalversions/cassandra.rook.io/v1alpha1/interface.go new file mode 100644 index 000000000..f5556f182 --- /dev/null +++ b/pkg/client/informers/externalversions/cassandra.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 { + // Clusters returns a ClusterInformer. + Clusters() ClusterInformer +} + +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} +} + +// Clusters returns a ClusterInformer. +func (v *version) Clusters() ClusterInformer { + return &clusterInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index a4c381a19..a547f0c8e 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -24,6 +24,7 @@ import ( time "time" versioned "github.com/rook/rook/pkg/client/clientset/versioned" + cassandrarookio "github.com/rook/rook/pkg/client/informers/externalversions/cassandra.rook.io" cephrookio "github.com/rook/rook/pkg/client/informers/externalversions/ceph.rook.io" cockroachdbrookio "github.com/rook/rook/pkg/client/informers/externalversions/cockroachdb.rook.io" internalinterfaces "github.com/rook/rook/pkg/client/informers/externalversions/internalinterfaces" @@ -176,6 +177,7 @@ type SharedInformerFactory interface { ForResource(resource schema.GroupVersionResource) (GenericInformer, error) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + Cassandra() cassandrarookio.Interface Ceph() cephrookio.Interface Cockroachdb() cockroachdbrookio.Interface Minio() miniorookio.Interface @@ -183,6 +185,10 @@ type SharedInformerFactory interface { Rook() rookio.Interface } +func (f *sharedInformerFactory) Cassandra() cassandrarookio.Interface { + return cassandrarookio.New(f, f.namespace, f.tweakListOptions) +} + func (f *sharedInformerFactory) Ceph() cephrookio.Interface { return cephrookio.New(f, f.namespace, f.tweakListOptions) } diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 8b441b920..06ab4fe12 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -21,7 +21,8 @@ package externalversions import ( "fmt" - v1alpha1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1alpha1" + v1alpha1 "github.com/rook/rook/pkg/apis/cassandra.rook.io/v1alpha1" + cephrookiov1alpha1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1alpha1" v1beta1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1beta1" cockroachdbrookiov1alpha1 "github.com/rook/rook/pkg/apis/cockroachdb.rook.io/v1alpha1" miniorookiov1alpha1 "github.com/rook/rook/pkg/apis/minio.rook.io/v1alpha1" @@ -58,14 +59,18 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=ceph.rook.io, Version=v1alpha1 + // Group=cassandra.rook.io, Version=v1alpha1 case v1alpha1.SchemeGroupVersion.WithResource("clusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Cassandra().V1alpha1().Clusters().Informer()}, nil + + // Group=ceph.rook.io, Version=v1alpha1 + case cephrookiov1alpha1.SchemeGroupVersion.WithResource("clusters"): return &genericInformer{resource: resource.GroupResource(), informer: f.Ceph().V1alpha1().Clusters().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("filesystems"): + case cephrookiov1alpha1.SchemeGroupVersion.WithResource("filesystems"): return &genericInformer{resource: resource.GroupResource(), informer: f.Ceph().V1alpha1().Filesystems().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("objectstores"): + case cephrookiov1alpha1.SchemeGroupVersion.WithResource("objectstores"): return &genericInformer{resource: resource.GroupResource(), informer: f.Ceph().V1alpha1().ObjectStores().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("pools"): + case cephrookiov1alpha1.SchemeGroupVersion.WithResource("pools"): return &genericInformer{resource: resource.GroupResource(), informer: f.Ceph().V1alpha1().Pools().Informer()}, nil // Group=ceph.rook.io, Version=v1beta1 diff --git a/pkg/client/listers/cassandra.rook.io/v1alpha1/cluster.go b/pkg/client/listers/cassandra.rook.io/v1alpha1/cluster.go new file mode 100644 index 000000000..34c800c12 --- /dev/null +++ b/pkg/client/listers/cassandra.rook.io/v1alpha1/cluster.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/cassandra.rook.io/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterLister helps list Clusters. +type ClusterLister interface { + // List lists all Clusters in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.Cluster, err error) + // Clusters returns an object that can list and get Clusters. + Clusters(namespace string) ClusterNamespaceLister + ClusterListerExpansion +} + +// clusterLister implements the ClusterLister interface. +type clusterLister struct { + indexer cache.Indexer +} + +// NewClusterLister returns a new ClusterLister. +func NewClusterLister(indexer cache.Indexer) ClusterLister { + return &clusterLister{indexer: indexer} +} + +// List lists all Clusters in the indexer. +func (s *clusterLister) List(selector labels.Selector) (ret []*v1alpha1.Cluster, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Cluster)) + }) + return ret, err +} + +// Clusters returns an object that can list and get Clusters. +func (s *clusterLister) Clusters(namespace string) ClusterNamespaceLister { + return clusterNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ClusterNamespaceLister helps list and get Clusters. +type ClusterNamespaceLister interface { + // List lists all Clusters in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.Cluster, err error) + // Get retrieves the Cluster from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.Cluster, error) + ClusterNamespaceListerExpansion +} + +// clusterNamespaceLister implements the ClusterNamespaceLister +// interface. +type clusterNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Clusters in the indexer for a given namespace. +func (s clusterNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Cluster, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Cluster)) + }) + return ret, err +} + +// Get retrieves the Cluster from the indexer for a given namespace and name. +func (s clusterNamespaceLister) Get(name string) (*v1alpha1.Cluster, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("cluster"), name) + } + return obj.(*v1alpha1.Cluster), nil +} diff --git a/pkg/client/listers/cassandra.rook.io/v1alpha1/expansion_generated.go b/pkg/client/listers/cassandra.rook.io/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..5bd821b43 --- /dev/null +++ b/pkg/client/listers/cassandra.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 + +// ClusterListerExpansion allows custom methods to be added to +// ClusterLister. +type ClusterListerExpansion interface{} + +// ClusterNamespaceListerExpansion allows custom methods to be added to +// ClusterNamespaceLister. +type ClusterNamespaceListerExpansion interface{}