podutils

package
v0.29.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: Apache-2.0 Imports: 4 Imported by: 85

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPodAvailable

func IsPodAvailable(pod *corev1.Pod, minReadySeconds int32, now metav1.Time) bool

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 IsPodReady

func IsPodReady(pod *corev1.Pod) bool

IsPodReady returns true if a pod is ready; false otherwise.

func VisitContainers added in v0.27.0

func VisitContainers(podSpec *corev1.PodSpec, mask ContainerType, visitor ContainerVisitor) bool

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.

Types

type ActivePods

type ActivePods []*corev1.Pod

ActivePods type allows custom sorting of pods so a controller can pick the best ones to delete.

func (ActivePods) Len

func (s ActivePods) Len() int

func (ActivePods) Less

func (s ActivePods) Less(i, j int) bool

func (ActivePods) Swap

func (s ActivePods) Swap(i, j int)

type ByLogging

type ByLogging []*corev1.Pod

ByLogging allows custom sorting of pods so the best one can be picked for getting its logs.

func (ByLogging) Len

func (s ByLogging) Len() int

func (ByLogging) Less

func (s ByLogging) Less(i, j int) bool

func (ByLogging) Swap

func (s ByLogging) Swap(i, j int)

type ContainerType added in v0.27.0

type ContainerType int

ContainerType signifies container type

const (
	// Containers is for normal containers
	Containers ContainerType = 1 << iota
	// InitContainers is for init containers
	InitContainers
	// EphemeralContainers is for ephemeral containers
	EphemeralContainers
)

AllContainers specifies that all containers be visited.

type ContainerVisitor added in v0.27.0

type ContainerVisitor func(container *corev1.Container, containerType ContainerType) (shouldContinue bool)

ContainerVisitor is called with each container spec, and returns true if visiting should continue.

Jump to

Keyboard shortcuts

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