utils

package
v0.0.0-...-a9bd9a2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Kilobyte = 1000
	Kibibyte = 1024
)

Variables

View Source
var BUILDTIME string
View Source
var OPERATOR_VERSION string
View Source
var REDIS_VERSION string
View Source
var REVISION string

Functions

func BuildInfos

func BuildInfos()

BuildInfos returns builds information

func GetKubeNodes

func GetKubeNodes(ctx context.Context, kubeClient client.Client, nodeSelector map[string]string) ([]corev1.Node, error)

func GetNbPodsToCreate

func GetNbPodsToCreate(cluster *rapi.RedisCluster) int32

func GetZone

func GetZone(nodeName string, kubeNodes []corev1.Node) string

func GetZoneSkew

func GetZoneSkew(zoneToNodes map[string][]string) int

func GetZoneSkewByRole

func GetZoneSkewByRole(zoneToPrimaries map[string][]string, zoneToReplicas map[string][]string) (int, int, bool)

func GetZones

func GetZones(nodes []corev1.Node) []string

func IsPodReady

func IsPodReady(pod *corev1.Pod) (bool, error)

IsPodReady check if pod is in ready condition, return the error message otherwise

func ListPods

func ListPods(ctx context.Context, kubeClient client.Client, opts []client.ListOption) ([]corev1.Pod, error)

func SliceJoin

func SliceJoin(a []Stringer, sep string) string

SliceJoin concatenates the elements of a to create a single string. The separator string sep is placed between elements in the resulting string.

func StringToByteString

func StringToByteString(value string) (string, error)

func ZoneToRole

func ZoneToRole(nodes []rapi.RedisClusterNode) (map[string][]string, map[string][]string)

Types

type LogWriter

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

LogWriter struct representation of a log writter, containing the pointer of the logging function

func NewLogWriter

func NewLogWriter(f func(args ...interface{})) *LogWriter

NewLogWriter create a new LogWriter with the pointer of the logging function in input

func (LogWriter) Write

func (w LogWriter) Write(p []byte) (n int, err error)

Write implements the standard Write interface: it writes using the logging function

type Stringer

type Stringer interface {
	String() string
}

Stringer implements the string interface

Jump to

Keyboard shortcuts

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