Documentation ¶
Index ¶
- Constants
- Variables
- func DoItSlowly(count int, initialBatchSize int, fn func() error) (int, error)
- func GetActivePods(reader client.Reader, opts *client.ListOptions) ([]*v1.Pod, error)
- func GetControllerKey(cs *appsv1alpha1.CloneSet) string
- func GetPersistentVolumeClaims(cs *appsv1alpha1.CloneSet, pod *v1.Pod) map[string]v1.PersistentVolumeClaim
- func IsRunningAndAvailable(pod *v1.Pod, minReadySeconds int32) bool
- func IsRunningAndReady(pod *v1.Pod) bool
- func NextRevision(revisions []*apps.ControllerRevision) int64
- func SplitPodsByRevision(pods []*v1.Pod, rev string) (matched, unmatched []*v1.Pod)
- func UpdateStorage(cs *appsv1alpha1.CloneSet, pod *v1.Pod)
- type ActivePodsWithRanks
- type PodSpreadConstraint
- type Ranker
Constants ¶
const ( // PodDeletionCost can be used to set to an int32 that represent the cost of deleting // a pod compared to other pods belonging to the same ReplicaSet. Pods with lower // deletion cost are preferred to be deleted before pods with higher deletion cost. PodDeletionCost = "controller.kubernetes.io/pod-deletion-cost" )
Variables ¶
var ( // ControllerKind is GroupVersionKind for CloneSet. ControllerKind = appsv1alpha1.SchemeGroupVersion.WithKind("CloneSet") RevisionAdapterImpl = &revisionAdapterImpl{} EqualToRevisionHash = RevisionAdapterImpl.EqualToRevisionHash WriteRevisionHash = RevisionAdapterImpl.WriteRevisionHash ScaleExpectations = expectations.NewScaleExpectations() UpdateExpectations = expectations.NewUpdateExpectations(RevisionAdapterImpl) ResourceVersionExpectations = expectations.NewResourceVersionExpectation() )
Functions ¶
func DoItSlowly ¶
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 ¶
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 IsRunningAndAvailable ¶ added in v0.4.1
IsRunningAndAvailable returns true if pod is in the PodRunning Phase, if it is available.
func IsRunningAndReady ¶
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 ¶ added in v0.5.0
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 ¶
type ActivePodsWithRanks ¶ added in v0.10.0
ActivePodsWithRanks type allows custom sorting of pods so a controller can pick the best ones to delete.
func (ActivePodsWithRanks) Len ¶ added in v0.10.0
func (s ActivePodsWithRanks) Len() int
func (ActivePodsWithRanks) Less ¶ added in v0.10.0
func (s ActivePodsWithRanks) Less(i, j int) bool
func (ActivePodsWithRanks) Swap ¶ added in v0.10.0
func (s ActivePodsWithRanks) Swap(i, j int)