Documentation ¶
Index ¶
- type RedisClusterCheck
- type RedisClusterChecker
- func (r *RedisClusterChecker) CheckAllSlavesFromMaster(master string, rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error
- func (r *RedisClusterChecker) CheckRedisConfig(redisCluster *redisv1beta1.RedisCluster, addr string, auth *util.AuthConfig) error
- func (r *RedisClusterChecker) CheckRedisNumber(rc *redisv1beta1.RedisCluster) error
- func (r *RedisClusterChecker) CheckSentinelMonitor(sentinel string, monitor string, auth *util.AuthConfig) error
- func (r *RedisClusterChecker) CheckSentinelNumber(rc *redisv1beta1.RedisCluster) error
- func (r *RedisClusterChecker) CheckSentinelNumberInMemory(sentinel string, rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error
- func (r *RedisClusterChecker) CheckSentinelReadyReplicas(rc *redisv1beta1.RedisCluster) error
- func (r *RedisClusterChecker) CheckSentinelSlavesNumberInMemory(sentinel string, rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error
- func (r *RedisClusterChecker) GetMasterIP(rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) (string, error)
- func (r *RedisClusterChecker) GetMinimumRedisPodTime(rc *redisv1beta1.RedisCluster) (time.Duration, error)
- func (r *RedisClusterChecker) GetNumberMasters(rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) (int, error)
- func (r *RedisClusterChecker) GetRedisesIPs(rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) ([]string, error)
- func (r *RedisClusterChecker) GetSentinelsIPs(rc *redisv1beta1.RedisCluster) ([]string, error)
- type RedisClusterClient
- type RedisClusterHeal
- type RedisClusterHealer
- func (r *RedisClusterHealer) MakeMaster(ip string, auth *util.AuthConfig) error
- func (r *RedisClusterHealer) NewSentinelMonitor(ip string, monitor string, rc *redisv1beta1.RedisCluster, ...) error
- func (r *RedisClusterHealer) RestoreSentinel(ip string, auth *util.AuthConfig) error
- func (r *RedisClusterHealer) SetMasterOnAll(masterIP string, rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error
- func (r *RedisClusterHealer) SetOldestAsMaster(rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error
- func (r *RedisClusterHealer) SetRedisCustomConfig(ip string, rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error
- func (r *RedisClusterHealer) SetSentinelCustomConfig(ip string, rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error
- type RedisClusterKubeClient
- func (r *RedisClusterKubeClient) EnsureNotPresentRedisService(rc *redisv1beta1.RedisCluster) error
- func (r *RedisClusterKubeClient) EnsureRedisConfigMap(rc *redisv1beta1.RedisCluster, labels map[string]string, ...) error
- func (r *RedisClusterKubeClient) EnsureRedisService(rc *redisv1beta1.RedisCluster, labels map[string]string, ...) error
- func (r *RedisClusterKubeClient) EnsureRedisShutdownConfigMap(rc *redisv1beta1.RedisCluster, labels map[string]string, ...) error
- func (r *RedisClusterKubeClient) EnsureRedisStatefulset(rc *redisv1beta1.RedisCluster, labels map[string]string, ...) error
- func (r *RedisClusterKubeClient) EnsureSentinelConfigMap(rc *redisv1beta1.RedisCluster, labels map[string]string, ...) error
- func (r *RedisClusterKubeClient) EnsureSentinelHeadlessService(rc *redisv1beta1.RedisCluster, labels map[string]string, ...) error
- func (r *RedisClusterKubeClient) EnsureSentinelProbeConfigMap(rc *redisv1beta1.RedisCluster, labels map[string]string, ...) error
- func (r *RedisClusterKubeClient) EnsureSentinelService(rc *redisv1beta1.RedisCluster, labels map[string]string, ...) error
- func (r *RedisClusterKubeClient) EnsureSentinelStatefulset(rc *redisv1beta1.RedisCluster, labels map[string]string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisClusterCheck ¶
type RedisClusterCheck interface { CheckRedisNumber(redisCluster *redisv1beta1.RedisCluster) error CheckSentinelNumber(redisCluster *redisv1beta1.RedisCluster) error CheckSentinelReadyReplicas(redisCluster *redisv1beta1.RedisCluster) error CheckAllSlavesFromMaster(master string, redisCluster *redisv1beta1.RedisCluster, auth *util.AuthConfig) error CheckSentinelNumberInMemory(sentinel string, redisCluster *redisv1beta1.RedisCluster, auth *util.AuthConfig) error CheckSentinelSlavesNumberInMemory(sentinel string, redisCluster *redisv1beta1.RedisCluster, auth *util.AuthConfig) error CheckSentinelMonitor(sentinel string, monitor string, auth *util.AuthConfig) error GetMasterIP(redisCluster *redisv1beta1.RedisCluster, auth *util.AuthConfig) (string, error) GetNumberMasters(redisCluster *redisv1beta1.RedisCluster, auth *util.AuthConfig) (int, error) GetRedisesIPs(redisCluster *redisv1beta1.RedisCluster, auth *util.AuthConfig) ([]string, error) GetSentinelsIPs(redisCluster *redisv1beta1.RedisCluster) ([]string, error) GetMinimumRedisPodTime(redisCluster *redisv1beta1.RedisCluster) (time.Duration, error) CheckRedisConfig(redisCluster *redisv1beta1.RedisCluster, addr string, auth *util.AuthConfig) error }
RedisClusterCheck defines the intercace able to check the correct status of a redis cluster
type RedisClusterChecker ¶
type RedisClusterChecker struct {
// contains filtered or unexported fields
}
RedisClusterChecker is our implementation of RedisClusterCheck intercace
func NewRedisClusterChecker ¶
func NewRedisClusterChecker(k8sService k8s.Services, redisClient redis.Client, logger logr.Logger) *RedisClusterChecker
NewRedisClusterChecker creates an object of the RedisClusterChecker struct
func (*RedisClusterChecker) CheckAllSlavesFromMaster ¶
func (r *RedisClusterChecker) CheckAllSlavesFromMaster(master string, rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error
CheckAllSlavesFromMaster controls that all slaves have the same master (the real one)
func (*RedisClusterChecker) CheckRedisConfig ¶
func (r *RedisClusterChecker) CheckRedisConfig(redisCluster *redisv1beta1.RedisCluster, addr string, auth *util.AuthConfig) error
CheckRedisConfig check current redis config is same as custom config
func (*RedisClusterChecker) CheckRedisNumber ¶
func (r *RedisClusterChecker) CheckRedisNumber(rc *redisv1beta1.RedisCluster) error
CheckRedisNumber controls that the number of deployed redis is the same than the requested on the spec
func (*RedisClusterChecker) CheckSentinelMonitor ¶
func (r *RedisClusterChecker) CheckSentinelMonitor(sentinel string, monitor string, auth *util.AuthConfig) error
CheckSentinelMonitor controls if the sentinels are monitoring the expected master
func (*RedisClusterChecker) CheckSentinelNumber ¶
func (r *RedisClusterChecker) CheckSentinelNumber(rc *redisv1beta1.RedisCluster) error
CheckSentinelNumber controls that the number of deployed sentinel is the same than the requested on the spec
func (*RedisClusterChecker) CheckSentinelNumberInMemory ¶
func (r *RedisClusterChecker) CheckSentinelNumberInMemory(sentinel string, rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error
CheckSentinelNumberInMemory controls that sentinels have only the living sentinels on its memory.
func (*RedisClusterChecker) CheckSentinelReadyReplicas ¶
func (r *RedisClusterChecker) CheckSentinelReadyReplicas(rc *redisv1beta1.RedisCluster) error
CheckSentinelReadyReplicas controls that the number of deployed sentinel ready pod is the same than the requested on the spec
func (*RedisClusterChecker) CheckSentinelSlavesNumberInMemory ¶
func (r *RedisClusterChecker) CheckSentinelSlavesNumberInMemory(sentinel string, rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error
CheckSentinelSlavesNumberInMemory controls that sentinels have only the spected slaves number.
func (*RedisClusterChecker) GetMasterIP ¶
func (r *RedisClusterChecker) GetMasterIP(rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) (string, error)
GetMasterIP connects to all redis and returns the master of the redis cluster
func (*RedisClusterChecker) GetMinimumRedisPodTime ¶
func (r *RedisClusterChecker) GetMinimumRedisPodTime(rc *redisv1beta1.RedisCluster) (time.Duration, error)
GetMinimumRedisPodTime returns the minimum time a pod is alive
func (*RedisClusterChecker) GetNumberMasters ¶
func (r *RedisClusterChecker) GetNumberMasters(rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) (int, error)
GetNumberMasters returns the number of redis nodes that are working as a master
func (*RedisClusterChecker) GetRedisesIPs ¶
func (r *RedisClusterChecker) GetRedisesIPs(rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) ([]string, error)
GetRedisesIPs returns the IPs of the Redis nodes
func (*RedisClusterChecker) GetSentinelsIPs ¶
func (r *RedisClusterChecker) GetSentinelsIPs(rc *redisv1beta1.RedisCluster) ([]string, error)
GetSentinelsIPs returns the IPs of the Sentinel nodes
type RedisClusterClient ¶
type RedisClusterClient interface { EnsureSentinelService(redisCluster *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error EnsureSentinelHeadlessService(redisCluster *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error EnsureSentinelConfigMap(redisCluster *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error EnsureSentinelProbeConfigMap(redisCluster *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error EnsureSentinelStatefulset(redisCluster *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error EnsureRedisStatefulset(redisCluster *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error EnsureRedisService(redisCluster *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error EnsureRedisShutdownConfigMap(redisCluster *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error EnsureRedisConfigMap(redisCluster *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error EnsureNotPresentRedisService(redisCluster *redisv1beta1.RedisCluster) error }
RedisClusterClient has the minimumm methods that a Redis cluster controller needs to satisfy in order to talk with K8s
type RedisClusterHeal ¶
type RedisClusterHeal interface { MakeMaster(ip string, auth *util.AuthConfig) error SetOldestAsMaster(redisCluster *redisv1beta1.RedisCluster, auth *util.AuthConfig) error SetMasterOnAll(masterIP string, redisCluster *redisv1beta1.RedisCluster, auth *util.AuthConfig) error NewSentinelMonitor(ip string, monitor string, redisCluster *redisv1beta1.RedisCluster, auth *util.AuthConfig) error RestoreSentinel(ip string, auth *util.AuthConfig) error SetSentinelCustomConfig(ip string, redisCluster *redisv1beta1.RedisCluster, auth *util.AuthConfig) error SetRedisCustomConfig(ip string, redisCluster *redisv1beta1.RedisCluster, auth *util.AuthConfig) error }
RedisClusterHeal defines the intercace able to fix the problems on the redis clusters
type RedisClusterHealer ¶
type RedisClusterHealer struct {
// contains filtered or unexported fields
}
RedisClusterHealer is our implementation of RedisClusterCheck intercace
func NewRedisClusterHealer ¶
func NewRedisClusterHealer(k8sService k8s.Services, redisClient redis.Client, logger logr.Logger) *RedisClusterHealer
NewRedisClusterHealer creates an object of the RedisClusterChecker struct
func (*RedisClusterHealer) MakeMaster ¶
func (r *RedisClusterHealer) MakeMaster(ip string, auth *util.AuthConfig) error
func (*RedisClusterHealer) NewSentinelMonitor ¶
func (r *RedisClusterHealer) NewSentinelMonitor(ip string, monitor string, rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error
NewSentinelMonitor changes the master that Sentinel has to monitor
func (*RedisClusterHealer) RestoreSentinel ¶
func (r *RedisClusterHealer) RestoreSentinel(ip string, auth *util.AuthConfig) error
RestoreSentinel clear the number of sentinels on memory
func (*RedisClusterHealer) SetMasterOnAll ¶
func (r *RedisClusterHealer) SetMasterOnAll(masterIP string, rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error
SetMasterOnAll puts all redis nodes as a slave of a given master
func (*RedisClusterHealer) SetOldestAsMaster ¶
func (r *RedisClusterHealer) SetOldestAsMaster(rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error
SetOldestAsMaster puts all redis to the same master, choosen by order of appearance
func (*RedisClusterHealer) SetRedisCustomConfig ¶
func (r *RedisClusterHealer) SetRedisCustomConfig(ip string, rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error
SetRedisCustomConfig will call redis to set the configuration given in config
func (*RedisClusterHealer) SetSentinelCustomConfig ¶
func (r *RedisClusterHealer) SetSentinelCustomConfig(ip string, rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error
SetSentinelCustomConfig will call sentinel to set the configuration given in config
type RedisClusterKubeClient ¶
type RedisClusterKubeClient struct { K8SService k8s.Services // contains filtered or unexported fields }
RedisClusterKubeClient implements the required methods to talk with kubernetes
func NewRedisClusterKubeClient ¶
func NewRedisClusterKubeClient(k8sService k8s.Services, logger logr.Logger) *RedisClusterKubeClient
NewRedisClusterKubeClient creates a new RedisClusterKubeClient
func (*RedisClusterKubeClient) EnsureNotPresentRedisService ¶
func (r *RedisClusterKubeClient) EnsureNotPresentRedisService(rc *redisv1beta1.RedisCluster) error
EnsureNotPresentRedisService makes sure the redis service is not present
func (*RedisClusterKubeClient) EnsureRedisConfigMap ¶
func (r *RedisClusterKubeClient) EnsureRedisConfigMap(rc *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error
EnsureRedisConfigMap makes sure the sentinel configmap exists
func (*RedisClusterKubeClient) EnsureRedisService ¶
func (r *RedisClusterKubeClient) EnsureRedisService(rc *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error
EnsureRedisService makes sure the redis statefulset exists
func (*RedisClusterKubeClient) EnsureRedisShutdownConfigMap ¶
func (r *RedisClusterKubeClient) EnsureRedisShutdownConfigMap(rc *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error
EnsureRedisShutdownConfigMap makes sure the redis configmap with shutdown script exists
func (*RedisClusterKubeClient) EnsureRedisStatefulset ¶
func (r *RedisClusterKubeClient) EnsureRedisStatefulset(rc *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error
EnsureRedisStatefulset makes sure the redis statefulset exists in the desired state
func (*RedisClusterKubeClient) EnsureSentinelConfigMap ¶
func (r *RedisClusterKubeClient) EnsureSentinelConfigMap(rc *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error
EnsureSentinelConfigMap makes sure the sentinel configmap exists
func (*RedisClusterKubeClient) EnsureSentinelHeadlessService ¶
func (r *RedisClusterKubeClient) EnsureSentinelHeadlessService(rc *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error
EnsureSentinelHeadlessService makes sure the sentinel headless service exists
func (*RedisClusterKubeClient) EnsureSentinelProbeConfigMap ¶
func (r *RedisClusterKubeClient) EnsureSentinelProbeConfigMap(rc *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error
EnsureSentinelConfigMap makes sure the sentinel configmap exists
func (*RedisClusterKubeClient) EnsureSentinelService ¶
func (r *RedisClusterKubeClient) EnsureSentinelService(rc *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error
EnsureSentinelService makes sure the sentinel service exists
func (*RedisClusterKubeClient) EnsureSentinelStatefulset ¶
func (r *RedisClusterKubeClient) EnsureSentinelStatefulset(rc *redisv1beta1.RedisCluster, labels map[string]string, ownerRefs []metav1.OwnerReference) error
EnsureSentinelStatefulset makes sure the sentinel deployment exists in the desired state