public class PodStatusUtil extends Object
Modifier and Type | Method and Description |
---|---|
static List<io.fabric8.kubernetes.api.model.ContainerStatus> |
getContainerStatus(io.fabric8.kubernetes.api.model.Pod pod)
Returns the container status for all containers of the given pod.
|
static boolean |
isInitializing(io.fabric8.kubernetes.api.model.Pod pod)
Returns
true if the given pod has at least 1 container that's initializing. |
static boolean |
isRunning(io.fabric8.kubernetes.api.model.Pod pod)
Returns
true if the given pod is running. |
public static boolean isRunning(io.fabric8.kubernetes.api.model.Pod pod)
true
if the given pod is running. Returns false
otherwise.
The definition when a pod is considered running can be found at
k8s.io/api/core/v1/types.go#L3564
It states:
"PodRunning means the pod has been bound to a node and all of the containers have been started.
At least one container is still running or is in the process of being restarted."
The logic is taken from (kubernetes/printers.go) printPod()
and (openshift-web-console/resources.js) podStatus()pod
- the pod to return the running status forpublic static boolean isInitializing(io.fabric8.kubernetes.api.model.Pod pod)
true
if the given pod has at least 1 container that's initializing.pod
- the pod to return the initializing status forpublic static List<io.fabric8.kubernetes.api.model.ContainerStatus> getContainerStatus(io.fabric8.kubernetes.api.model.Pod pod)
pod
- the pod to return the container status forPod.getStatus()
,
PodStatus.getContainerStatuses()
Copyright © 2015–2020 Red Hat. All rights reserved.