Documentation ¶
Index ¶
- func FindPort(pod *v1.Pod, svcPort *v1.ServicePort) (int, error)
- func GetContainerStatus(statuses []v1.ContainerStatus, name string) (v1.ContainerStatus, bool)
- func GetExistingContainerStatus(statuses []v1.ContainerStatus, name string) v1.ContainerStatus
- func GetPodCondition(status *v1.PodStatus, conditionType v1.PodConditionType) (int, *v1.PodCondition)
- func GetPodConditionFromList(conditions []v1.PodCondition, conditionType v1.PodConditionType) (int, *v1.PodCondition)
- func GetPodReadyCondition(status v1.PodStatus) *v1.PodCondition
- func IsPodAvailable(pod *v1.Pod, minReadySeconds int32, now metav1.Time) bool
- func IsPodReady(pod *v1.Pod) bool
- func IsPodReadyConditionTrue(status v1.PodStatus) bool
- func UpdatePodCondition(status *v1.PodStatus, condition *v1.PodCondition) bool
- func VisitPodConfigmapNames(pod *v1.Pod, visitor Visitor) bool
- func VisitPodSecretNames(pod *v1.Pod, visitor Visitor) bool
- type Visitor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindPort ¶
FindPort locates the container port for the given pod and portName. If the targetPort is a number, use that. If the targetPort is a string, look that string up in all named ports in all containers in the target pod. If no match is found, fail.
func GetContainerStatus ¶ added in v1.7.0
func GetContainerStatus(statuses []v1.ContainerStatus, name string) (v1.ContainerStatus, bool)
GetContainerStatus extracts the status of container "name" from "statuses". It also returns if "name" exists.
func GetExistingContainerStatus ¶ added in v1.7.0
func GetExistingContainerStatus(statuses []v1.ContainerStatus, name string) v1.ContainerStatus
GetExistingContainerStatus extracts the status of container "name" from "statuses", It also returns if "name" exists.
func GetPodCondition ¶ added in v1.7.0
func GetPodCondition(status *v1.PodStatus, conditionType v1.PodConditionType) (int, *v1.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 GetPodConditionFromList ¶ added in v1.11.1
func GetPodConditionFromList(conditions []v1.PodCondition, conditionType v1.PodConditionType) (int, *v1.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 GetPodReadyCondition ¶ added in v1.7.0
func GetPodReadyCondition(status v1.PodStatus) *v1.PodCondition
Extracts the pod ready condition from the given status and returns that. Returns nil if the condition is not present.
func IsPodAvailable ¶ added in v1.7.0
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 ¶ added in v1.7.0
IsPodReady returns true if a pod is ready; false otherwise.
func IsPodReadyConditionTrue ¶ added in v1.7.0
IsPodReady returns true if a pod is ready; false otherwise.
func UpdatePodCondition ¶ added in v1.7.0
func UpdatePodCondition(status *v1.PodStatus, condition *v1.PodCondition) bool
Updates existing pod condition or creates a new one. Sets LastTransitionTime to now if the status has changed. Returns true if pod condition has changed or has been added.
func VisitPodConfigmapNames ¶ added in v1.7.0
VisitPodConfigmapNames invokes the visitor function with the name of every configmap referenced by the pod spec. If visitor returns false, visiting is short-circuited. Transitive references (e.g. pod -> pvc -> pv -> secret) are not visited. Returns true if visiting completed, false if visiting was short-circuited.
func VisitPodSecretNames ¶
VisitPodSecretNames invokes the visitor function with the name of every secret referenced by the pod spec. If visitor returns false, visiting is short-circuited. Transitive references (e.g. pod -> pvc -> pv -> secret) are not visited. Returns true if visiting completed, false if visiting was short-circuited.