utils

package
v0.0.0-...-7f68784 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ControllerKind = appsv1alpha1.SchemeGroupVersion.WithKind("CloneSet")

ControllerKind is GroupVersionKind for CloneSet.

Functions

func DoItSlowly

func DoItSlowly(count int, initialBatchSize int, fn func() error) (int, error)

DoItSlowly tries to call the provided function a total of 'count' times, starting slow to check for errors, then speeding up if calls succeed.

It groups the calls into batches, starting with a group of initialBatchSize. Within each batch, it may call the function multiple times concurrently.

If a whole batch succeeds, the next batch may get exponentially larger. If there are any failures in a batch, all remaining batches are skipped after waiting for the current batch to complete.

It returns the number of successful calls to the function.

func GetActivePods

func GetActivePods(reader client.Reader, opts *client.ListOptions) ([]*v1.Pod, error)

GetActivePods returns all active pods in this namespace.

func GetControllerKey

func GetControllerKey(cs *appsv1alpha1.CloneSet) string

GetControllerKey return key of CloneSet.

func GetPersistentVolumeClaims

func GetPersistentVolumeClaims(cs *appsv1alpha1.CloneSet, pod *v1.Pod) map[string]v1.PersistentVolumeClaim

GetPersistentVolumeClaims gets a map of PersistentVolumeClaims to their template names, as defined in set. The returned PersistentVolumeClaims are each constructed with a the name specific to the Pod. This name is determined by getPersistentVolumeClaimName.

func GetPodRevision

func GetPodRevision(pod metav1.Object) string

GetPodRevision returns revision hash of this pod.

func GetPodsRevisions

func GetPodsRevisions(pods []*v1.Pod) sets.String

GetPodsRevisions return revision hash set of these pods.

func IsRunningAndAvailable

func IsRunningAndAvailable(pod *v1.Pod, minReadySeconds int32) bool

IsRunningAndAvailable returns true if pod is in the PodRunning Phase, if it is available.

func IsRunningAndReady

func IsRunningAndReady(pod *v1.Pod) bool

IsRunningAndReady returns true if pod is in the PodRunning Phase, if it is ready.

func NextRevision

func NextRevision(revisions []*apps.ControllerRevision) int64

NextRevision finds the next valid revision number based on revisions. If the length of revisions is 0 this is 1. Otherwise, it is 1 greater than the largest revision's Revision. This method assumes that revisions has been sorted by Revision.

func SplitPodsByRevision

func SplitPodsByRevision(pods []*v1.Pod, rev string) (matched, unmatched []*v1.Pod)

SplitPodsByRevision returns Pods matched and unmatched the given revision

func UpdateStorage

func UpdateStorage(cs *appsv1alpha1.CloneSet, pod *v1.Pod)

UpdateStorage insert volumes generated by cs.Spec.VolumeClaimTemplates into Pod.

Types

This section is empty.

Jump to

Keyboard shortcuts

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