// IsPodAvailable returns true if a pod is available; false otherwise. // Precondition for an available pod is that it must be ready. On top // of that, there are two cases when a pod can be considered available: // 1. minReadySeconds == 0, or // 2. LastTransitionTime (is set) + minReadySeconds < current time func IsPodAvailable(pod *corev1.Pod, minReadySeconds int32, now metav1.Time) bool { … } // IsPodReady returns true if a pod is ready; false otherwise. func IsPodReady(pod *corev1.Pod) bool { … } func isPodDeleting(pod *corev1.Pod) bool { … } // IsPodReadyConditionTrue returns true if a pod is ready; false otherwise. func isPodReadyConditionTrue(status corev1.PodStatus) bool { … } // GetPodReadyCondition extracts the pod ready condition from the given status and returns that. // Returns nil if the condition is not present. func getPodReadyCondition(status corev1.PodStatus) *corev1.PodCondition { … } // GetPodCondition extracts the provided condition from the given status and returns that. // Returns nil and -1 if the condition is not present, and the index of the located condition. func getPodCondition(status *corev1.PodStatus, conditionType corev1.PodConditionType) (int, *corev1.PodCondition) { … } // GetPodConditionFromList extracts the provided condition from the given list of condition and // returns the index of the condition and the condition. Returns -1 and nil if the condition is not present. func getPodConditionFromList(conditions []corev1.PodCondition, conditionType corev1.PodConditionType) (int, *corev1.PodCondition) { … } type ByLogging … func (s ByLogging) Len() int { … } func (s ByLogging) Swap(i, j int) { … } func (s ByLogging) Less(i, j int) bool { … } type ActivePods … func (s ActivePods) Len() int { … } func (s ActivePods) Swap(i, j int) { … } func (s ActivePods) Less(i, j int) bool { … } // afterOrZero checks if time t1 is after time t2; if one of them // is zero, the zero time is seen as after non-zero time. func afterOrZero(t1, t2 *metav1.Time) bool { … } func podReadyTime(pod *corev1.Pod) *metav1.Time { … } func maxContainerRestarts(pod *corev1.Pod) int { … } type ContainerType … const Containers … const InitContainers … const EphemeralContainers … const AllContainers … type ContainerVisitor … // VisitContainers invokes the visitor function with a pointer to every container // spec in the given pod spec with type set in mask. If visitor returns false, // visiting is short-circuited. VisitContainers returns true if visiting completes, // false if visiting was short-circuited. func VisitContainers(podSpec *corev1.PodSpec, mask ContainerType, visitor ContainerVisitor) bool { … }