utils

package
v0.0.0-...-9b96d08 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractNamespacedName

func ExtractNamespacedName(object metav1.Object) types.NamespacedName

ExtractNamespacedName returns an NamespacedName based on the given Object.

func GetByName

func GetByName(ssetName string, expectName string) bool

func GetCurrentPods

func GetCurrentPods(c k8s.Client, w *cachev1alpha1.Workload, label map[string]string, log logr.Logger) ([]corev1.Pod, error)

func GetPodIp

func GetPodIp(w *cachev1alpha1.Workload, podNames []string) []string

getReplsetAddrs returns a slice of replset host:port addresses

func GetReplicas

func GetReplicas(sts appsv1.StatefulSet) int32

func GetServiceUrl

func GetServiceUrl(w *cachev1alpha1.Workload, pods []corev1.Pod) (string, []string)

func GetStatefulSetPods

func GetStatefulSetPods(c k8s.Client, w *cachev1alpha1.Workload, label map[string]string, log logr.Logger) (*appsv1.StatefulSet, *corev1.PodList, error)

func IsPodReady

func IsPodReady(pod corev1.Pod) bool

IsAvailable checks if both conditions ContainersReady and PodReady of a Pod are true.

func Joins

func Joins(args ...string) string

func PodName

func PodName(ssetName string, ordinal int32) string

PodName returns the name of the pod with the given ordinal for this StatefulSet.

func PodNames

func PodNames(sset appsv1.StatefulSet) []string

func PodRunningAndReady

func PodRunningAndReady(pod corev1.Pod) (bool, error)

PodRunningAndReady returns whether a pod is running and each container has passed it's ready state.

func RemoveStringInSlice

func RemoveStringInSlice(s string, slice []string) []string

RemoveStringInSlice returns a new slice with all occurrences of s removed, keeping the given slice unmodified

func StringInSlice

func StringInSlice(str string, list []string) bool

StringInSlice returns true if the given string is found in the provided slice, else returns false

func StringsInSlice

func StringsInSlice(strings []string, slice []string) bool

StringsInSlice returns true if the given strings are found in the provided slice, else returns false

Types

This section is empty.

Jump to

Keyboard shortcuts

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