service

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRedisName

func GetRedisName(rf *redisfailoverv1.RedisFailover) string

GetRedisName returns the name for redis resources

func GetRedisShutdownConfigMapName

func GetRedisShutdownConfigMapName(rf *redisfailoverv1.RedisFailover) string

GetRedisShutdownConfigMapName returns the name for redis configmap

func GetRedisShutdownName

func GetRedisShutdownName(rf *redisfailoverv1.RedisFailover) string

GetRedisShutdownName returns the name for redis resources

func GetSentinelName

func GetSentinelName(rf *redisfailoverv1.RedisFailover) string

GetSentinelName returns the name for sentinel resources

Types

type RedisFailoverCheck

type RedisFailoverCheck interface {
	CheckRedisNumber(rFailover *redisfailoverv1.RedisFailover) error
	CheckSentinelNumber(rFailover *redisfailoverv1.RedisFailover) error
	CheckAllSlavesFromMaster(master string, rFailover *redisfailoverv1.RedisFailover) error
	CheckSentinelNumberInMemory(sentinel string, rFailover *redisfailoverv1.RedisFailover) error
	CheckSentinelSlavesNumberInMemory(sentinel string, rFailover *redisfailoverv1.RedisFailover) error
	CheckSentinelMonitor(sentinel string, monitor string) error
	GetMasterIP(rFailover *redisfailoverv1.RedisFailover) (string, error)
	GetNumberMasters(rFailover *redisfailoverv1.RedisFailover) (int, error)
	GetRedisesIPs(rFailover *redisfailoverv1.RedisFailover) ([]string, error)
	GetSentinelsIPs(rFailover *redisfailoverv1.RedisFailover) ([]string, error)
	GetMinimumRedisPodTime(rFailover *redisfailoverv1.RedisFailover) (time.Duration, error)
}

RedisFailoverCheck defines the interface able to check the correct status of a redis failover

type RedisFailoverChecker

type RedisFailoverChecker struct {
	// contains filtered or unexported fields
}

RedisFailoverChecker is our implementation of RedisFailoverCheck interface

func NewRedisFailoverChecker

func NewRedisFailoverChecker(k8sService k8s.Services, redisClient redis.Client, logger log.Logger) *RedisFailoverChecker

NewRedisFailoverChecker creates an object of the RedisFailoverChecker struct

func (*RedisFailoverChecker) CheckAllSlavesFromMaster

func (r *RedisFailoverChecker) CheckAllSlavesFromMaster(master string, rf *redisfailoverv1.RedisFailover) error

CheckAllSlavesFromMaster controlls that all slaves have the same master (the real one)

func (*RedisFailoverChecker) CheckRedisNumber

func (r *RedisFailoverChecker) CheckRedisNumber(rf *redisfailoverv1.RedisFailover) error

CheckRedisNumber controlls that the number of deployed redis is the same than the requested on the spec

func (*RedisFailoverChecker) CheckSentinelMonitor

func (r *RedisFailoverChecker) CheckSentinelMonitor(sentinel string, monitor string) error

CheckSentinelMonitor controls if the sentinels are monitoring the expected master

func (*RedisFailoverChecker) CheckSentinelNumber

func (r *RedisFailoverChecker) CheckSentinelNumber(rf *redisfailoverv1.RedisFailover) error

CheckSentinelNumber controlls that the number of deployed sentinel is the same than the requested on the spec

func (*RedisFailoverChecker) CheckSentinelNumberInMemory

func (r *RedisFailoverChecker) CheckSentinelNumberInMemory(sentinel string, rf *redisfailoverv1.RedisFailover) error

CheckSentinelNumberInMemory controls that the provided sentinel has only the living sentinels on its memory.

func (*RedisFailoverChecker) CheckSentinelSlavesNumberInMemory

func (r *RedisFailoverChecker) CheckSentinelSlavesNumberInMemory(sentinel string, rf *redisfailoverv1.RedisFailover) error

CheckSentinelSlavesNumberInMemory controls that the provided sentinel has only the expected slaves number.

func (*RedisFailoverChecker) GetMasterIP

GetMasterIP connects to all redis and returns the master of the redis failover

