package podutils
import "k8s.io/kubectl/pkg/util/podutils"
Index ¶
- func IsPodAvailable(pod *corev1.Pod, minReadySeconds int32, now metav1.Time) bool
- func IsPodReady(pod *corev1.Pod) bool
- func VisitContainers(podSpec *corev1.PodSpec, mask ContainerType, visitor ContainerVisitor) bool
- type ActivePods
- func (s ActivePods) Len() int
- func (s ActivePods) Less(i, j int) bool
- func (s ActivePods) Swap(i, j int)
- type ByLogging
- func (s ByLogging) Len() int
- func (s ByLogging) Less(i, j int) bool
- func (s ByLogging) Swap(i, j int)
- type ContainerType
- type ContainerVisitor
Functions ¶
func IsPodAvailable ¶
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 ¶
IsPodReady returns true if a pod is ready; false otherwise.
func VisitContainers ¶
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 ¶
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 ¶
ByLogging allows custom sorting of pods so the best one can be picked for getting its logs.
func (ByLogging) Len ¶
func (ByLogging) Less ¶
func (ByLogging) Swap ¶
type ContainerType ¶
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 )
const AllContainers ContainerType = (InitContainers | Containers | EphemeralContainers)
AllContainers specifies that all containers be visited.
type ContainerVisitor ¶
type ContainerVisitor func(container *corev1.Container, containerType ContainerType) (shouldContinue bool)
ContainerVisitor is called with each container spec, and returns true if visiting should continue.
Source Files ¶
podutils.go
- Version
- v0.33.0 (latest)
- Published
- Apr 23, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 2 hours ago –
Tools for package owners.