pods

package
v3.4.3 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: Apache-2.0 Imports: 24 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecCmd added in v3.0.81

func ExecCmd(client kubernetes.Interface, config *restclient.Config, podName, ns string,
	command string) (string, string, error)

ExecCmd exec command on specific pod and wait the command's output.

func GetContainersWithStatusAndIsInit

func GetContainersWithStatusAndIsInit(pod *v1.Pod) ([]v1.Container, []v1.ContainerStatus, bool)

GetContainersWithStatusAndIsInit gets the containers in the pod, either init containers or non-init depending on whether non-init containers are present, and a flag as to whether this list of containers are just init containers or not.

func GetCurrentPod

func GetCurrentPod(kubeClient kubernetes.Interface, ns string) (*v1.Pod, error)

GetCurrentPod returns the current pod the code is running in or nil if it cannot be deduced

func GetFirstPodForService added in v3.0.81

func GetFirstPodForService(client kubernetes.Interface, svc *v1.Service, namespace string) (v1.Pod, error)

func GetPodCondition

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. credit https://github.com/kubernetes/kubernetes/blob/8719b4a/pkg/api/v1/pod/util.go

func GetPodNames

func GetPodNames(client kubernetes.Interface, ns string, filter string) ([]string, error)

func GetPodReadyCondition

func GetPodReadyCondition(status v1.PodStatus) *v1.PodCondition

GetPodReadyCondition Extracts the pod ready condition from the given status and returns that. Returns nil if the condition is not present. credit https://github.com/kubernetes/kubernetes/blob/8719b4a/pkg/api/v1/pod/util.go

func GetPodRestarts

func GetPodRestarts(pod *v1.Pod) int32

GetPodRestarts returns the number of restarts of a POD

func GetPods

func GetPods(client kubernetes.Interface, ns string, filter string) ([]string, map[string]*v1.Pod, error)

func GetPodsWithLabels

func GetPodsWithLabels(client kubernetes.Interface, ns string, selector string) ([]string, map[string]*v1.Pod, error)

func GetReadyPodForSelector

func GetReadyPodForSelector(client kubernetes.Interface, namespace string, selector string) (*corev1.Pod, error)

GetReadyPodForSelector returns the first ready pod for the given selector or nil

func GetRunningPodForSelector added in v3.0.89

func GetRunningPodForSelector(client kubernetes.Interface, namespace string, selector string) (*corev1.Pod, error)

GetRunningPodForSelector returns the first pod running for the given selector or nil

func HasContainerStarted

func HasContainerStarted(pod *v1.Pod, idx int) bool

HasContainerStarted returns true if the given Container has started running

func IsPodCompleted

func IsPodCompleted(pod *v1.Pod) bool

IsPodCompleted returns true if a pod is completed (succeeded or failed); false otherwise.

func IsPodFailed added in v3.0.46

func IsPodFailed(pod *v1.Pod) bool

IsPodFailed returns true if a pod is failed

func IsPodPending added in v3.0.48

func IsPodPending(pod *v1.Pod) bool

IsPodPending returns true if a pod is pending

func IsPodReady

func IsPodReady(pod *v1.Pod) bool

IsPodReady returns true if a pod is ready; false otherwise. credit https://github.com/kubernetes/kubernetes/blob/8719b4a/pkg/api/v1/pod/util.go

func IsPodReadyConditionTrue

func IsPodReadyConditionTrue(status v1.PodStatus) bool

IsPodReady retruns true if a pod is ready; false otherwise. credit https://github.com/kubernetes/kubernetes/blob/8719b4a/pkg/api/v1/pod/util.go

func IsPodRunning added in v3.0.73

func IsPodRunning(pod *corev1.Pod) bool

IsPodRunning returns true if a pod is running

func IsPodSucceeded

func IsPodSucceeded(pod *v1.Pod) bool

IsPodSucceeded returns true if a pod is succeeded

func ListOptionsString

func ListOptionsString(options *metav1.ListOptions) string

ListOptionsString returns a string summary of the list options

func PodStatus

func PodStatus(pod *v1.Pod) string

func WaitForPod added in v3.0.73

func WaitForPod(client kubernetes.Interface, namespace string, optionsModifier func(options *metav1.ListOptions), timeout time.Duration, condition PodPredicate) (*v1.Pod, error)

WaitForPod waits for a pod filtered by `optionsModifier` that match `condition`

func WaitForPodNameToBeComplete

func WaitForPodNameToBeComplete(client kubernetes.Interface, namespace string, name string,
	timeout time.Duration) error

WaitForPodNameToBeComplete waits for the pod to complete (succeed or fail) using the pod name

func WaitForPodNameToBeReady

func WaitForPodNameToBeReady(client kubernetes.Interface, namespace string, name string, timeout time.Duration) error

WaitForPodNameToBeReady waits for the pod with the given name to become ready

func WaitForPodNameToBeRunning added in v3.0.17

func WaitForPodNameToBeRunning(client kubernetes.Interface, namespace string, name string, timeout time.Duration) error

WaitForPodNameToBeRunning waits for the pod with the given name to be running

func WaitForPodSelectorToBeReady

func WaitForPodSelectorToBeReady(client kubernetes.Interface, namespace string, selector string, timeout time.Duration) (*corev1.Pod, error)

WaitForPodSelectorToBeReady waits for the pod to become ready using the given selector name it also has the side effect of logging the following * the logs of a pod that is detected as failed * the status of the pod

func WaitforPodNameCondition added in v3.0.17

func WaitforPodNameCondition(client kubernetes.Interface, namespace string, name string, timeout time.Duration, condition PodPredicate) error

WaitforPodNameCondition waits for the given pod name to match the given condition function

Types

type PodPredicate added in v3.0.73

type PodPredicate func(pod *v1.Pod) bool

PodPredicate is a predicate over a pod

Jump to

Keyboard shortcuts

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