func (*RedisFailoverChecker) GetMinimumRedisPodTime

func (r *RedisFailoverChecker) GetMinimumRedisPodTime(rf *redisfailoverv1.RedisFailover) (time.Duration, error)

GetMinimumRedisPodTime returns the minimum time a pod is alive

func (*RedisFailoverChecker) GetNumberMasters

func (r *RedisFailoverChecker) GetNumberMasters(rf *redisfailoverv1.RedisFailover) (int, error)

GetNumberMasters returns the number of redis nodes that are working as a master

func (*RedisFailoverChecker) GetRedisesIPs

func (r *RedisFailoverChecker) GetRedisesIPs(rf *redisfailoverv1.RedisFailover) ([]string, error)

GetRedisesIPs returns the IPs of the Redis nodes

func (*RedisFailoverChecker) GetSentinelsIPs

func (r *RedisFailoverChecker) GetSentinelsIPs(rf *redisfailoverv1.RedisFailover) ([]string, error)

GetSentinelsIPs returns the IPs of the Sentinel nodes

type RedisFailoverClient

type RedisFailoverClient interface {
	EnsureSentinelService(rFailover *redisfailoverv1.RedisFailover, labels map[string]string, ownerRefs []metav1.OwnerReference) error
	EnsureSentinelConfigMap(rFailover *redisfailoverv1.RedisFailover, labels map[string]string, ownerRefs []metav1.OwnerReference) error
	EnsureSentinelDeployment(rFailover *redisfailoverv1.RedisFailover, labels map[string]string, ownerRefs []metav1.OwnerReference) error
	EnsureRedisStatefulset(rFailover *redisfailoverv1.RedisFailover, labels map[string]string, ownerRefs []metav1.OwnerReference) error
	EnsureRedisService(rFailover *redisfailoverv1.RedisFailover, labels map[string]string, ownerRefs []metav1.OwnerReference) error
	EnsureRedisShutdownConfigMap(rFailover *redisfailoverv1.RedisFailover, labels map[string]string, ownerRefs []metav1.OwnerReference) error
	EnsureRedisConfigMap(rFailover *redisfailoverv1.RedisFailover, labels map[string]string, ownerRefs []metav1.OwnerReference) error
	EnsureNotPresentRedisService(rFailover *redisfailoverv1.RedisFailover) error
}

RedisFailoverClient has the minimumm methods that a Redis failover controller needs to satisfy in order to talk with K8s

type RedisFailoverHeal

type RedisFailoverHeal interface {
	MakeMaster(ip string) error
	SetOldestAsMaster(rFailover *redisfailoverv1.RedisFailover) error
	SetMasterOnAll(masterIP string, rFailover *redisfailoverv1.RedisFailover) error
	NewSentinelMonitor(ip string, monitor string, rFailover *redisfailoverv1.RedisFailover) error
	RestoreSentinel(ip string) error
	SetSentinelCustomConfig(ip string, rFailover *redisfailoverv1.RedisFailover) error
	SetRedisCustomConfig(ip string, rFailover *redisfailoverv1.RedisFailover) error
}

RedisFailoverHeal defines the interface able to fix the problems on the redis failovers

type RedisFailoverHealer

type RedisFailoverHealer struct {
	// contains filtered or unexported fields
}

RedisFailoverHealer is our implementation of RedisFailoverCheck interface

func NewRedisFailoverHealer

func NewRedisFailoverHealer(k8sService k8s.Services, redisClient redis.Client, logger log.Logger) *RedisFailoverHealer

NewRedisFailoverHealer creates an object of the RedisFailoverChecker struct

func (*RedisFailoverHealer) MakeMaster

func (r *RedisFailoverHealer) MakeMaster(ip string) error

func (*RedisFailoverHealer) NewSentinelMonitor

func (r *RedisFailoverHealer) NewSentinelMonitor(ip string, monitor string, rf *redisfailoverv1.RedisFailover) error

NewSentinelMonitor changes the master that Sentinel has to monitor

func (*RedisFailoverHealer) RestoreSentinel

func (r *RedisFailoverHealer) RestoreSentinel(ip string) error

RestoreSentinel clear the number of sentinels on memory

