Documentation ¶
Index ¶
- Constants
- func GetPodCondition(status *core.PodStatus, conditionType core.PodConditionType) (c *core.PodCondition, exist bool)
- func IsContainerExisted(pod *core.Pod, c Container) bool
- func IsContainerRunning(pod *core.Pod, c Container) bool
- func IsPodAssigned(pod *core.Pod) bool
- func IsPodReady(pod *core.Pod) bool
- func IsPodRunning(pod *core.Pod) bool
- func NamespacedName(ns, n string) string
- func ParseNamespacedName(s string) (ns, n string)
- type Container
- type ContainerState
- type ContainerStateType
- type ContainerType
Constants ¶
const ( ContainerRun = "run" ContainerInit = "init" ContainerEphemeral = "ephemeral" )
Variables ¶
This section is empty.
Functions ¶
func GetPodCondition ¶
func GetPodCondition(status *core.PodStatus, conditionType core.PodConditionType) (c *core.PodCondition, exist bool)
GetPodCondition extracts the provided condition from the given PodStatus and returns that.
func IsContainerExisted ¶
IsContainerExisted returns true if Container is existed.
func IsContainerRunning ¶
IsContainerRunning returns true if Container is running.
func IsPodAssigned ¶
IsPodAssigned returns true if Pod is assigned.
func IsPodRunning ¶
IsPodRunning returns ture if Pod is running.
func NamespacedName ¶
NamespacedName constructs the given {namespace, name} into one string.
func ParseNamespacedName ¶
ParseNamespacedName parses the given string into {namespace, name}, e.g. kube-system/coredns.
Types ¶
type Container ¶
type Container struct { Type ContainerType Name string }
Container holds container type and name.
type ContainerState ¶
type ContainerState struct { Type ContainerType Namespace string Pod string ID string Name string State ContainerStateType }
func GetContainerStates ¶
func GetContainerStates(pod *core.Pod) (r []ContainerState)
GetContainerStates returns ContainerState list of the given Pod.
func (ContainerState) String ¶
func (c ContainerState) String() string
type ContainerStateType ¶
type ContainerStateType uint8
ContainerStateType indicates the state type of the Container, includes Unknown, Waiting, Running, Terminated.
const ( ContainerStateUnknown ContainerStateType = iota ContainerStateWaiting ContainerStateRunning ContainerStateTerminated )
func GetContainerStateType ¶
func GetContainerStateType(s *core.ContainerStatus) ContainerStateType
type ContainerType ¶
type ContainerType = string
ContainerType indicates the type of the Container, includes Run, Init, Ephemeral.