Class PodStatusUtil
- java.lang.Object
-
- io.fabric8.kubernetes.client.utils.PodStatusUtil
-
public class PodStatusUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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)
Returnstrue
if the given pod has at least 1 container that's initializing.static boolean
isRunning(io.fabric8.kubernetes.api.model.Pod pod)
Returnstrue
if the given pod is running.
-
-
-
Method Detail
-
isRunning
public static boolean isRunning(io.fabric8.kubernetes.api.model.Pod pod)
Returnstrue
if the given pod is running. Returnsfalse
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()- Parameters:
pod
- the pod to return the running status for- Returns:
- returns true if the pod is running
-
isInitializing
public static boolean isInitializing(io.fabric8.kubernetes.api.model.Pod pod)
Returnstrue
if the given pod has at least 1 container that's initializing.- Parameters:
pod
- the pod to return the initializing status for- Returns:
- returns true if the pod is initializing
-
getContainerStatus
public 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. Returns an empty list if the pod has no status- Parameters:
pod
- the pod to return the container status for- Returns:
- list of container status
- See Also:
Pod.getStatus()
,PodStatus.getContainerStatuses()
-
-