Java Code Examples for io.fabric8.kubernetes.api.model.PodCondition#getStatus()
The following examples show how to use
io.fabric8.kubernetes.api.model.PodCondition#getStatus() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KubernetesClientUtil.java From jkube with Eclipse Public License 2.0 | 6 votes |
protected static String getPodCondition(Pod pod) { PodStatus podStatus = pod.getStatus(); if (podStatus == null) { return ""; } List<PodCondition> conditions = podStatus.getConditions(); if (conditions == null || conditions.isEmpty()) { return ""; } for (PodCondition condition : conditions) { String type = condition.getType(); if (StringUtils.isNotBlank(type)) { if ("ready".equalsIgnoreCase(type)) { String statusText = condition.getStatus(); if (StringUtils.isNotBlank(statusText)) { if (Boolean.parseBoolean(statusText)) { return type; } } } } } return ""; }
Example 2
Source File: KubernetesPodDetails.java From kubernetes-elastic-agents with Apache License 2.0 | 6 votes |
public static KubernetesPodDetails fromPod(Pod pod) { KubernetesPodDetails podDetails = new KubernetesPodDetails(); podDetails.name = pod.getMetadata().getName(); podDetails.clusterName = pod.getMetadata().getClusterName(); podDetails.nodeName = pod.getSpec().getNodeName(); podDetails.namespace = pod.getMetadata().getNamespace(); podDetails.createdAt = pod.getMetadata().getCreationTimestamp(); podDetails.startedAt = pod.getStatus().getStartTime(); podDetails.phase = pod.getStatus().getPhase(); podDetails.podIP = pod.getStatus().getPodIP(); podDetails.hostIP = pod.getStatus().getHostIP(); podDetails.conditions = new ArrayList<>(); for (PodCondition podCondition : pod.getStatus().getConditions()) { Condition condition = new Condition(podCondition.getType(), podCondition.getStatus()); podDetails.conditions.add(condition); } return podDetails; }
Example 3
Source File: Readiness.java From kubernetes-client with Apache License 2.0 | 5 votes |
public static boolean isPodReady(Pod pod) { Utils.checkNotNull(pod, "Pod can't be null."); PodCondition condition = getPodReadyCondition(pod); //Can be true in testing, so handle it to make test writing easier. if (condition == null || condition.getStatus() == null) { return false; } return condition.getStatus().equalsIgnoreCase(TRUE); }