cluster

package
v0.0.0-...-0227cab Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IsPersistentEnabled = (os.Getenv("PERSISTENT_ENABLED") == "true")
	IsNodePortEnaled    = (os.Getenv("NODEPORT_ENABLED") == "true")
	IsTLSEnabled        = (os.Getenv("TLS_ENABLED") == "true")
)

Functions

func Check

func Check(ctx context.Context, addr string, authInfo redis.AuthInfo) error

func DefaultOwnerReferences

func DefaultOwnerReferences(pod *corev1.Pod) []metav1.OwnerReference

func ExposeNodePort

func ExposeNodePort(ctx context.Context, client *kubernetes.Clientset, namespace, podName, ipfamily string, nodeportEnabled bool, customPort bool, logger logr.Logger) error

ExposeNodePort

func GetPod

func GetPod(ctx context.Context, client *kubernetes.Clientset, namespace, name string, logger logr.Logger) (*corev1.Pod, error)

GetPod

func GetStatefulSet

func GetStatefulSet(ctx context.Context, client *kubernetes.Clientset, namespace, name string) (*appv1.StatefulSet, error)

GetStatefulSet

func Heal

func Heal(ctx context.Context, c *cli.Context, client *kubernetes.Clientset, logger logr.Logger) error

Heal heal may fail when updated password for redis 4,5

func NewCommand

func NewCommand(ctx context.Context) *cli.Command

func Ping

func Ping(ctx context.Context, addr string, authInfo redis.AuthInfo) error

Ping

func Readiness

func Readiness(ctx context.Context, addr string, authInfo redis.AuthInfo) error

func RetryGet

func RetryGet(f func() error, steps ...int) error

RetryGet

func RetryGetService

func RetryGetService(clientset *kubernetes.Clientset, svcNamespace, svcName string, isCluster bool, count int) (*corev1.Service, error)

func Shutdown

func Shutdown(ctx context.Context, c *cli.Context, client *kubernetes.Clientset, logger logr.Logger) error

Shutdown 在退出时做 failover

NOTE: 在4.0, 5.0中,在更新密码时,会重启实例。但是由于密码在重启前已经热更新,导致其他脚本无法连接到实例,包括shutdown脚本 为了解决这个问题,针对4,5 版本,会在重启前,先做failover,将master failover 到-0 节点。 由于重启是逆序的,最后一个pod启动成功之后,会使用新密码连接到 master,从而确保服务一直可用,切数据不会丢失

func SyncToLocal

func SyncToLocal(ctx context.Context, client *kubernetes.Clientset, namespace, name,
	workspace, target string, logger logr.Logger) ([]byte, error)

Sync

func TcpSocket

func TcpSocket(ctx context.Context, addr string, t time.Duration) error

TcpSocket

Types

type FailoverAction

type FailoverAction string
const (
	NoFailoverAction       FailoverAction = ""
	ForceFailoverAction    FailoverAction = "FORCE"
	TakeoverFailoverAction FailoverAction = "TAKEOVER"
)

Jump to

Keyboard shortcuts

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