Documentation ¶
Index ¶
- func DropDisabledPodFields(pod, oldPod *api.Pod)
- func DropDisabledTemplateFields(podTemplate, oldPodTemplate *api.PodTemplateSpec)
- func GetPodCondition(status *api.PodStatus, conditionType api.PodConditionType) (int, *api.PodCondition)
- func GetPodReadyCondition(status api.PodStatus) *api.PodCondition
- func IsPodReady(pod *api.Pod) bool
- func IsPodReadyConditionTrue(status api.PodStatus) bool
- func UpdatePodCondition(status *api.PodStatus, condition *api.PodCondition) bool
- func VisitContainers(podSpec *api.PodSpec, mask ContainerType, visitor ContainerVisitor) bool
- func VisitPodConfigmapNames(pod *api.Pod, visitor Visitor) bool
- func VisitPodSecretNames(pod *api.Pod, visitor Visitor) bool
- type ContainerType
- type ContainerVisitor
- type Visitor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DropDisabledPodFields ¶
DropDisabledPodFields removes disabled fields from the pod metadata and spec. This should be called from PrepareForCreate/PrepareForUpdate for all resources containing a Pod
func DropDisabledTemplateFields ¶
func DropDisabledTemplateFields(podTemplate, oldPodTemplate *api.PodTemplateSpec)
DropDisabledTemplateFields removes disabled fields from the pod template metadata and spec. This should be called from PrepareForCreate/PrepareForUpdate for all resources containing a PodTemplateSpec
func GetPodCondition ¶
func GetPodCondition(status *api.PodStatus, conditionType api.PodConditionType) (int, *api.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 GetPodReadyCondition ¶
func GetPodReadyCondition(status api.PodStatus) *api.PodCondition
GetPodReadyCondition extracts the pod ready condition from the given status and returns that. Returns nil if the condition is not present.
func IsPodReady ¶
IsPodReady returns true if a pod is ready; false otherwise.
func IsPodReadyConditionTrue ¶
IsPodReadyConditionTrue returns true if a pod is ready; false otherwise.
func UpdatePodCondition ¶
func UpdatePodCondition(status *api.PodStatus, condition *api.PodCondition) bool
UpdatePodCondition 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 VisitContainers ¶
func VisitContainers(podSpec *api.PodSpec, mask ContainerType, visitor ContainerVisitor) bool
VisitContainers invokes the visitor function with a pointer to the container spec of every container in the given pod spec. If visitor returns false, visiting is short-circuited. VisitContainers returns true if visiting completes, false if visiting was short-circuited.
With the default mask (zero value or DefaultContainers) VisitContainers will visit all containers enabled by current feature gates. If mask is non-zero, VisitContainers will unconditionally visit container types specified by mask, and no feature gate checks will be performed.
func VisitPodConfigmapNames ¶
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.
Types ¶
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
const DefaultContainers ContainerType = 0
DefaultContainers defines default behavior: Iterate containers based on feature gates
type ContainerVisitor ¶
type ContainerVisitor func(container *api.Container, containerType ContainerType) (shouldContinue bool)
ContainerVisitor is called with each container spec, and returns true if visiting should continue.