controller

package
v0.0.0-...-12521ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2019 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
var (

	// DefaultStorageClassName is the default storageClassName
	DefaultStorageClassName string

	// ClusterScoped controls whether operator should manage kubernetes cluster wide Redis clusters
	ClusterScoped bool
)
View Source
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 AnnProm

func AnnProm(port int32) map[string]string

AnnProm adds annotations for prometheus scraping metrics

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 Int32Ptr

func Int32Ptr(i int32) *int32

Int32Ptr returns a pointer to an int32

func IsRequeueError

func IsRequeueError(err error) bool

IsRequeueError returns whether err is a RequeueError

func RedisMemberName

func RedisMemberName(clusterName string) string

RedisMemberName return redis name for redis cluster

func RedisPeerMemberName

func RedisPeerMemberName(clusterName string) string

RedisPeerMemberName return redis peer name for redis cluster

func RequeueErrorf

func RequeueErrorf(format string, a ...interface{}) error

RequeueErrorf returns a RequeueError

func SentinelMemberName

func SentinelMemberName(clusterName string) string

SentinelMemberName returns sentinel name for redis

func SentinelPeerMemberName

func SentinelPeerMemberName(clusterName string) string

SentinelPeerMemberName returns sentinel peer service name

Types

type FakePVCControl

type FakePVCControl struct {
	PVCIndexer cache.Indexer
	// contains filtered or unexported fields
}

FakePVCControl is a fake PVCControlInterface

func NewFakePVCControl

func NewFakePVCControl(pvcInformer coreinformers.PersistentVolumeClaimInformer) *FakePVCControl

NewFakePVCControl returns a FakePVCControl

func (*FakePVCControl) DeletePVC

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

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

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

UpdatePV update a pv in a Redis.

type FakePodControl

type FakePodControl struct {
	PodIndexer cache.Indexer
	// contains filtered or unexported fields
}

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

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

PVCControlInterface manages PVCs used in Redis

func NewRealPVCControl

NewRealPVCControl creates a new PVCControlInterface

type PVControlInterface

PVControlInterface manages PVs used in Redis

func NewRealPVControl

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL