util

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClusterLabels

func ClusterLabels(c *cassandrav1alpha1.Cluster) map[string]string

ClusterLabels returns a map of label keys and values for the given Cluster.

func DatacenterLabels

func DatacenterLabels(c *cassandrav1alpha1.Cluster) map[string]string

DatacenterLabels returns a map of label keys and values for the given Datacenter.

func GerMemberServicesForRack

func GerMemberServicesForRack(
	r cassandrav1alpha1.RackSpec,
	c *cassandrav1alpha1.Cluster,
	serviceLister corelisters.ServiceLister,
) ([]*corev1.Service, error)

GetMemberServicesForRack returns the member services for the given rack.

func GetDataDir

func GetDataDir(c *cassandrav1alpha1.Cluster) string

GetDataDir returns the directory used to store the database data

func GetPodsForCluster

func GetPodsForCluster(cluster *cassandrav1alpha1.Cluster, podLister corelisters.PodLister) ([]*corev1.Pod, error)

GetPodsForCluster returns the existing Pods for the given cluster

func GetPodsForRack

func GetPodsForRack(
	r cassandrav1alpha1.RackSpec,
	c *cassandrav1alpha1.Cluster,
	podLister corelisters.PodLister,
) ([]*corev1.Pod, error)

GetPodsForRack returns the created Pods for the given rack.

func HeadlessServiceNameForCluster

func HeadlessServiceNameForCluster(c *cassandrav1alpha1.Cluster) string

func ImageForCluster

func ImageForCluster(c *cassandrav1alpha1.Cluster) string

func IndexFromName

func IndexFromName(n string) (int32, error)

IndexFromName attempts to get the index from a name using the naming convention <name>-<index>.

func IsPodUnschedulable

func IsPodUnschedulable(pod *corev1.Pod) bool

isPodUnschedulable iterates a Pod's Status.Conditions to find out if it has been deemed unschedulable

func IsRackConditionTrue

func IsRackConditionTrue(rackStatus *cassandrav1alpha1.RackStatus, condType cassandrav1alpha1.RackConditionType) bool

IsRackConditionTrue checks a rack's status for the presence of a condition type and checks if it is true.

func Max

func Max(x, y int64) int64

Max returns the bigger of two given numbers

func Min

func Min(x, y int64) int64

Min returns the smaller of two given numbers

func NewControllerRef

func NewControllerRef(c *cassandrav1alpha1.Cluster) metav1.OwnerReference

NewControllerRef returns an OwnerReference to the provided Cluster Object

func PatchClusterStatus

func PatchClusterStatus(c *cassandrav1alpha1.Cluster, rookClient versioned.Interface) error

PatchCluster patches the old Cluster so that it matches the new Cluster.

func PatchService

func PatchService(old, new *corev1.Service, kubeClient kubernetes.Interface) error

PatchService patches the old Service so that it matches the new Service.

func PatchStatefulSet

func PatchStatefulSet(old, new *appsv1.StatefulSet, kubeClient kubernetes.Interface) error

PatchStatefulSet patches the old StatefulSet so that it matches the new StatefulSet.

func RackLabels

RackLabels returns a map of label keys and values for the given Rack.

func RackSelector

RackSelector returns a LabelSelector for the given rack.

func RefFromInt

func RefFromInt(i int32) *int32

RefFromInt is a helper function that takes a int and outputs a reference to that int. Useful for initializing an int pointer from a literal.

func RefFromInt32

func RefFromInt32(i int32) *int32

RefFromInt32 is a helper function that takes a int32 and outputs a reference to that int.

func RefFromInt64

func RefFromInt64(i int64) *int64

RefFromInt64 is a helper function that takes a int64 and outputs a reference to that int.

func RefFromString

func RefFromString(s string) *string

RefFromString is a helper function that takes a string and outputs a reference to that string. Useful for initializing a string pointer from a literal.

func ScaleStatefulSet

func ScaleStatefulSet(sts *appsv1.StatefulSet, amount int32, kubeClient kubernetes.Interface) error

ScaleStatefulSet attempts to scale a StatefulSet by the given amount

func ServiceAccountNameForMembers

func ServiceAccountNameForMembers(c *cassandrav1alpha1.Cluster) string

func StatefulSetPodLabel

func StatefulSetPodLabel(name string) map[string]string

StatefulSetPodLabel returns a map of labels to uniquely identify a StatefulSet Pod with the given name

func StatefulSetStatusesStale

func StatefulSetStatusesStale(c *cassandrav1alpha1.Cluster, statefulSetLister appslisters.StatefulSetLister) (bool, error)

StatefulSetStatusesStale checks if the StatefulSet Objects of a Cluster have been observed by the StatefulSet controller. If they haven't, their status might be stale, so it's better to wait and process them later.

func VerifyOwner

func VerifyOwner(obj, owner metav1.Object) error

VerifyOwner checks if the owner Object is the controller of the obj Object and returns an error if it isn't.

Types

This section is empty.

Jump to

Keyboard shortcuts

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