kube

package
v0.4.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
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

func IsContainerExisted(pod *core.Pod, c Container) bool

IsContainerExisted returns true if Container is existed.

func IsContainerRunning

func IsContainerRunning(pod *core.Pod, c Container) bool

IsContainerRunning returns true if Container is running.

func IsPodAssigned

func IsPodAssigned(pod *core.Pod) bool

IsPodAssigned returns true if Pod is assigned.

func IsPodReady

func IsPodReady(pod *core.Pod) bool

IsPodReady returns true if Pod is ready.

func IsPodRunning

func IsPodRunning(pod *core.Pod) bool

IsPodRunning returns ture if Pod is running.

func NamespacedName

func NamespacedName(ns, n string) string

NamespacedName constructs the given {namespace, name} into one string.

func ParseNamespacedName

func ParseNamespacedName(s string) (ns, n string)

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.

Jump to

Keyboard shortcuts

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