func (*RedisFailoverHealer) SetMasterOnAll

func (r *RedisFailoverHealer) SetMasterOnAll(masterIP string, rf *redisfailoverv1.RedisFailover) error

SetMasterOnAll puts all redis nodes as a slave of a given master

func (*RedisFailoverHealer) SetOldestAsMaster

func (r *RedisFailoverHealer) SetOldestAsMaster(rf *redisfailoverv1.RedisFailover) error

SetOldestAsMaster puts all redis to the same master, choosen by order of appearance

func (*RedisFailoverHealer) SetRedisCustomConfig

func (r *RedisFailoverHealer) SetRedisCustomConfig(ip string, rf *redisfailoverv1.RedisFailover) error

SetRedisCustomConfig will call redis to set the configuration given in config

func (*RedisFailoverHealer) SetSentinelCustomConfig

func (r *RedisFailoverHealer) SetSentinelCustomConfig(ip string, rf *redisfailoverv1.RedisFailover) error

SetSentinelCustomConfig will call sentinel to set the configuration given in config

type RedisFailoverKubeClient

type RedisFailoverKubeClient struct {
	K8SService k8s.Services
	// contains filtered or unexported fields
}

RedisFailoverKubeClient implements the required methods to talk with kubernetes

func NewRedisFailoverKubeClient

func NewRedisFailoverKubeClient(k8sService k8s.Services, logger log.Logger) *RedisFailoverKubeClient

NewRedisFailoverKubeClient creates a new RedisFailoverKubeClient

func (*RedisFailoverKubeClient) EnsureNotPresentRedisService

func (r *RedisFailoverKubeClient) EnsureNotPresentRedisService(rf *redisfailoverv1.RedisFailover) error

EnsureNotPresentRedisService makes sure the redis service is not present

func (*RedisFailoverKubeClient) EnsureRedisConfigMap

func (r *RedisFailoverKubeClient) EnsureRedisConfigMap(rf *redisfailoverv1.RedisFailover, labels map[string]string, ownerRefs []metav1.OwnerReference) error

EnsureRedisConfigMap makes sure the sentinel configmap exists

func (*RedisFailoverKubeClient) EnsureRedisService

func (r *RedisFailoverKubeClient) EnsureRedisService(rf *redisfailoverv1.RedisFailover, labels map[string]string, ownerRefs []metav1.OwnerReference) error

EnsureRedisService makes sure the redis statefulset exists

func (*RedisFailoverKubeClient) EnsureRedisShutdownConfigMap

func (r *RedisFailoverKubeClient) EnsureRedisShutdownConfigMap(rf *redisfailoverv1.RedisFailover, labels map[string]string, ownerRefs []metav1.OwnerReference) error

EnsureRedisShutdownConfigMap makes sure the redis configmap with shutdown script exists

func (*RedisFailoverKubeClient) EnsureRedisStatefulset

func (r *RedisFailoverKubeClient) EnsureRedisStatefulset(rf *redisfailoverv1.RedisFailover, labels map[string]string, ownerRefs []metav1.OwnerReference) error

EnsureRedisStatefulset makes sure the redis statefulset exists in the desired state

func (*RedisFailoverKubeClient) EnsureSentinelConfigMap

func (r *RedisFailoverKubeClient) EnsureSentinelConfigMap(rf *redisfailoverv1.RedisFailover, labels map[string]string, ownerRefs []metav1.OwnerReference) error

EnsureSentinelConfigMap makes sure the sentinel configmap exists

func (*RedisFailoverKubeClient) EnsureSentinelDeployment

func (r *RedisFailoverKubeClient) EnsureSentinelDeployment(rf *redisfailoverv1.RedisFailover, labels map[string]string, ownerRefs []metav1.OwnerReference) error

EnsureSentinelDeployment makes sure the sentinel deployment exists in the desired state

func (*RedisFailoverKubeClient) EnsureSentinelService

func (r *RedisFailoverKubeClient) EnsureSentinelService(rf *redisfailoverv1.RedisFailover, labels map[string]string, ownerRefs []metav1.OwnerReference) error

EnsureSentinelService makes sure the sentinel service exists

Jump to

Keyboard shortcuts

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