diff --git a/api/v1beta2/redis_types.go b/api/v1beta2/redis_types.go index 091cb19ea..aa5fb875c 100644 --- a/api/v1beta2/redis_types.go +++ b/api/v1beta2/redis_types.go @@ -66,6 +66,7 @@ type Redis struct { Status RedisStatus `json:"status,omitempty"` } +// +genclient // +kubebuilder:object:root=true // RedisList contains a list of Redis diff --git a/api/v1beta2/rediscluster_types.go b/api/v1beta2/rediscluster_types.go index 913e4f2a1..2af8f8ac9 100644 --- a/api/v1beta2/rediscluster_types.go +++ b/api/v1beta2/rediscluster_types.go @@ -82,6 +82,7 @@ type RedisClusterStatus struct { ReadyFollowerReplicas int32 `json:"readyFollowerReplicas,omitempty"` } +// +genclient // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:storageversion diff --git a/api/v1beta2/redisreplication_types.go b/api/v1beta2/redisreplication_types.go index cb04c169d..c6f1035b8 100644 --- a/api/v1beta2/redisreplication_types.go +++ b/api/v1beta2/redisreplication_types.go @@ -39,6 +39,7 @@ func (cr *RedisReplicationSpec) GetReplicationCounts(t string) int32 { type RedisReplicationStatus struct { } +// +genclient // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:storageversion diff --git a/api/v1beta2/redissentinel_types.go b/api/v1beta2/redissentinel_types.go index b40ee6e10..1cea7ad16 100644 --- a/api/v1beta2/redissentinel_types.go +++ b/api/v1beta2/redissentinel_types.go @@ -57,6 +57,7 @@ type RedisSentinel struct { Status RedisSentinelStatus `json:"status,omitempty"` } +// +genclient // +kubebuilder:object:root=true // RedisList contains a list of Redis diff --git a/api/v1beta2/zz_generated.deepcopy.go b/api/v1beta2/zz_generated.deepcopy.go deleted file mode 100644 index 5e5fe2954..000000000 --- a/api/v1beta2/zz_generated.deepcopy.go +++ /dev/null @@ -1,1122 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 2020 Opstree Solutions. - -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 controller-gen. DO NOT EDIT. - -package v1beta2 - -import ( - "github.com/OT-CONTAINER-KIT/redis-operator/api" - "k8s.io/api/core/v1" - 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 *ACLConfig) DeepCopyInto(out *ACLConfig) { - *out = *in - if in.Secret != nil { - in, out := &in.Secret, &out.Secret - *out = new(v1.SecretVolumeSource) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACLConfig. -func (in *ACLConfig) DeepCopy() *ACLConfig { - if in == nil { - return nil - } - out := new(ACLConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterStorage) DeepCopyInto(out *ClusterStorage) { - *out = *in - in.NodeConfVolumeClaimTemplate.DeepCopyInto(&out.NodeConfVolumeClaimTemplate) - in.Storage.DeepCopyInto(&out.Storage) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStorage. -func (in *ClusterStorage) DeepCopy() *ClusterStorage { - if in == nil { - return nil - } - out := new(ClusterStorage) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ExistingPasswordSecret) DeepCopyInto(out *ExistingPasswordSecret) { - *out = *in - if in.Name != nil { - in, out := &in.Name, &out.Name - *out = new(string) - **out = **in - } - if in.Key != nil { - in, out := &in.Key, &out.Key - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExistingPasswordSecret. -func (in *ExistingPasswordSecret) DeepCopy() *ExistingPasswordSecret { - if in == nil { - return nil - } - out := new(ExistingPasswordSecret) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InitContainer) DeepCopyInto(out *InitContainer) { - *out = *in - if in.Enabled != nil { - in, out := &in.Enabled, &out.Enabled - *out = new(bool) - **out = **in - } - if in.Resources != nil { - in, out := &in.Resources, &out.Resources - *out = new(v1.ResourceRequirements) - (*in).DeepCopyInto(*out) - } - if in.EnvVars != nil { - in, out := &in.EnvVars, &out.EnvVars - *out = new([]v1.EnvVar) - if **in != nil { - in, out := *in, *out - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - } - if in.Command != nil { - in, out := &in.Command, &out.Command - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Args != nil { - in, out := &in.Args, &out.Args - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InitContainer. -func (in *InitContainer) DeepCopy() *InitContainer { - if in == nil { - return nil - } - out := new(InitContainer) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KubernetesConfig) DeepCopyInto(out *KubernetesConfig) { - *out = *in - in.KubernetesConfig.DeepCopyInto(&out.KubernetesConfig) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesConfig. -func (in *KubernetesConfig) DeepCopy() *KubernetesConfig { - if in == nil { - return nil - } - out := new(KubernetesConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Probe) DeepCopyInto(out *Probe) { - *out = *in - out.Probe = in.Probe -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Probe. -func (in *Probe) DeepCopy() *Probe { - if in == nil { - return nil - } - out := new(Probe) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Redis) DeepCopyInto(out *Redis) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Redis. -func (in *Redis) DeepCopy() *Redis { - if in == nil { - return nil - } - out := new(Redis) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Redis) 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 *RedisCluster) DeepCopyInto(out *RedisCluster) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisCluster. -func (in *RedisCluster) DeepCopy() *RedisCluster { - if in == nil { - return nil - } - out := new(RedisCluster) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RedisCluster) 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 *RedisClusterList) DeepCopyInto(out *RedisClusterList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]RedisCluster, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisClusterList. -func (in *RedisClusterList) DeepCopy() *RedisClusterList { - if in == nil { - return nil - } - out := new(RedisClusterList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RedisClusterList) 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 *RedisClusterSpec) DeepCopyInto(out *RedisClusterSpec) { - *out = *in - if in.Size != nil { - in, out := &in.Size, &out.Size - *out = new(int32) - **out = **in - } - in.KubernetesConfig.DeepCopyInto(&out.KubernetesConfig) - if in.ClusterVersion != nil { - in, out := &in.ClusterVersion, &out.ClusterVersion - *out = new(string) - **out = **in - } - in.RedisLeader.DeepCopyInto(&out.RedisLeader) - in.RedisFollower.DeepCopyInto(&out.RedisFollower) - if in.RedisExporter != nil { - in, out := &in.RedisExporter, &out.RedisExporter - *out = new(RedisExporter) - (*in).DeepCopyInto(*out) - } - if in.Storage != nil { - in, out := &in.Storage, &out.Storage - *out = new(ClusterStorage) - (*in).DeepCopyInto(*out) - } - if in.PodSecurityContext != nil { - in, out := &in.PodSecurityContext, &out.PodSecurityContext - *out = new(v1.PodSecurityContext) - (*in).DeepCopyInto(*out) - } - if in.Resources != nil { - in, out := &in.Resources, &out.Resources - *out = new(v1.ResourceRequirements) - (*in).DeepCopyInto(*out) - } - if in.TLS != nil { - in, out := &in.TLS, &out.TLS - *out = new(TLSConfig) - (*in).DeepCopyInto(*out) - } - if in.ACL != nil { - in, out := &in.ACL, &out.ACL - *out = new(ACLConfig) - (*in).DeepCopyInto(*out) - } - if in.InitContainer != nil { - in, out := &in.InitContainer, &out.InitContainer - *out = new(InitContainer) - (*in).DeepCopyInto(*out) - } - if in.Sidecars != nil { - in, out := &in.Sidecars, &out.Sidecars - *out = new([]Sidecar) - if **in != nil { - in, out := *in, *out - *out = make([]Sidecar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - } - if in.ServiceAccountName != nil { - in, out := &in.ServiceAccountName, &out.ServiceAccountName - *out = new(string) - **out = **in - } - if in.PersistenceEnabled != nil { - in, out := &in.PersistenceEnabled, &out.PersistenceEnabled - *out = new(bool) - **out = **in - } - if in.EnvVars != nil { - in, out := &in.EnvVars, &out.EnvVars - *out = new([]v1.EnvVar) - if **in != nil { - in, out := *in, *out - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisClusterSpec. -func (in *RedisClusterSpec) DeepCopy() *RedisClusterSpec { - if in == nil { - return nil - } - out := new(RedisClusterSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RedisClusterStatus) DeepCopyInto(out *RedisClusterStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisClusterStatus. -func (in *RedisClusterStatus) DeepCopy() *RedisClusterStatus { - if in == nil { - return nil - } - out := new(RedisClusterStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RedisConfig) DeepCopyInto(out *RedisConfig) { - *out = *in - in.RedisConfig.DeepCopyInto(&out.RedisConfig) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisConfig. -func (in *RedisConfig) DeepCopy() *RedisConfig { - if in == nil { - return nil - } - out := new(RedisConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RedisExporter) DeepCopyInto(out *RedisExporter) { - *out = *in - in.RedisExporter.DeepCopyInto(&out.RedisExporter) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisExporter. -func (in *RedisExporter) DeepCopy() *RedisExporter { - if in == nil { - return nil - } - out := new(RedisExporter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RedisFollower) DeepCopyInto(out *RedisFollower) { - *out = *in - in.RedisFollower.DeepCopyInto(&out.RedisFollower) - if in.SecurityContext != nil { - in, out := &in.SecurityContext, &out.SecurityContext - *out = new(v1.SecurityContext) - (*in).DeepCopyInto(*out) - } - if in.TerminationGracePeriodSeconds != nil { - in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds - *out = new(int64) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisFollower. -func (in *RedisFollower) DeepCopy() *RedisFollower { - if in == nil { - return nil - } - out := new(RedisFollower) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RedisLeader) DeepCopyInto(out *RedisLeader) { - *out = *in - in.RedisLeader.DeepCopyInto(&out.RedisLeader) - if in.SecurityContext != nil { - in, out := &in.SecurityContext, &out.SecurityContext - *out = new(v1.SecurityContext) - (*in).DeepCopyInto(*out) - } - if in.TerminationGracePeriodSeconds != nil { - in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds - *out = new(int64) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisLeader. -func (in *RedisLeader) DeepCopy() *RedisLeader { - if in == nil { - return nil - } - out := new(RedisLeader) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RedisList) DeepCopyInto(out *RedisList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Redis, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisList. -func (in *RedisList) DeepCopy() *RedisList { - if in == nil { - return nil - } - out := new(RedisList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RedisList) 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 *RedisReplication) DeepCopyInto(out *RedisReplication) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisReplication. -func (in *RedisReplication) DeepCopy() *RedisReplication { - if in == nil { - return nil - } - out := new(RedisReplication) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RedisReplication) 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 *RedisReplicationList) DeepCopyInto(out *RedisReplicationList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]RedisReplication, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisReplicationList. -func (in *RedisReplicationList) DeepCopy() *RedisReplicationList { - if in == nil { - return nil - } - out := new(RedisReplicationList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RedisReplicationList) 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 *RedisReplicationSpec) DeepCopyInto(out *RedisReplicationSpec) { - *out = *in - if in.Size != nil { - in, out := &in.Size, &out.Size - *out = new(int32) - **out = **in - } - in.KubernetesConfig.DeepCopyInto(&out.KubernetesConfig) - if in.RedisExporter != nil { - in, out := &in.RedisExporter, &out.RedisExporter - *out = new(RedisExporter) - (*in).DeepCopyInto(*out) - } - if in.RedisConfig != nil { - in, out := &in.RedisConfig, &out.RedisConfig - *out = new(RedisConfig) - (*in).DeepCopyInto(*out) - } - if in.Storage != nil { - in, out := &in.Storage, &out.Storage - *out = new(Storage) - (*in).DeepCopyInto(*out) - } - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.PodSecurityContext != nil { - in, out := &in.PodSecurityContext, &out.PodSecurityContext - *out = new(v1.PodSecurityContext) - (*in).DeepCopyInto(*out) - } - if in.SecurityContext != nil { - in, out := &in.SecurityContext, &out.SecurityContext - *out = new(v1.SecurityContext) - (*in).DeepCopyInto(*out) - } - if in.Affinity != nil { - in, out := &in.Affinity, &out.Affinity - *out = new(v1.Affinity) - (*in).DeepCopyInto(*out) - } - if in.Tolerations != nil { - in, out := &in.Tolerations, &out.Tolerations - *out = new([]v1.Toleration) - if **in != nil { - in, out := *in, *out - *out = make([]v1.Toleration, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - } - if in.TLS != nil { - in, out := &in.TLS, &out.TLS - *out = new(TLSConfig) - (*in).DeepCopyInto(*out) - } - if in.ACL != nil { - in, out := &in.ACL, &out.ACL - *out = new(ACLConfig) - (*in).DeepCopyInto(*out) - } - if in.ReadinessProbe != nil { - in, out := &in.ReadinessProbe, &out.ReadinessProbe - *out = new(Probe) - **out = **in - } - if in.LivenessProbe != nil { - in, out := &in.LivenessProbe, &out.LivenessProbe - *out = new(Probe) - **out = **in - } - if in.InitContainer != nil { - in, out := &in.InitContainer, &out.InitContainer - *out = new(InitContainer) - (*in).DeepCopyInto(*out) - } - if in.Sidecars != nil { - in, out := &in.Sidecars, &out.Sidecars - *out = new([]Sidecar) - if **in != nil { - in, out := *in, *out - *out = make([]Sidecar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - } - if in.ServiceAccountName != nil { - in, out := &in.ServiceAccountName, &out.ServiceAccountName - *out = new(string) - **out = **in - } - if in.TerminationGracePeriodSeconds != nil { - in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds - *out = new(int64) - **out = **in - } - if in.EnvVars != nil { - in, out := &in.EnvVars, &out.EnvVars - *out = new([]v1.EnvVar) - if **in != nil { - in, out := *in, *out - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisReplicationSpec. -func (in *RedisReplicationSpec) DeepCopy() *RedisReplicationSpec { - if in == nil { - return nil - } - out := new(RedisReplicationSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RedisReplicationStatus) DeepCopyInto(out *RedisReplicationStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisReplicationStatus. -func (in *RedisReplicationStatus) DeepCopy() *RedisReplicationStatus { - if in == nil { - return nil - } - out := new(RedisReplicationStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RedisSentinel) DeepCopyInto(out *RedisSentinel) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSentinel. -func (in *RedisSentinel) DeepCopy() *RedisSentinel { - if in == nil { - return nil - } - out := new(RedisSentinel) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RedisSentinel) 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 *RedisSentinelConfig) DeepCopyInto(out *RedisSentinelConfig) { - *out = *in - in.RedisSentinelConfig.DeepCopyInto(&out.RedisSentinelConfig) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSentinelConfig. -func (in *RedisSentinelConfig) DeepCopy() *RedisSentinelConfig { - if in == nil { - return nil - } - out := new(RedisSentinelConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RedisSentinelList) DeepCopyInto(out *RedisSentinelList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]RedisSentinel, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSentinelList. -func (in *RedisSentinelList) DeepCopy() *RedisSentinelList { - if in == nil { - return nil - } - out := new(RedisSentinelList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RedisSentinelList) 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 *RedisSentinelSpec) DeepCopyInto(out *RedisSentinelSpec) { - *out = *in - if in.Size != nil { - in, out := &in.Size, &out.Size - *out = new(int32) - **out = **in - } - in.KubernetesConfig.DeepCopyInto(&out.KubernetesConfig) - if in.RedisExporter != nil { - in, out := &in.RedisExporter, &out.RedisExporter - *out = new(RedisExporter) - (*in).DeepCopyInto(*out) - } - if in.RedisSentinelConfig != nil { - in, out := &in.RedisSentinelConfig, &out.RedisSentinelConfig - *out = new(RedisSentinelConfig) - (*in).DeepCopyInto(*out) - } - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.PodSecurityContext != nil { - in, out := &in.PodSecurityContext, &out.PodSecurityContext - *out = new(v1.PodSecurityContext) - (*in).DeepCopyInto(*out) - } - if in.SecurityContext != nil { - in, out := &in.SecurityContext, &out.SecurityContext - *out = new(v1.SecurityContext) - (*in).DeepCopyInto(*out) - } - if in.Affinity != nil { - in, out := &in.Affinity, &out.Affinity - *out = new(v1.Affinity) - (*in).DeepCopyInto(*out) - } - if in.Tolerations != nil { - in, out := &in.Tolerations, &out.Tolerations - *out = new([]v1.Toleration) - if **in != nil { - in, out := *in, *out - *out = make([]v1.Toleration, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - } - if in.TLS != nil { - in, out := &in.TLS, &out.TLS - *out = new(TLSConfig) - (*in).DeepCopyInto(*out) - } - if in.PodDisruptionBudget != nil { - in, out := &in.PodDisruptionBudget, &out.PodDisruptionBudget - *out = new(api.RedisPodDisruptionBudget) - (*in).DeepCopyInto(*out) - } - if in.ReadinessProbe != nil { - in, out := &in.ReadinessProbe, &out.ReadinessProbe - *out = new(Probe) - **out = **in - } - if in.LivenessProbe != nil { - in, out := &in.LivenessProbe, &out.LivenessProbe - *out = new(Probe) - **out = **in - } - if in.InitContainer != nil { - in, out := &in.InitContainer, &out.InitContainer - *out = new(InitContainer) - (*in).DeepCopyInto(*out) - } - if in.Sidecars != nil { - in, out := &in.Sidecars, &out.Sidecars - *out = new([]Sidecar) - if **in != nil { - in, out := *in, *out - *out = make([]Sidecar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - } - if in.ServiceAccountName != nil { - in, out := &in.ServiceAccountName, &out.ServiceAccountName - *out = new(string) - **out = **in - } - if in.TerminationGracePeriodSeconds != nil { - in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds - *out = new(int64) - **out = **in - } - if in.EnvVars != nil { - in, out := &in.EnvVars, &out.EnvVars - *out = new([]v1.EnvVar) - if **in != nil { - in, out := *in, *out - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSentinelSpec. -func (in *RedisSentinelSpec) DeepCopy() *RedisSentinelSpec { - if in == nil { - return nil - } - out := new(RedisSentinelSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RedisSentinelStatus) DeepCopyInto(out *RedisSentinelStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSentinelStatus. -func (in *RedisSentinelStatus) DeepCopy() *RedisSentinelStatus { - if in == nil { - return nil - } - out := new(RedisSentinelStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RedisSpec) DeepCopyInto(out *RedisSpec) { - *out = *in - in.KubernetesConfig.DeepCopyInto(&out.KubernetesConfig) - if in.RedisExporter != nil { - in, out := &in.RedisExporter, &out.RedisExporter - *out = new(RedisExporter) - (*in).DeepCopyInto(*out) - } - if in.RedisConfig != nil { - in, out := &in.RedisConfig, &out.RedisConfig - *out = new(RedisConfig) - (*in).DeepCopyInto(*out) - } - if in.Storage != nil { - in, out := &in.Storage, &out.Storage - *out = new(Storage) - (*in).DeepCopyInto(*out) - } - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.PodSecurityContext != nil { - in, out := &in.PodSecurityContext, &out.PodSecurityContext - *out = new(v1.PodSecurityContext) - (*in).DeepCopyInto(*out) - } - if in.SecurityContext != nil { - in, out := &in.SecurityContext, &out.SecurityContext - *out = new(v1.SecurityContext) - (*in).DeepCopyInto(*out) - } - if in.Affinity != nil { - in, out := &in.Affinity, &out.Affinity - *out = new(v1.Affinity) - (*in).DeepCopyInto(*out) - } - if in.Tolerations != nil { - in, out := &in.Tolerations, &out.Tolerations - *out = new([]v1.Toleration) - if **in != nil { - in, out := *in, *out - *out = make([]v1.Toleration, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - } - if in.TLS != nil { - in, out := &in.TLS, &out.TLS - *out = new(TLSConfig) - (*in).DeepCopyInto(*out) - } - if in.ACL != nil { - in, out := &in.ACL, &out.ACL - *out = new(ACLConfig) - (*in).DeepCopyInto(*out) - } - if in.ReadinessProbe != nil { - in, out := &in.ReadinessProbe, &out.ReadinessProbe - *out = new(Probe) - **out = **in - } - if in.LivenessProbe != nil { - in, out := &in.LivenessProbe, &out.LivenessProbe - *out = new(Probe) - **out = **in - } - if in.InitContainer != nil { - in, out := &in.InitContainer, &out.InitContainer - *out = new(InitContainer) - (*in).DeepCopyInto(*out) - } - if in.Sidecars != nil { - in, out := &in.Sidecars, &out.Sidecars - *out = new([]Sidecar) - if **in != nil { - in, out := *in, *out - *out = make([]Sidecar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - } - if in.ServiceAccountName != nil { - in, out := &in.ServiceAccountName, &out.ServiceAccountName - *out = new(string) - **out = **in - } - if in.TerminationGracePeriodSeconds != nil { - in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds - *out = new(int64) - **out = **in - } - if in.EnvVars != nil { - in, out := &in.EnvVars, &out.EnvVars - *out = new([]v1.EnvVar) - if **in != nil { - in, out := *in, *out - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSpec. -func (in *RedisSpec) DeepCopy() *RedisSpec { - if in == nil { - return nil - } - out := new(RedisSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RedisStatus) DeepCopyInto(out *RedisStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisStatus. -func (in *RedisStatus) DeepCopy() *RedisStatus { - if in == nil { - return nil - } - out := new(RedisStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ServiceConfig) DeepCopyInto(out *ServiceConfig) { - *out = *in - if in.ServiceAnnotations != nil { - in, out := &in.ServiceAnnotations, &out.ServiceAnnotations - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceConfig. -func (in *ServiceConfig) DeepCopy() *ServiceConfig { - if in == nil { - return nil - } - out := new(ServiceConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Sidecar) DeepCopyInto(out *Sidecar) { - *out = *in - in.Sidecar.DeepCopyInto(&out.Sidecar) - if in.Volumes != nil { - in, out := &in.Volumes, &out.Volumes - *out = new([]v1.VolumeMount) - if **in != nil { - in, out := *in, *out - *out = make([]v1.VolumeMount, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - } - if in.Command != nil { - in, out := &in.Command, &out.Command - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Ports != nil { - in, out := &in.Ports, &out.Ports - *out = new([]v1.ContainerPort) - if **in != nil { - in, out := *in, *out - *out = make([]v1.ContainerPort, len(*in)) - copy(*out, *in) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Sidecar. -func (in *Sidecar) DeepCopy() *Sidecar { - if in == nil { - return nil - } - out := new(Sidecar) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Storage) DeepCopyInto(out *Storage) { - *out = *in - in.Storage.DeepCopyInto(&out.Storage) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Storage. -func (in *Storage) DeepCopy() *Storage { - if in == nil { - return nil - } - out := new(Storage) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TLSConfig) DeepCopyInto(out *TLSConfig) { - *out = *in - in.TLSConfig.DeepCopyInto(&out.TLSConfig) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSConfig. -func (in *TLSConfig) DeepCopy() *TLSConfig { - if in == nil { - return nil - } - out := new(TLSConfig) - in.DeepCopyInto(out) - return out -} diff --git a/generated/clientset/versioned/clientset.go b/generated/clientset/versioned/clientset.go new file mode 100644 index 000000000..bb6e332e2 --- /dev/null +++ b/generated/clientset/versioned/clientset.go @@ -0,0 +1,18 @@ +/* +Copyright 2020 Opstree Solutions. + +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 versioned diff --git a/generated/clientset/versioned/fake/clientset_generated.go b/generated/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 000000000..264163be9 --- /dev/null +++ b/generated/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,18 @@ +/* +Copyright 2020 Opstree Solutions. + +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 diff --git a/generated/clientset/versioned/fake/doc.go b/generated/clientset/versioned/fake/doc.go new file mode 100644 index 000000000..7331fc16b --- /dev/null +++ b/generated/clientset/versioned/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2020 Opstree Solutions. + +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 fake clientset. +package fake diff --git a/generated/clientset/versioned/fake/register.go b/generated/clientset/versioned/fake/register.go new file mode 100644 index 000000000..264163be9 --- /dev/null +++ b/generated/clientset/versioned/fake/register.go @@ -0,0 +1,18 @@ +/* +Copyright 2020 Opstree Solutions. + +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 diff --git a/generated/clientset/versioned/scheme/doc.go b/generated/clientset/versioned/scheme/doc.go new file mode 100644 index 000000000..f25ebb7fc --- /dev/null +++ b/generated/clientset/versioned/scheme/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2020 Opstree Solutions. + +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 contains the scheme of the automatically generated clientset. +package scheme diff --git a/generated/clientset/versioned/scheme/register.go b/generated/clientset/versioned/scheme/register.go new file mode 100644 index 000000000..71e9319d2 --- /dev/null +++ b/generated/clientset/versioned/scheme/register.go @@ -0,0 +1,18 @@ +/* +Copyright 2020 Opstree Solutions. + +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 scheme diff --git a/generated/clientset/versioned/typed/core/v1beta2/core_client.go b/generated/clientset/versioned/typed/core/v1beta2/core_client.go new file mode 100644 index 000000000..3e6401301 --- /dev/null +++ b/generated/clientset/versioned/typed/core/v1beta2/core_client.go @@ -0,0 +1,18 @@ +/* +Copyright 2020 Opstree Solutions. + +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 v1beta2 diff --git a/generated/clientset/versioned/typed/core/v1beta2/doc.go b/generated/clientset/versioned/typed/core/v1beta2/doc.go new file mode 100644 index 000000000..21483e922 --- /dev/null +++ b/generated/clientset/versioned/typed/core/v1beta2/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2020 Opstree Solutions. + +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 v1beta2 diff --git a/generated/clientset/versioned/typed/core/v1beta2/fake/doc.go b/generated/clientset/versioned/typed/core/v1beta2/fake/doc.go new file mode 100644 index 000000000..02bbf3767 --- /dev/null +++ b/generated/clientset/versioned/typed/core/v1beta2/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2020 Opstree Solutions. + +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/generated/clientset/versioned/typed/core/v1beta2/fake/fake_core_client.go b/generated/clientset/versioned/typed/core/v1beta2/fake/fake_core_client.go new file mode 100644 index 000000000..264163be9 --- /dev/null +++ b/generated/clientset/versioned/typed/core/v1beta2/fake/fake_core_client.go @@ -0,0 +1,18 @@ +/* +Copyright 2020 Opstree Solutions. + +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 diff --git a/generated/clientset/versioned/typed/core/v1beta2/generated_expansion.go b/generated/clientset/versioned/typed/core/v1beta2/generated_expansion.go new file mode 100644 index 000000000..3e6401301 --- /dev/null +++ b/generated/clientset/versioned/typed/core/v1beta2/generated_expansion.go @@ -0,0 +1,18 @@ +/* +Copyright 2020 Opstree Solutions. + +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 v1beta2 diff --git a/generated/informers/externalversions/core/interface.go b/generated/informers/externalversions/core/interface.go new file mode 100644 index 000000000..56ce55e8c --- /dev/null +++ b/generated/informers/externalversions/core/interface.go @@ -0,0 +1,66 @@ +/* +Copyright 2020 Opstree Solutions. + +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 core + +import ( + v1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/generated/informers/externalversions/core/v1beta2" + internalinterfaces "github.com/OT-CONTAINER-KIT/redis-operator/generated/informers/externalversions/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1beta2 provides access to shared informers for resources in V1beta2. + V1beta2() v1beta2.Interface + // V1beta2 provides access to shared informers for resources in V1beta2. + V1beta2() v1beta2.Interface + // V1beta2 provides access to shared informers for resources in V1beta2. + V1beta2() v1beta2.Interface + // V1beta2 provides access to shared informers for resources in V1beta2. + V1beta2() v1beta2.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} +} + +// V1beta2 returns a new v1beta2.Interface. +func (g *group) V1beta2() v1beta2.Interface { + return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta2 returns a new v1beta2.Interface. +func (g *group) V1beta2() v1beta2.Interface { + return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta2 returns a new v1beta2.Interface. +func (g *group) V1beta2() v1beta2.Interface { + return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta2 returns a new v1beta2.Interface. +func (g *group) V1beta2() v1beta2.Interface { + return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/generated/informers/externalversions/core/v1beta2/interface.go b/generated/informers/externalversions/core/v1beta2/interface.go new file mode 100644 index 000000000..81fd8df52 --- /dev/null +++ b/generated/informers/externalversions/core/v1beta2/interface.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 Opstree Solutions. + +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 v1beta2 + +import ( + internalinterfaces "github.com/OT-CONTAINER-KIT/redis-operator/generated/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // RedisClusters returns a RedisClusterInformer. + RedisClusters() RedisClusterInformer + // RedisLists returns a RedisListInformer. + RedisLists() RedisListInformer + // RedisReplications returns a RedisReplicationInformer. + RedisReplications() RedisReplicationInformer + // RedisSentinelLists returns a RedisSentinelListInformer. + RedisSentinelLists() RedisSentinelListInformer +} + +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} +} + +// RedisClusters returns a RedisClusterInformer. +func (v *version) RedisClusters() RedisClusterInformer { + return &redisClusterInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// RedisLists returns a RedisListInformer. +func (v *version) RedisLists() RedisListInformer { + return &redisListInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// RedisReplications returns a RedisReplicationInformer. +func (v *version) RedisReplications() RedisReplicationInformer { + return &redisReplicationInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// RedisSentinelLists returns a RedisSentinelListInformer. +func (v *version) RedisSentinelLists() RedisSentinelListInformer { + return &redisSentinelListInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/generated/informers/externalversions/core/v1beta2/rediscluster.go b/generated/informers/externalversions/core/v1beta2/rediscluster.go new file mode 100644 index 000000000..234433d28 --- /dev/null +++ b/generated/informers/externalversions/core/v1beta2/rediscluster.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 Opstree Solutions. + +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 v1beta2 + +import ( + "context" + time "time" + + apiv1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta2" + versioned "github.com/OT-CONTAINER-KIT/redis-operator/generated/clientset/versioned" + internalinterfaces "github.com/OT-CONTAINER-KIT/redis-operator/generated/informers/externalversions/internalinterfaces" + v1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/generated/listers/core/v1beta2" + 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" +) + +// RedisClusterInformer provides access to a shared informer and lister for +// RedisClusters. +type RedisClusterInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.RedisClusterLister +} + +type redisClusterInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRedisClusterInformer constructs a new informer for RedisCluster 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 NewRedisClusterInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRedisClusterInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRedisClusterInformer constructs a new informer for RedisCluster 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 NewFilteredRedisClusterInformer(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.CoreV1beta2().RedisClusters(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1beta2().RedisClusters(namespace).Watch(context.TODO(), options) + }, + }, + &apiv1beta2.RedisCluster{}, + resyncPeriod, + indexers, + ) +} + +func (f *redisClusterInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRedisClusterInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *redisClusterInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apiv1beta2.RedisCluster{}, f.defaultInformer) +} + +func (f *redisClusterInformer) Lister() v1beta2.RedisClusterLister { + return v1beta2.NewRedisClusterLister(f.Informer().GetIndexer()) +} diff --git a/generated/informers/externalversions/core/v1beta2/redislist.go b/generated/informers/externalversions/core/v1beta2/redislist.go new file mode 100644 index 000000000..32ef9c114 --- /dev/null +++ b/generated/informers/externalversions/core/v1beta2/redislist.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 Opstree Solutions. + +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 v1beta2 + +import ( + "context" + time "time" + + apiv1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta2" + versioned "github.com/OT-CONTAINER-KIT/redis-operator/generated/clientset/versioned" + internalinterfaces "github.com/OT-CONTAINER-KIT/redis-operator/generated/informers/externalversions/internalinterfaces" + v1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/generated/listers/core/v1beta2" + 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" +) + +// RedisListInformer provides access to a shared informer and lister for +// RedisLists. +type RedisListInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.RedisListLister +} + +type redisListInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRedisListInformer constructs a new informer for RedisList 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 NewRedisListInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRedisListInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRedisListInformer constructs a new informer for RedisList 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 NewFilteredRedisListInformer(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.CoreV1beta2().RedisLists(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1beta2().RedisLists(namespace).Watch(context.TODO(), options) + }, + }, + &apiv1beta2.RedisList{}, + resyncPeriod, + indexers, + ) +} + +func (f *redisListInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRedisListInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *redisListInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apiv1beta2.RedisList{}, f.defaultInformer) +} + +func (f *redisListInformer) Lister() v1beta2.RedisListLister { + return v1beta2.NewRedisListLister(f.Informer().GetIndexer()) +} diff --git a/generated/informers/externalversions/core/v1beta2/redisreplication.go b/generated/informers/externalversions/core/v1beta2/redisreplication.go new file mode 100644 index 000000000..e61e5c292 --- /dev/null +++ b/generated/informers/externalversions/core/v1beta2/redisreplication.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 Opstree Solutions. + +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 v1beta2 + +import ( + "context" + time "time" + + apiv1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta2" + versioned "github.com/OT-CONTAINER-KIT/redis-operator/generated/clientset/versioned" + internalinterfaces "github.com/OT-CONTAINER-KIT/redis-operator/generated/informers/externalversions/internalinterfaces" + v1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/generated/listers/core/v1beta2" + 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" +) + +// RedisReplicationInformer provides access to a shared informer and lister for +// RedisReplications. +type RedisReplicationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.RedisReplicationLister +} + +type redisReplicationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRedisReplicationInformer constructs a new informer for RedisReplication 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 NewRedisReplicationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRedisReplicationInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRedisReplicationInformer constructs a new informer for RedisReplication 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 NewFilteredRedisReplicationInformer(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.CoreV1beta2().RedisReplications(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1beta2().RedisReplications(namespace).Watch(context.TODO(), options) + }, + }, + &apiv1beta2.RedisReplication{}, + resyncPeriod, + indexers, + ) +} + +func (f *redisReplicationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRedisReplicationInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *redisReplicationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apiv1beta2.RedisReplication{}, f.defaultInformer) +} + +func (f *redisReplicationInformer) Lister() v1beta2.RedisReplicationLister { + return v1beta2.NewRedisReplicationLister(f.Informer().GetIndexer()) +} diff --git a/generated/informers/externalversions/core/v1beta2/redissentinellist.go b/generated/informers/externalversions/core/v1beta2/redissentinellist.go new file mode 100644 index 000000000..180d62577 --- /dev/null +++ b/generated/informers/externalversions/core/v1beta2/redissentinellist.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 Opstree Solutions. + +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 v1beta2 + +import ( + "context" + time "time" + + apiv1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta2" + versioned "github.com/OT-CONTAINER-KIT/redis-operator/generated/clientset/versioned" + internalinterfaces "github.com/OT-CONTAINER-KIT/redis-operator/generated/informers/externalversions/internalinterfaces" + v1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/generated/listers/core/v1beta2" + 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" +) + +// RedisSentinelListInformer provides access to a shared informer and lister for +// RedisSentinelLists. +type RedisSentinelListInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.RedisSentinelListLister +} + +type redisSentinelListInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRedisSentinelListInformer constructs a new informer for RedisSentinelList 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 NewRedisSentinelListInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRedisSentinelListInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRedisSentinelListInformer constructs a new informer for RedisSentinelList 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 NewFilteredRedisSentinelListInformer(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.CoreV1beta2().RedisSentinelLists(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1beta2().RedisSentinelLists(namespace).Watch(context.TODO(), options) + }, + }, + &apiv1beta2.RedisSentinelList{}, + resyncPeriod, + indexers, + ) +} + +func (f *redisSentinelListInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRedisSentinelListInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *redisSentinelListInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apiv1beta2.RedisSentinelList{}, f.defaultInformer) +} + +func (f *redisSentinelListInformer) Lister() v1beta2.RedisSentinelListLister { + return v1beta2.NewRedisSentinelListLister(f.Informer().GetIndexer()) +} diff --git a/generated/informers/externalversions/factory.go b/generated/informers/externalversions/factory.go new file mode 100644 index 000000000..f007d0b75 --- /dev/null +++ b/generated/informers/externalversions/factory.go @@ -0,0 +1,250 @@ +/* +Copyright 2020 Opstree Solutions. + +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 externalversions + +import ( + reflect "reflect" + sync "sync" + time "time" + + versioned "github.com/OT-CONTAINER-KIT/redis-operator/generated/clientset/versioned" + core "github.com/OT-CONTAINER-KIT/redis-operator/generated/informers/externalversions/core" + internalinterfaces "github.com/OT-CONTAINER-KIT/redis-operator/generated/informers/externalversions/internalinterfaces" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool + // wg tracks how many goroutines were started. + wg sync.WaitGroup + // shuttingDown is true when Shutdown has been called. It may still be running + // because it needs to wait for goroutines. + shuttingDown bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + if f.shuttingDown { + return + } + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + f.wg.Add(1) + // We need a new variable in each loop iteration, + // otherwise the goroutine would use the loop variable + // and that keeps changing. + informer := informer + go func() { + defer f.wg.Done() + informer.Run(stopCh) + }() + f.startedInformers[informerType] = true + } + } +} + +func (f *sharedInformerFactory) Shutdown() { + f.lock.Lock() + f.shuttingDown = true + f.lock.Unlock() + + // Will return immediately if there is nothing to wait for. + f.wg.Wait() +} + +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +// +// It is typically used like this: +// +// ctx, cancel := context.Background() +// defer cancel() +// factory := NewSharedInformerFactory(client, resyncPeriod) +// defer factory.WaitForStop() // Returns immediately if nothing was started. +// genericInformer := factory.ForResource(resource) +// typedInformer := factory.SomeAPIGroup().V1().SomeType() +// factory.Start(ctx.Done()) // Start processing these informers. +// synced := factory.WaitForCacheSync(ctx.Done()) +// for v, ok := range synced { +// if !ok { +// fmt.Fprintf(os.Stderr, "caches failed to sync: %v", v) +// return +// } +// } +// +// // Creating informers can also be created after Start, but then +// // Start must be called again: +// anotherGenericInformer := factory.ForResource(resource) +// factory.Start(ctx.Done()) +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + + // Start initializes all requested informers. They are handled in goroutines + // which run until the stop channel gets closed. + Start(stopCh <-chan struct{}) + + // Shutdown marks a factory as shutting down. At that point no new + // informers can be started anymore and Start will return without + // doing anything. + // + // In addition, Shutdown blocks until all goroutines have terminated. For that + // to happen, the close channel(s) that they were started with must be closed, + // either before Shutdown gets called or while it is waiting. + // + // Shutdown may be called multiple times, even concurrently. All such calls will + // block until all goroutines have terminated. + Shutdown() + + // WaitForCacheSync blocks until all started informers' caches were synced + // or the stop channel gets closed. + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + // ForResource gives generic access to a shared informer of the matching type. + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + + // InformerFor returns the SharedIndexInformer for obj using an internal + // client. + InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer + + Core() core.Interface +} + +func (f *sharedInformerFactory) Core() core.Interface { + return core.New(f, f.namespace, f.tweakListOptions) +} diff --git a/generated/informers/externalversions/generic.go b/generated/informers/externalversions/generic.go new file mode 100644 index 000000000..9d7a325db --- /dev/null +++ b/generated/informers/externalversions/generic.go @@ -0,0 +1,193 @@ +/* +Copyright 2020 Opstree Solutions. + +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 externalversions + +import ( + "fmt" + + v1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta2" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=core, Version=v1beta2 + case v1beta2.SchemeGroupVersion.WithResource("redisclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisClusters().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisClusters().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisClusters().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisClusters().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redislists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redislists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redislists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redislists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisreplications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisReplications().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisreplications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisReplications().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisreplications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisReplications().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisreplications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisReplications().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redissentinellists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisSentinelLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redissentinellists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisSentinelLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redissentinellists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisSentinelLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redissentinellists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisSentinelLists().Informer()}, nil + + // Group=core, Version=v1beta2 + case v1beta2.SchemeGroupVersion.WithResource("redisclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisClusters().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisClusters().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisClusters().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisClusters().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redislists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redislists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redislists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redislists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisreplications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisReplications().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisreplications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisReplications().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisreplications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisReplications().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisreplications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisReplications().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redissentinellists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisSentinelLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redissentinellists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisSentinelLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redissentinellists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisSentinelLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redissentinellists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisSentinelLists().Informer()}, nil + + // Group=core, Version=v1beta2 + case v1beta2.SchemeGroupVersion.WithResource("redisclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisClusters().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisClusters().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisClusters().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisClusters().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redislists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redislists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redislists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redislists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisreplications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisReplications().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisreplications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisReplications().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisreplications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisReplications().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisreplications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisReplications().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redissentinellists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisSentinelLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redissentinellists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisSentinelLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redissentinellists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisSentinelLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redissentinellists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisSentinelLists().Informer()}, nil + + // Group=core, Version=v1beta2 + case v1beta2.SchemeGroupVersion.WithResource("redisclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisClusters().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisClusters().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisClusters().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisclusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisClusters().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redislists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redislists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redislists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redislists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisreplications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisReplications().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisreplications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisReplications().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisreplications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisReplications().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redisreplications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisReplications().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redissentinellists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisSentinelLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redissentinellists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisSentinelLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redissentinellists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisSentinelLists().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("redissentinellists"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1beta2().RedisSentinelLists().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/generated/informers/externalversions/internalinterfaces/factory_interfaces.go b/generated/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 000000000..cbf3d46ae --- /dev/null +++ b/generated/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,39 @@ +/* +Copyright 2020 Opstree Solutions. + +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 internalinterfaces + +import ( + time "time" + + versioned "github.com/OT-CONTAINER-KIT/redis-operator/generated/clientset/versioned" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" +) + +// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +// TweakListOptionsFunc is a function that transforms a v1.ListOptions. +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/generated/listers/core/v1beta2/expansion_generated.go b/generated/listers/core/v1beta2/expansion_generated.go new file mode 100644 index 000000000..f700bab7c --- /dev/null +++ b/generated/listers/core/v1beta2/expansion_generated.go @@ -0,0 +1,50 @@ +/* +Copyright 2020 Opstree Solutions. + +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 v1beta2 + +// RedisClusterListerExpansion allows custom methods to be added to +// RedisClusterLister. +type RedisClusterListerExpansion interface{} + +// RedisClusterNamespaceListerExpansion allows custom methods to be added to +// RedisClusterNamespaceLister. +type RedisClusterNamespaceListerExpansion interface{} + +// RedisListListerExpansion allows custom methods to be added to +// RedisListLister. +type RedisListListerExpansion interface{} + +// RedisListNamespaceListerExpansion allows custom methods to be added to +// RedisListNamespaceLister. +type RedisListNamespaceListerExpansion interface{} + +// RedisReplicationListerExpansion allows custom methods to be added to +// RedisReplicationLister. +type RedisReplicationListerExpansion interface{} + +// RedisReplicationNamespaceListerExpansion allows custom methods to be added to +// RedisReplicationNamespaceLister. +type RedisReplicationNamespaceListerExpansion interface{} + +// RedisSentinelListListerExpansion allows custom methods to be added to +// RedisSentinelListLister. +type RedisSentinelListListerExpansion interface{} + +// RedisSentinelListNamespaceListerExpansion allows custom methods to be added to +// RedisSentinelListNamespaceLister. +type RedisSentinelListNamespaceListerExpansion interface{} diff --git a/generated/listers/core/v1beta2/rediscluster.go b/generated/listers/core/v1beta2/rediscluster.go new file mode 100644 index 000000000..14050642d --- /dev/null +++ b/generated/listers/core/v1beta2/rediscluster.go @@ -0,0 +1,98 @@ +/* +Copyright 2020 Opstree Solutions. + +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 v1beta2 + +import ( + v1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RedisClusterLister helps list RedisClusters. +// All objects returned here must be treated as read-only. +type RedisClusterLister interface { + // List lists all RedisClusters in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.RedisCluster, err error) + // RedisClusters returns an object that can list and get RedisClusters. + RedisClusters(namespace string) RedisClusterNamespaceLister + RedisClusterListerExpansion +} + +// redisClusterLister implements the RedisClusterLister interface. +type redisClusterLister struct { + indexer cache.Indexer +} + +// NewRedisClusterLister returns a new RedisClusterLister. +func NewRedisClusterLister(indexer cache.Indexer) RedisClusterLister { + return &redisClusterLister{indexer: indexer} +} + +// List lists all RedisClusters in the indexer. +func (s *redisClusterLister) List(selector labels.Selector) (ret []*v1beta2.RedisCluster, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.RedisCluster)) + }) + return ret, err +} + +// RedisClusters returns an object that can list and get RedisClusters. +func (s *redisClusterLister) RedisClusters(namespace string) RedisClusterNamespaceLister { + return redisClusterNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RedisClusterNamespaceLister helps list and get RedisClusters. +// All objects returned here must be treated as read-only. +type RedisClusterNamespaceLister interface { + // List lists all RedisClusters in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.RedisCluster, err error) + // Get retrieves the RedisCluster from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta2.RedisCluster, error) + RedisClusterNamespaceListerExpansion +} + +// redisClusterNamespaceLister implements the RedisClusterNamespaceLister +// interface. +type redisClusterNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RedisClusters in the indexer for a given namespace. +func (s redisClusterNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.RedisCluster, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.RedisCluster)) + }) + return ret, err +} + +// Get retrieves the RedisCluster from the indexer for a given namespace and name. +func (s redisClusterNamespaceLister) Get(name string) (*v1beta2.RedisCluster, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("rediscluster"), name) + } + return obj.(*v1beta2.RedisCluster), nil +} diff --git a/generated/listers/core/v1beta2/redislist.go b/generated/listers/core/v1beta2/redislist.go new file mode 100644 index 000000000..001aa4ad5 --- /dev/null +++ b/generated/listers/core/v1beta2/redislist.go @@ -0,0 +1,98 @@ +/* +Copyright 2020 Opstree Solutions. + +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 v1beta2 + +import ( + v1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RedisListLister helps list RedisLists. +// All objects returned here must be treated as read-only. +type RedisListLister interface { + // List lists all RedisLists in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.RedisList, err error) + // RedisLists returns an object that can list and get RedisLists. + RedisLists(namespace string) RedisListNamespaceLister + RedisListListerExpansion +} + +// redisListLister implements the RedisListLister interface. +type redisListLister struct { + indexer cache.Indexer +} + +// NewRedisListLister returns a new RedisListLister. +func NewRedisListLister(indexer cache.Indexer) RedisListLister { + return &redisListLister{indexer: indexer} +} + +// List lists all RedisLists in the indexer. +func (s *redisListLister) List(selector labels.Selector) (ret []*v1beta2.RedisList, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.RedisList)) + }) + return ret, err +} + +// RedisLists returns an object that can list and get RedisLists. +func (s *redisListLister) RedisLists(namespace string) RedisListNamespaceLister { + return redisListNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RedisListNamespaceLister helps list and get RedisLists. +// All objects returned here must be treated as read-only. +type RedisListNamespaceLister interface { + // List lists all RedisLists in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.RedisList, err error) + // Get retrieves the RedisList from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta2.RedisList, error) + RedisListNamespaceListerExpansion +} + +// redisListNamespaceLister implements the RedisListNamespaceLister +// interface. +type redisListNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RedisLists in the indexer for a given namespace. +func (s redisListNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.RedisList, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.RedisList)) + }) + return ret, err +} + +// Get retrieves the RedisList from the indexer for a given namespace and name. +func (s redisListNamespaceLister) Get(name string) (*v1beta2.RedisList, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("redislist"), name) + } + return obj.(*v1beta2.RedisList), nil +} diff --git a/generated/listers/core/v1beta2/redisreplication.go b/generated/listers/core/v1beta2/redisreplication.go new file mode 100644 index 000000000..db7d65915 --- /dev/null +++ b/generated/listers/core/v1beta2/redisreplication.go @@ -0,0 +1,98 @@ +/* +Copyright 2020 Opstree Solutions. + +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 v1beta2 + +import ( + v1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RedisReplicationLister helps list RedisReplications. +// All objects returned here must be treated as read-only. +type RedisReplicationLister interface { + // List lists all RedisReplications in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.RedisReplication, err error) + // RedisReplications returns an object that can list and get RedisReplications. + RedisReplications(namespace string) RedisReplicationNamespaceLister + RedisReplicationListerExpansion +} + +// redisReplicationLister implements the RedisReplicationLister interface. +type redisReplicationLister struct { + indexer cache.Indexer +} + +// NewRedisReplicationLister returns a new RedisReplicationLister. +func NewRedisReplicationLister(indexer cache.Indexer) RedisReplicationLister { + return &redisReplicationLister{indexer: indexer} +} + +// List lists all RedisReplications in the indexer. +func (s *redisReplicationLister) List(selector labels.Selector) (ret []*v1beta2.RedisReplication, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.RedisReplication)) + }) + return ret, err +} + +// RedisReplications returns an object that can list and get RedisReplications. +func (s *redisReplicationLister) RedisReplications(namespace string) RedisReplicationNamespaceLister { + return redisReplicationNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RedisReplicationNamespaceLister helps list and get RedisReplications. +// All objects returned here must be treated as read-only. +type RedisReplicationNamespaceLister interface { + // List lists all RedisReplications in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.RedisReplication, err error) + // Get retrieves the RedisReplication from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta2.RedisReplication, error) + RedisReplicationNamespaceListerExpansion +} + +// redisReplicationNamespaceLister implements the RedisReplicationNamespaceLister +// interface. +type redisReplicationNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RedisReplications in the indexer for a given namespace. +func (s redisReplicationNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.RedisReplication, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.RedisReplication)) + }) + return ret, err +} + +// Get retrieves the RedisReplication from the indexer for a given namespace and name. +func (s redisReplicationNamespaceLister) Get(name string) (*v1beta2.RedisReplication, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("redisreplication"), name) + } + return obj.(*v1beta2.RedisReplication), nil +} diff --git a/generated/listers/core/v1beta2/redissentinellist.go b/generated/listers/core/v1beta2/redissentinellist.go new file mode 100644 index 000000000..fac250d0c --- /dev/null +++ b/generated/listers/core/v1beta2/redissentinellist.go @@ -0,0 +1,98 @@ +/* +Copyright 2020 Opstree Solutions. + +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 v1beta2 + +import ( + v1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RedisSentinelListLister helps list RedisSentinelLists. +// All objects returned here must be treated as read-only. +type RedisSentinelListLister interface { + // List lists all RedisSentinelLists in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.RedisSentinelList, err error) + // RedisSentinelLists returns an object that can list and get RedisSentinelLists. + RedisSentinelLists(namespace string) RedisSentinelListNamespaceLister + RedisSentinelListListerExpansion +} + +// redisSentinelListLister implements the RedisSentinelListLister interface. +type redisSentinelListLister struct { + indexer cache.Indexer +} + +// NewRedisSentinelListLister returns a new RedisSentinelListLister. +func NewRedisSentinelListLister(indexer cache.Indexer) RedisSentinelListLister { + return &redisSentinelListLister{indexer: indexer} +} + +// List lists all RedisSentinelLists in the indexer. +func (s *redisSentinelListLister) List(selector labels.Selector) (ret []*v1beta2.RedisSentinelList, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.RedisSentinelList)) + }) + return ret, err +} + +// RedisSentinelLists returns an object that can list and get RedisSentinelLists. +func (s *redisSentinelListLister) RedisSentinelLists(namespace string) RedisSentinelListNamespaceLister { + return redisSentinelListNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RedisSentinelListNamespaceLister helps list and get RedisSentinelLists. +// All objects returned here must be treated as read-only. +type RedisSentinelListNamespaceLister interface { + // List lists all RedisSentinelLists in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.RedisSentinelList, err error) + // Get retrieves the RedisSentinelList from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta2.RedisSentinelList, error) + RedisSentinelListNamespaceListerExpansion +} + +// redisSentinelListNamespaceLister implements the RedisSentinelListNamespaceLister +// interface. +type redisSentinelListNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RedisSentinelLists in the indexer for a given namespace. +func (s redisSentinelListNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.RedisSentinelList, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.RedisSentinelList)) + }) + return ret, err +} + +// Get retrieves the RedisSentinelList from the indexer for a given namespace and name. +func (s redisSentinelListNamespaceLister) Get(name string) (*v1beta2.RedisSentinelList, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("redissentinellist"), name) + } + return obj.(*v1beta2.RedisSentinelList), nil +} diff --git a/go.mod b/go.mod index b8210b8c2..09a5a4eb2 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( k8s.io/api v0.28.2 k8s.io/apimachinery v0.28.2 k8s.io/client-go v0.28.2 + k8s.io/code-generator v0.28.0 k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 sigs.k8s.io/controller-runtime v0.16.2 ) @@ -57,12 +58,14 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.25.0 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect + golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.8.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect + golang.org/x/tools v0.9.3 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.30.0 // indirect @@ -72,6 +75,7 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiextensions-apiserver v0.28.0 // indirect k8s.io/component-base v0.28.1 // indirect + k8s.io/gengo v0.0.0-20220902162205-c0856e24416d // indirect k8s.io/klog/v2 v2.100.1 // indirect k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect diff --git a/go.sum b/go.sum index cbee05b11..71414963a 100644 --- a/go.sum +++ b/go.sum @@ -226,6 +226,8 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= +golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -287,6 +289,7 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -353,9 +356,13 @@ k8s.io/apimachinery v0.28.2 h1:KCOJLrc6gu+wV1BYgwik4AF4vXOlVJPdiqn0yAWWwXQ= k8s.io/apimachinery v0.28.2/go.mod h1:RdzF87y/ngqk9H4z3EL2Rppv5jj95vGS/HaFXrLDApU= k8s.io/client-go v0.28.2 h1:DNoYI1vGq0slMBN/SWKMZMw0Rq+0EQW6/AK4v9+3VeY= k8s.io/client-go v0.28.2/go.mod h1:sMkApowspLuc7omj1FOSUxSoqjr+d5Q0Yc0LOFnYFJY= +k8s.io/code-generator v0.28.0 h1:msdkRVJNVFgdiIJ8REl/d3cZsMB9HByFcWMmn13NyuE= +k8s.io/code-generator v0.28.0/go.mod h1:ueeSJZJ61NHBa0ccWLey6mwawum25vX61nRZ6WOzN9A= k8s.io/component-base v0.28.1 h1:LA4AujMlK2mr0tZbQDZkjWbdhTV5bRyEyAFe0TJxlWg= k8s.io/component-base v0.28.1/go.mod h1:jI11OyhbX21Qtbav7JkhehyBsIRfnO8oEgoAR12ArIU= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/gengo v0.0.0-20220902162205-c0856e24416d h1:U9tB195lKdzwqicbJvyJeOXV7Klv+wNAWENRnXEGi08= +k8s.io/gengo v0.0.0-20220902162205-c0856e24416d/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= diff --git a/hack/kube_codegen.sh b/hack/kube_codegen.sh new file mode 100644 index 000000000..4ecd22d7e --- /dev/null +++ b/hack/kube_codegen.sh @@ -0,0 +1,651 @@ +#!/usr/bin/env bash + +# Copyright 2023 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. + +# This presents several functions for packages which want to use kubernetes +# code-generation tools. + +set -o errexit +set -o nounset +set -o pipefail + +KUBE_CODEGEN_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)" + +function kube::codegen::internal::git_find() { + # Similar to find but faster and easier to understand. We want to include + # modified and untracked files because this might be running against code + # which is not tracked by git yet. + git ls-files -cmo --exclude-standard "$@" +} + +function kube::codegen::internal::git_grep() { + # We want to include modified and untracked files because this might be + # running against code which is not tracked by git yet. + git grep --untracked "$@" +} + +# Generate tagged helper code: conversions, deepcopy, and defaults +# +# Args: +# --input-pkg-root +# The root package under which to search for files which request code to be +# generated. This must be Go package syntax, e.g. "k8s.io/foo/bar". +# +# --output-base +# The root directory under which to emit code. The concatenation of +# + must be valid. +# +# --boilerplate +# An optional override for the header file to insert into generated files. +# +# --extra-peer-dir +# An optional list (this flag may be specified multiple times) of "extra" +# directories to consider during conversion generation. +# +function kube::codegen::gen_helpers() { + local in_pkg_root="" + local out_base="" # gengo needs the output dir must be $out_base/$out_pkg_root + local boilerplate="${KUBE_CODEGEN_ROOT}/hack/boilerplate.go.txt" + local v="${KUBE_VERBOSE:-0}" + local extra_peers=() + + while [ "$#" -gt 0 ]; do + case "$1" in + "--input-pkg-root") + in_pkg_root="$2" + shift 2 + ;; + "--output-base") + out_base="$2" + shift 2 + ;; + "--boilerplate") + boilerplate="$2" + shift 2 + ;; + "--extra-peer-dir") + extra_peers+=("$2") + shift 2 + ;; + *) + echo "unknown argument: $1" >&2 + return 1 + ;; + esac + done + + if [ -z "${in_pkg_root}" ]; then + echo "--input-pkg-root is required" >&2 + return 1 + fi + if [ -z "${out_base}" ]; then + echo "--output-base is required" >&2 + return 1 + fi + + ( + # To support running this from anywhere, first cd into this directory, + # and then install with forced module mode on and fully qualified name. + cd "${KUBE_CODEGEN_ROOT}" + BINS=( + conversion-gen + deepcopy-gen + defaulter-gen + ) + # shellcheck disable=2046 # printf word-splitting is intentional + GO111MODULE=on go install $(printf "k8s.io/code-generator/cmd/%s " "${BINS[@]}") + ) + # Go installs in $GOBIN if defined, and $GOPATH/bin otherwise + gobin="${GOBIN:-$(go env GOPATH)/bin}" + + # These tools all assume out-dir == in-dir. + root="${out_base}/${in_pkg_root}" + mkdir -p "${root}" + root="$(cd "${root}" && pwd -P)" + + # Deepcopy + # + local input_pkgs=() + while read -r file; do + dir="$(dirname "${file}")" + pkg="$(cd "${dir}" && GO111MODULE=on go list -find .)" + input_pkgs+=("${pkg}") + done < <( + ( kube::codegen::internal::git_grep -l \ + -e '+k8s:deepcopy-gen=' \ + ":(glob)${root}"/'**/*.go' \ + || true \ + ) | LC_ALL=C sort -u + ) + + if [ "${#input_pkgs[@]}" != 0 ]; then + echo "Generating deepcopy code for ${#input_pkgs[@]} targets" + + kube::codegen::internal::git_find -z \ + ":(glob)${root}"/'**/zz_generated.deepcopy.go' \ + | xargs -0 rm -f + + local input_args=() + for arg in "${input_pkgs[@]}"; do + input_args+=("--input-dirs" "$arg") + done + "${gobin}/deepcopy-gen" \ + -v "${v}" \ + -O zz_generated.deepcopy \ + --go-header-file "${boilerplate}" \ + --output-base "${out_base}" \ + "${input_args[@]}" + fi + + # Defaults + # + local input_pkgs=() + while read -r file; do + dir="$(dirname "${file}")" + pkg="$(cd "${dir}" && GO111MODULE=on go list -find .)" + input_pkgs+=("${pkg}") + done < <( + ( kube::codegen::internal::git_grep -l \ + -e '+k8s:defaulter-gen=' \ + ":(glob)${root}"/'**/*.go' \ + || true \ + ) | LC_ALL=C sort -u + ) + + if [ "${#input_pkgs[@]}" != 0 ]; then + echo "Generating defaulter code for ${#input_pkgs[@]} targets" + + kube::codegen::internal::git_find -z \ + ":(glob)${root}"/'**/zz_generated.defaults.go' \ + | xargs -0 rm -f + + local input_args=() + for arg in "${input_pkgs[@]}"; do + input_args+=("--input-dirs" "$arg") + done + "${gobin}/defaulter-gen" \ + -v "${v}" \ + -O zz_generated.defaults \ + --go-header-file "${boilerplate}" \ + --output-base "${out_base}" \ + "${input_args[@]}" + fi + + # Conversions + # + local input_pkgs=() + while read -r file; do + dir="$(dirname "${file}")" + pkg="$(cd "${dir}" && GO111MODULE=on go list -find .)" + input_pkgs+=("${pkg}") + done < <( + ( kube::codegen::internal::git_grep -l \ + -e '+k8s:conversion-gen=' \ + ":(glob)${root}"/'**/*.go' \ + || true \ + ) | LC_ALL=C sort -u + ) + + if [ "${#input_pkgs[@]}" != 0 ]; then + echo "Generating conversion code for ${#input_pkgs[@]} targets" + + kube::codegen::internal::git_find -z \ + ":(glob)${root}"/'**/zz_generated.conversion.go' \ + | xargs -0 rm -f + + local input_args=() + for arg in "${input_pkgs[@]}"; do + input_args+=("--input-dirs" "$arg") + done + local extra_peer_args=() + for arg in "${extra_peers[@]:+"${extra_peers[@]}"}"; do + extra_peer_args+=("--extra-peer-dirs" "$arg") + done + "${gobin}/conversion-gen" \ + -v "${v}" \ + -O zz_generated.conversion \ + --go-header-file "${boilerplate}" \ + --output-base "${out_base}" \ + "${extra_peer_args[@]:+"${extra_peer_args[@]}"}" \ + "${input_args[@]}" + fi +} + +# Generate openapi code +# +# Args: +# --input-pkg-root +# The root package under which to search for files which request openapi to +# be generated. This must be Go package syntax, e.g. "k8s.io/foo/bar". +# +# --output-pkg-root +# The root package under which generated directories and files +# will be placed. This must be go package syntax, e.g. "k8s.io/foo/bar". +# +# --output-base +# The root directory under which to emit code. The concatenation of +# + must be valid. +# +# --openapi-name +# An optional override for the leaf name of the generated directory. +# +# --extra-pkgs +# An optional list of additional packages to be imported during openapi +# generation. The argument must be Go package syntax, e.g. +# "k8s.io/foo/bar". It may be a single value or a comma-delimited list. +# This flag may be repeated. +# +# --report-filename +# An optional path at which to write an API violations report. "-" means +# stdout. +# +# --update-report +# If specified, update the report file in place, rather than diffing it. +# +# --boilerplate +# An optional override for the header file to insert into generated files. +# +function kube::codegen::gen_openapi() { + local in_pkg_root="" + local out_pkg_root="" + local out_base="" # gengo needs the output dir must be $out_base/$out_pkg_root + local openapi_subdir="openapi" + local extra_pkgs=() + local report="/dev/null" + local update_report="" + local boilerplate="${KUBE_CODEGEN_ROOT}/hack/boilerplate.go.txt" + local v="${KUBE_VERBOSE:-0}" + + while [ "$#" -gt 0 ]; do + case "$1" in + "--input-pkg-root") + in_pkg_root="$2" + shift 2 + ;; + "--output-pkg-root") + out_pkg_root="$2" + shift 2 + ;; + "--output-base") + out_base="$2" + shift 2 + ;; + "--openapi-name") + openapi_subdir="$2" + shift 2 + ;; + "--extra-pkgs") + extra_pkgs+=("$2") + shift 2 + ;; + "--report-filename") + report="$2" + shift 2 + ;; + "--update-report") + update_report="true" + shift + ;; + "--boilerplate") + boilerplate="$2" + shift 2 + ;; + *) + echo "unknown argument: $1" >&2 + return 1 + ;; + esac + done + + if [ -z "${in_pkg_root}" ]; then + echo "--input-pkg-root is required" >&2 + return 1 + fi + if [ -z "${out_pkg_root}" ]; then + echo "--output-pkg-root is required" >&2 + return 1 + fi + if [ -z "${out_base}" ]; then + echo "--output-base is required" >&2 + return 1 + fi + + local new_report + new_report="$(mktemp -t "$(basename "$0").api_violations.XXXXXX")" + if [ -n "${update_report}" ]; then + new_report="${report}" + fi + + ( + # To support running this from anywhere, first cd into this directory, + # and then install with forced module mode on and fully qualified name. + cd "${KUBE_CODEGEN_ROOT}" + BINS=( + openapi-gen + ) + # shellcheck disable=2046 # printf word-splitting is intentional + GO111MODULE=on go install $(printf "k8s.io/code-generator/cmd/%s " "${BINS[@]}") + ) + # Go installs in $GOBIN if defined, and $GOPATH/bin otherwise + gobin="${GOBIN:-$(go env GOPATH)/bin}" + + # These tools all assume out-dir == in-dir. + root="${out_base}/${in_pkg_root}" + mkdir -p "${root}" + root="$(cd "${root}" && pwd -P)" + + local input_pkgs=( "${extra_pkgs[@]:+"${extra_pkgs[@]}"}") + while read -r file; do + dir="$(dirname "${file}")" + pkg="$(cd "${dir}" && GO111MODULE=on go list -find .)" + input_pkgs+=("${pkg}") + done < <( + ( kube::codegen::internal::git_grep -l \ + -e '+k8s:openapi-gen=' \ + ":(glob)${root}"/'**/*.go' \ + || true \ + ) | LC_ALL=C sort -u + ) + + if [ "${#input_pkgs[@]}" != 0 ]; then + echo "Generating openapi code for ${#input_pkgs[@]} targets" + + kube::codegen::internal::git_find -z \ + ":(glob)${root}"/'**/zz_generated.openapi.go' \ + | xargs -0 rm -f + + local inputs=() + for arg in "${input_pkgs[@]}"; do + inputs+=("--input-dirs" "$arg") + done + "${gobin}/openapi-gen" \ + -v "${v}" \ + -O zz_generated.openapi \ + --go-header-file "${boilerplate}" \ + --output-base "${out_base}" \ + --output-package "${out_pkg_root}/${openapi_subdir}" \ + --report-filename "${new_report}" \ + --input-dirs "k8s.io/apimachinery/pkg/apis/meta/v1" \ + --input-dirs "k8s.io/apimachinery/pkg/runtime" \ + --input-dirs "k8s.io/apimachinery/pkg/version" \ + "${inputs[@]}" + fi + + touch "${report}" # in case it doesn't exist yet + if ! diff -u "${report}" "${new_report}"; then + echo -e "ERROR:" + echo -e "\tAPI rule check failed for ${report}: new reported violations" + echo -e "\tPlease read api/api-rules/README.md" + return 1 + fi +} + +# Generate client code +# +# Args: +# --input-pkg-root +# The root package under which to search for types.go files which request +# clients to be generated. This must be Go package syntax, e.g. +# "k8s.io/foo/bar". +# +# --output-pkg-root +# The root package into which generated directories and files will be +# placed. This must be Go package syntax, e.g. "k8s.io/foo/bar". +# +# --output-base +# The root directory under which to emit code. The concatenation of +# + must be valid. +# +# --boilerplate +# An optional override for the header file to insert into generated files. +# +# --clientset-name +# An optional override for the leaf name of the generated "clientset" directory. +# +# --versioned-name +# An optional override for the leaf name of the generated +# "/versioned" directory. +# +# --with-applyconfig +# Enables generation of applyconfiguration files. +# +# --applyconfig-name +# An optional override for the leaf name of the generated "applyconfiguration" directory. +# +# --with-watch +# Enables generation of listers and informers for APIs which support WATCH. +# +# --listers-name +# An optional override for the leaf name of the generated "listers" directory. +# +# --informers-name +# An optional override for the leaf name of the generated "informers" directory. +# +function kube::codegen::gen_client() { + local in_pkg_root="" + local out_pkg_root="" + local out_base="" # gengo needs the output dir must be $out_base/$out_pkg_root + local clientset_subdir="clientset" + local clientset_versioned_name="versioned" + local applyconfig="false" + local applyconfig_subdir="applyconfiguration" + local watchable="false" + local listers_subdir="listers" + local informers_subdir="informers" + local boilerplate="${KUBE_CODEGEN_ROOT}/hack/boilerplate.go.txt" + local v="${KUBE_VERBOSE:-0}" + + while [ "$#" -gt 0 ]; do + case "$1" in + "--input-pkg-root") + in_pkg_root="$2" + shift 2 + ;; + "--output-pkg-root") + out_pkg_root="$2" + shift 2 + ;; + "--output-base") + out_base="$2" + shift 2 + ;; + "--boilerplate") + boilerplate="$2" + shift 2 + ;; + "--clientset-name") + clientset_subdir="$2" + shift 2 + ;; + "--versioned-name") + clientset_versioned_name="$2" + shift 2 + ;; + "--with-applyconfig") + applyconfig="true" + shift + ;; + "--applyconfig-name") + applyconfig_subdir="$2" + shift 2 + ;; + "--with-watch") + watchable="true" + shift + ;; + "--listers-name") + listers_subdir="$2" + shift 2 + ;; + "--informers-name") + informers_subdir="$2" + shift 2 + ;; + *) + echo "unknown argument: $1" >&2 + return 1 + ;; + esac + done + + if [ -z "${in_pkg_root}" ]; then + echo "--input-pkg-root is required" >&2 + return 1 + fi + if [ -z "${out_pkg_root}" ]; then + echo "--output-pkg-root is required" >&2 + return 1 + fi + if [ -z "${out_base}" ]; then + echo "--output-base is required" >&2 + return 1 + fi + + ( + # To support running this from anywhere, first cd into this directory, + # and then install with forced module mode on and fully qualified name. + cd "${KUBE_CODEGEN_ROOT}" + BINS=( + applyconfiguration-gen + client-gen + informer-gen + lister-gen + ) + # shellcheck disable=2046 # printf word-splitting is intentional + GO111MODULE=on go install $(printf "k8s.io/code-generator/cmd/%s " "${BINS[@]}") + ) + # Go installs in $GOBIN if defined, and $GOPATH/bin otherwise + gobin="${GOBIN:-$(go env GOPATH)/bin}" + + in_root="${out_base}/${in_pkg_root}" + mkdir -p "${in_root}" + in_root="$(cd "${in_root}" && pwd -P)" + out_root="${out_base}/${out_pkg_root}" + mkdir -p "${out_root}" + out_root="$(cd "${out_root}" && pwd -P)" + + local group_versions=() + local input_pkgs=() + while read -r file; do + dir="$(dirname "${file}")" + pkg="$(cd "${dir}" && GO111MODULE=on go list -find .)" + leaf="$(basename "${dir}")" + if grep -E -q '^v[0-9]+((alpha|beta)[0-9]+)?$' <<< "${leaf}"; then + input_pkgs+=("${pkg}") + + dir2="$(dirname "${dir}")" + leaf2="$(basename "${dir2}")" + group_versions+=("${leaf2}/${leaf}") + fi + done < <( + ( kube::codegen::internal::git_grep -l \ + -e '+genclient' \ + ":(glob)${in_root}"/'**/*_types.go' \ + || true \ + ) | LC_ALL=C sort -u + ) + + if [ "${#group_versions[@]}" == 0 ]; then + return 0 + fi + + applyconfig_pkg="" # set this for later use, iff enabled + if [ "${applyconfig}" == "true" ]; then + applyconfig_pkg="${out_pkg_root}/${applyconfig_subdir}" + + echo "Generating applyconfig code for ${#input_pkgs[@]} targets" + + ( kube::codegen::internal::git_grep -l --null \ + -e '^// Code generated by applyconfiguration-gen. DO NOT EDIT.$' \ + ":(glob)${out_root}/${applyconfig_subdir}"/'**/*.go' \ + || true \ + ) | xargs -0 rm -f + + local inputs=() + for arg in "${input_pkgs[@]}"; do + inputs+=("--input-dirs" "$arg") + done + "${gobin}/applyconfiguration-gen" \ + -v "${v}" \ + --go-header-file "${boilerplate}" \ + --output-base "${out_base}" \ + --output-package "${out_pkg_root}/${applyconfig_subdir}" \ + "${inputs[@]}" + fi + + echo "Generating client code for ${#group_versions[@]} targets" + + ( kube::codegen::internal::git_grep -l --null \ + -e '^// Code generated by client-gen. DO NOT EDIT.$' \ + ":(glob)${out_root}/${clientset_subdir}"/'**/*.go' \ + || true \ + ) | xargs -0 rm -f + + local inputs=() + for arg in "${group_versions[@]}"; do + inputs+=("--input" "$arg") + done + "${gobin}/client-gen" \ + -v "${v}" \ + --go-header-file "${boilerplate}" \ + --clientset-name "${clientset_versioned_name}" \ + --input-base "${in_pkg_root}" \ + --output-base "${out_base}" \ + --output-package "${out_pkg_root}/${clientset_subdir}" \ + --apply-configuration-package "${applyconfig_pkg}" \ + "${inputs[@]}" + + if [ "${watchable}" == "true" ]; then + echo "Generating lister code for ${#input_pkgs[@]} targets" + + ( kube::codegen::internal::git_grep -l --null \ + -e '^// Code generated by lister-gen. DO NOT EDIT.$' \ + ":(glob)${out_root}/${listers_subdir}"/'**/*.go' \ + || true \ + ) | xargs -0 rm -f + + local inputs=() + for arg in "${input_pkgs[@]}"; do + inputs+=("--input-dirs" "$arg") + done + "${gobin}/lister-gen" \ + -v "${v}" \ + --go-header-file "${boilerplate}" \ + --output-base "${out_base}" \ + --output-package "${out_pkg_root}/${listers_subdir}" \ + "${inputs[@]}" + + echo "Generating informer code for ${#input_pkgs[@]} targets" + + ( kube::codegen::internal::git_grep -l --null \ + -e '^// Code generated by informer-gen. DO NOT EDIT.$' \ + ":(glob)${out_root}/${informers_subdir}"/'**/*.go' \ + || true \ + ) | xargs -0 rm -f + + local inputs=() + for arg in "${input_pkgs[@]}"; do + inputs+=("--input-dirs" "$arg") + done + "${gobin}/informer-gen" \ + -v "${v}" \ + --go-header-file "${boilerplate}" \ + --output-base "${out_base}" \ + --output-package "${out_pkg_root}/${informers_subdir}" \ + --versioned-clientset-package "${out_pkg_root}/${clientset_subdir}/${clientset_versioned_name}" \ + --listers-package "${out_pkg_root}/${listers_subdir}" \ + "${inputs[@]}" + fi +} diff --git a/hack/tools.go b/hack/tools.go new file mode 100644 index 000000000..3c2035c98 --- /dev/null +++ b/hack/tools.go @@ -0,0 +1,20 @@ +//go:build tools +// +build tools + +/* +Copyright 2019 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. +*/ + +// This package imports things required by build scripts, to force `go mod` to see them as dependencies +package tools + +import _ "k8s.io/code-generator" diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh new file mode 100644 index 000000000..680d2a1f3 --- /dev/null +++ b/hack/update-codegen.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# Copyright 2017 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. + +set -o errexit +set -o nounset +set -o pipefail + +SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")" +SCRIPT_ROOT="${SCRIPT_DIR}/.." +CODEGEN_PKG=$SCRIPT_DIR +source "${CODEGEN_PKG}/kube_codegen.sh" + +kube::codegen::gen_client \ + --with-watch \ + --input-pkg-root github.com/OT-CONTAINER-KIT/redis-operator/api \ + --output-pkg-root github.com/OT-CONTAINER-KIT/redis-operator/generated \ + --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../.." \ + --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"