Documentation ¶
Index ¶
- Constants
- Variables
- func AnnProm(port int32) map[string]string
- func GetOwnerRef(rc *v1alpha1.RedisCluster) metav1.OwnerReference
- func GetServiceType(services []v1alpha1.Service, serviceName string) corev1.ServiceType
- func Int32Ptr(i int32) *int32
- func IsRequeueError(err error) bool
- func RedisMemberName(clusterName string) string
- func RedisPeerMemberName(clusterName string) string
- func RequeueErrorf(format string, a ...interface{}) error
- func SentinelMemberName(clusterName string) string
- func SentinelPeerMemberName(clusterName string) string
- type FakePVCControl
- func (fpc *FakePVCControl) DeletePVC(_ *v1alpha1.RedisCluster, pvc *corev1.PersistentVolumeClaim) error
- func (fpc *FakePVCControl) SetDeletePVCError(err error, after int)
- func (fpc *FakePVCControl) SetUpdatePVCError(err error, after int)
- func (fpc *FakePVCControl) UpdatePVC(rc *v1alpha1.RedisCluster, pvc *corev1.PersistentVolumeClaim, pod *corev1.Pod) (*corev1.PersistentVolumeClaim, error)
- type FakePVControl
- func (fpc *FakePVControl) PatchPVReclaimPolicy(_ *v1alpha1.RedisCluster, pv *corev1.PersistentVolume, ...) error
- func (fpc *FakePVControl) SetUpdatePVError(err error, after int)
- func (fpc *FakePVControl) UpdatePV(rc *v1alpha1.RedisCluster, pv *corev1.PersistentVolume) (*corev1.PersistentVolume, error)
- type FakePodControl
- func (fpc *FakePodControl) CreatePod(_ *v1alpha1.RedisCluster, pod *corev1.Pod) error
- func (fpc *FakePodControl) DeletePod(_ *v1alpha1.RedisCluster, pod *corev1.Pod) error
- func (fpc *FakePodControl) SetDeletePodError(err error, after int)
- func (fpc *FakePodControl) SetGetClusterError(err error, after int)
- func (fpc *FakePodControl) SetUpdatePodError(err error, after int)
- func (fpc *FakePodControl) UpdatePod(_ *v1alpha1.RedisCluster, pod *corev1.Pod) (*corev1.Pod, error)
- type FakeRedisClusterControl
- type FakeServiceControl
- func (ssc *FakeServiceControl) CreateService(_ *v1alpha1.RedisCluster, svc *corev1.Service) error
- func (ssc *FakeServiceControl) DeleteService(_ *v1alpha1.RedisCluster, _ *corev1.Service) error
- func (ssc *FakeServiceControl) SetCreateServiceError(err error, after int)
- func (ssc *FakeServiceControl) SetDeleteServiceError(err error, after int)
- func (ssc *FakeServiceControl) SetUpdateServiceError(err error, after int)
- func (ssc *FakeServiceControl) UpdateService(_ *v1alpha1.RedisCluster, svc *corev1.Service) (*corev1.Service, error)
- type FakeStatefulSetControl
- func (ssc *FakeStatefulSetControl) CreateStatefulSet(_ *v1alpha1.RedisCluster, set *apps.StatefulSet) error
- func (ssc *FakeStatefulSetControl) DeleteStatefulSet(_ *v1alpha1.RedisCluster, _ *apps.StatefulSet) error
- func (ssc *FakeStatefulSetControl) SetCreateStatefulSetError(err error, after int)
- func (ssc *FakeStatefulSetControl) SetDeleteStatefulSetError(err error, after int)
- func (ssc *FakeStatefulSetControl) SetStatusChange(fn func(*apps.StatefulSet))
- func (ssc *FakeStatefulSetControl) SetUpdateStatefulSetError(err error, after int)
- func (ssc *FakeStatefulSetControl) UpdateStatefulSet(_ *v1alpha1.RedisCluster, set *apps.StatefulSet) (*apps.StatefulSet, error)
- type PVCControlInterface
- type PVControlInterface
- type PodControlInterface
- type RedisClusterControlInterface
- type RequeueError
- type ServiceControlInterface
- type StatefulSetControlInterface
Constants ¶
const ( // MessageResourceExists is the message used for Events when a resource // fails to sync due to a Deployment already existing MessageResourceExists = "%s %s/%s already exists and is not managed by Redis" )
Variables ¶
var ( // DefaultStorageClassName is the default storageClassName DefaultStorageClassName string // ClusterScoped controls whether operator should manage kubernetes cluster wide Redis clusters ClusterScoped bool )
var ( // TestName name label TestName = "redis-cluster" // TestComponentName component label for instance TestComponentName = "redis" // TestClusterModeName component label cluster mode TestClusterModeName = "replica" // TestManagedByName controller by redis TestManagedByName = "redis-operator" // TestClusterName cluster name TestClusterName = "test" // TestPodName cluster pod name TestPodName = "test-pod" // TestNodeRoleName cluster node role TestNodeRoleName = "master" )
Functions ¶
func GetOwnerRef ¶
func GetOwnerRef(rc *v1alpha1.RedisCluster) metav1.OwnerReference
GetOwnerRef returns Redis's OwnerReference
func GetServiceType ¶
func GetServiceType(services []v1alpha1.Service, serviceName string) corev1.ServiceType
GetServiceType returns member's service type
func IsRequeueError ¶
IsRequeueError returns whether err is a RequeueError
func RedisMemberName ¶
RedisMemberName return redis name for redis cluster
func RedisPeerMemberName ¶
RedisPeerMemberName return redis peer name for redis cluster
func RequeueErrorf ¶
RequeueErrorf returns a RequeueError
func SentinelMemberName ¶
SentinelMemberName returns sentinel name for redis
func SentinelPeerMemberName ¶
SentinelPeerMemberName returns sentinel peer service name
Types ¶
type FakePVCControl ¶
FakePVCControl is a fake PVCControlInterface
func NewFakePVCControl ¶
func NewFakePVCControl(pvcInformer coreinformers.PersistentVolumeClaimInformer) *FakePVCControl
NewFakePVCControl returns a FakePVCControl
func (*FakePVCControl) DeletePVC ¶
func (fpc *FakePVCControl) DeletePVC(_ *v1alpha1.RedisCluster, pvc *corev1.PersistentVolumeClaim) error
DeletePVC deletes the pvc
func (*FakePVCControl) SetDeletePVCError ¶
func (fpc *FakePVCControl) SetDeletePVCError(err error, after int)
SetDeletePVCError sets the error attributes of deletePVCTracker
func (*FakePVCControl) SetUpdatePVCError ¶
func (fpc *FakePVCControl) SetUpdatePVCError(err error, after int)
SetUpdatePVCError sets the error attributes of updatePVCTracker
func (*FakePVCControl) UpdatePVC ¶
func (fpc *FakePVCControl) UpdatePVC(rc *v1alpha1.RedisCluster, pvc *corev1.PersistentVolumeClaim, pod *corev1.Pod) (*corev1.PersistentVolumeClaim, error)
UpdatePVC updates the annotation, labels and spec of pvc
type FakePVControl ¶
type FakePVControl struct { PVCLister corelisters.PersistentVolumeClaimLister PVIndexer cache.Indexer // contains filtered or unexported fields }
FakePVControl is a fake PVControlInterface
func NewFakePVControl ¶
func NewFakePVControl(pvInformer coreinformers.PersistentVolumeInformer, pvcInformer coreinformers.PersistentVolumeClaimInformer) *FakePVControl
NewFakePVControl returns a FakePVControl
func (*FakePVControl) PatchPVReclaimPolicy ¶
func (fpc *FakePVControl) PatchPVReclaimPolicy(_ *v1alpha1.RedisCluster, pv *corev1.PersistentVolume, reclaimPolicy corev1.PersistentVolumeReclaimPolicy) error
PatchPVReclaimPolicy patchs the reclaim policy of PV
func (*FakePVControl) SetUpdatePVError ¶
func (fpc *FakePVControl) SetUpdatePVError(err error, after int)
SetUpdatePVError sets the error attributes of updatePVTracker
func (*FakePVControl) UpdatePV ¶
func (fpc *FakePVControl) UpdatePV(rc *v1alpha1.RedisCluster, pv *corev1.PersistentVolume) (*corev1.PersistentVolume, error)
UpdatePV update a pv in a Redis.
type FakePodControl ¶
FakePodControl is a fake PodControlInterface
func NewFakePodControl ¶
func NewFakePodControl(podInformer coreinformers.PodInformer) *FakePodControl
NewFakePodControl returns a FakePodControl
func (*FakePodControl) CreatePod ¶
func (fpc *FakePodControl) CreatePod(_ *v1alpha1.RedisCluster, pod *corev1.Pod) error
CreatePod create pod
func (*FakePodControl) DeletePod ¶
func (fpc *FakePodControl) DeletePod(_ *v1alpha1.RedisCluster, pod *corev1.Pod) error
DeletePod delete pod
func (*FakePodControl) SetDeletePodError ¶
func (fpc *FakePodControl) SetDeletePodError(err error, after int)
SetDeletePodError sets the error attributes of deletePodTracker
func (*FakePodControl) SetGetClusterError ¶
func (fpc *FakePodControl) SetGetClusterError(err error, after int)
SetGetClusterError sets the error attributes of getClusterTracker
func (*FakePodControl) SetUpdatePodError ¶
func (fpc *FakePodControl) SetUpdatePodError(err error, after int)
SetUpdatePodError sets the error attributes of updatePodTracker
func (*FakePodControl) UpdatePod ¶
func (fpc *FakePodControl) UpdatePod(_ *v1alpha1.RedisCluster, pod *corev1.Pod) (*corev1.Pod, error)
UpdatePod update pod info
type FakeRedisClusterControl ¶
type FakeRedisClusterControl struct { RcLister listers.RedisClusterLister RcIndexer cache.Indexer // contains filtered or unexported fields }
FakeRedisClusterControl is a fake RedisClusterControlInterface
func NewFakeFakeRedisControl ¶
func NewFakeFakeRedisControl(rcInformer rcinformers.RedisClusterInformer) *FakeRedisClusterControl
NewFakeFakeRedisControl returns a FakeRedisControl
func (*FakeRedisClusterControl) SetUpdateRedisError ¶
func (frc *FakeRedisClusterControl) SetUpdateRedisError(err error, after int)
SetUpdateRedisError sets the error attributes of updateRedisTracker
func (*FakeRedisClusterControl) UpdateRedisCluster ¶
func (frc *FakeRedisClusterControl) UpdateRedisCluster(rc *v1alpha1.RedisCluster, _ *v1alpha1.RedisClusterStatus, _ *v1alpha1.RedisClusterStatus) (*v1alpha1.RedisCluster, error)
UpdateRedisCluster updates the redis cluster
type FakeServiceControl ¶
type FakeServiceControl struct { SvcLister corelisters.ServiceLister SvcIndexer cache.Indexer RcLister v1listers.RedisClusterLister // contains filtered or unexported fields }
FakeServiceControl is a fake ServiceControlInterface
func NewFakeServiceControl ¶
func NewFakeServiceControl(svcInformer coreinformers.ServiceInformer, rcInformer rcinformers.RedisClusterInformer) *FakeServiceControl
NewFakeServiceControl returns a FakeServiceControl
func (*FakeServiceControl) CreateService ¶
func (ssc *FakeServiceControl) CreateService(_ *v1alpha1.RedisCluster, svc *corev1.Service) error
CreateService adds the service to SvcIndexer
func (*FakeServiceControl) DeleteService ¶
func (ssc *FakeServiceControl) DeleteService(_ *v1alpha1.RedisCluster, _ *corev1.Service) error
DeleteService deletes the service of SvcIndexer
func (*FakeServiceControl) SetCreateServiceError ¶
func (ssc *FakeServiceControl) SetCreateServiceError(err error, after int)
SetCreateServiceError sets the error attributes of createServiceTracker
func (*FakeServiceControl) SetDeleteServiceError ¶
func (ssc *FakeServiceControl) SetDeleteServiceError(err error, after int)
SetDeleteServiceError sets the error attributes of deleteServiceTracker
func (*FakeServiceControl) SetUpdateServiceError ¶
func (ssc *FakeServiceControl) SetUpdateServiceError(err error, after int)
SetUpdateServiceError sets the error attributes of updateServiceTracker
func (*FakeServiceControl) UpdateService ¶
func (ssc *FakeServiceControl) UpdateService(_ *v1alpha1.RedisCluster, svc *corev1.Service) (*corev1.Service, error)
UpdateService updates the service of SvcIndexer
type FakeStatefulSetControl ¶
type FakeStatefulSetControl struct { SetLister appslisters.StatefulSetLister SetIndexer cache.Indexer RcLister v1listers.RedisClusterLister RcIndexer cache.Indexer // contains filtered or unexported fields }
FakeStatefulSetControl is a fake StatefulSetControlInterface
func NewFakeStatefulSetControl ¶
func NewFakeStatefulSetControl(setInformer appsinformers.StatefulSetInformer, rcinformers rcinformers.RedisClusterInformer) *FakeStatefulSetControl
NewFakeStatefulSetControl returns a FakeStatefulSetControl
func (*FakeStatefulSetControl) CreateStatefulSet ¶
func (ssc *FakeStatefulSetControl) CreateStatefulSet(_ *v1alpha1.RedisCluster, set *apps.StatefulSet) error
CreateStatefulSet adds the statefulset to SetIndexer
func (*FakeStatefulSetControl) DeleteStatefulSet ¶
func (ssc *FakeStatefulSetControl) DeleteStatefulSet(_ *v1alpha1.RedisCluster, _ *apps.StatefulSet) error
DeleteStatefulSet deletes the statefulset of SetIndexer
func (*FakeStatefulSetControl) SetCreateStatefulSetError ¶
func (ssc *FakeStatefulSetControl) SetCreateStatefulSetError(err error, after int)
SetCreateStatefulSetError sets the error attributes of createStatefulSetTracker
func (*FakeStatefulSetControl) SetDeleteStatefulSetError ¶
func (ssc *FakeStatefulSetControl) SetDeleteStatefulSetError(err error, after int)
SetDeleteStatefulSetError sets the error attributes of deleteStatefulSetTracker
func (*FakeStatefulSetControl) SetStatusChange ¶
func (ssc *FakeStatefulSetControl) SetStatusChange(fn func(*apps.StatefulSet))
SetStatusChange sets the status change function
func (*FakeStatefulSetControl) SetUpdateStatefulSetError ¶
func (ssc *FakeStatefulSetControl) SetUpdateStatefulSetError(err error, after int)
SetUpdateStatefulSetError sets the error attributes of updateStatefulSetTracker
func (*FakeStatefulSetControl) UpdateStatefulSet ¶
func (ssc *FakeStatefulSetControl) UpdateStatefulSet(_ *v1alpha1.RedisCluster, set *apps.StatefulSet) (*apps.StatefulSet, error)
UpdateStatefulSet updates the statefulset of SetIndexer
type PVCControlInterface ¶
type PVCControlInterface interface { UpdatePVC(*v1alpha1.RedisCluster, *corev1.PersistentVolumeClaim, *corev1.Pod) (*corev1.PersistentVolumeClaim, error) DeletePVC(*v1alpha1.RedisCluster, *corev1.PersistentVolumeClaim) error }
PVCControlInterface manages PVCs used in Redis
func NewRealPVCControl ¶
func NewRealPVCControl( kubeCli kubernetes.Interface, recorder record.EventRecorder, pvcLister corelisters.PersistentVolumeClaimLister) PVCControlInterface
NewRealPVCControl creates a new PVCControlInterface
type PVControlInterface ¶
type PVControlInterface interface { UpdatePV(*v1alpha1.RedisCluster, *corev1.PersistentVolume) (*corev1.PersistentVolume, error) PatchPVReclaimPolicy(*v1alpha1.RedisCluster, *corev1.PersistentVolume, corev1.PersistentVolumeReclaimPolicy) error }
PVControlInterface manages PVs used in Redis
func NewRealPVControl ¶
func NewRealPVControl( kubeCli kubernetes.Interface, pvcLister corelisters.PersistentVolumeClaimLister, pvLister corelisters.PersistentVolumeLister, recorder record.EventRecorder, ) PVControlInterface
NewRealPVControl creates a new PVControlInterface
type PodControlInterface ¶
type PodControlInterface interface { CreatePod(*v1alpha1.RedisCluster, *corev1.Pod) error UpdatePod(*v1alpha1.RedisCluster, *corev1.Pod) (*corev1.Pod, error) DeletePod(*v1alpha1.RedisCluster, *corev1.Pod) error }
PodControlInterface defines the interface that RedisController uses to create, update, and delete Pods,
func NewRealPodControl ¶
func NewRealPodControl( kubeCli kubernetes.Interface, podLister corelisters.PodLister, recorder record.EventRecorder, ) PodControlInterface
NewRealPodControl creates a new PodControlInterface
type RedisClusterControlInterface ¶
type RedisClusterControlInterface interface { UpdateRedisCluster(rc *v1alpha1.RedisCluster, newStatus *v1alpha1.RedisClusterStatus, oldStatus *v1alpha1.RedisClusterStatus) (*v1alpha1.RedisCluster, error) }
RedisClusterControlInterface manages Redises
func NewRealRedisControl ¶
func NewRealRedisControl(cli versioned.Interface, rcLister listers.RedisClusterLister, recorder record.EventRecorder) RedisClusterControlInterface
NewRealRedisControl creates a new RedisControlInterface
type RequeueError ¶
type RequeueError struct {
// contains filtered or unexported fields
}
RequeueError is used to requeue the item, this error type should't be considered as a real error
func (*RequeueError) Error ¶
func (re *RequeueError) Error() string
type ServiceControlInterface ¶
type ServiceControlInterface interface { CreateService(*v1alpha1.RedisCluster, *corev1.Service) error UpdateService(*v1alpha1.RedisCluster, *corev1.Service) (*corev1.Service, error) DeleteService(*v1alpha1.RedisCluster, *corev1.Service) error }
ServiceControlInterface manages Services used in Redis
func NewRealServiceControl ¶
func NewRealServiceControl(kubeCli kubernetes.Interface, svcLister corelisters.ServiceLister, recorder record.EventRecorder) ServiceControlInterface
NewRealServiceControl creates a new ServiceControlInterface
type StatefulSetControlInterface ¶
type StatefulSetControlInterface interface { // CreateStatefulSet creates a StatefulSet in a Redis. CreateStatefulSet(*v1alpha1.RedisCluster, *apps.StatefulSet) error // UpdateStatefulSet updates a StatefulSet in a Redis. UpdateStatefulSet(*v1alpha1.RedisCluster, *apps.StatefulSet) (*apps.StatefulSet, error) // DeleteStatefulSet deletes a StatefulSet in a Redis. DeleteStatefulSet(*v1alpha1.RedisCluster, *apps.StatefulSet) error }
StatefulSetControlInterface defines the interface that uses to create, update, and delete StatefulSets,
func NewRealStatefuSetControl ¶
func NewRealStatefuSetControl(kubeCli kubernetes.Interface, setLister appslisters.StatefulSetLister, recorder record.EventRecorder) StatefulSetControlInterface
NewRealStatefuSetControl returns a StatefulSetControlInterface