public static boolean isRunning(Pod resource) throws Exception { return isRunning(resource.getStatus().getPhase()); }
@Override public void eventReceived(Action action, Pod pod) { switch (action) { case ADDED: case MODIFIED: if (pod.getStatus() != null && isRunning(pod.getStatus().getPhase()) && isReady( pod.getStatus())) { holder.compareAndSet(null, pod); latch.countDown(); } break; case DELETED: case ERROR: System.err.println("Unexpected action waiting for pod to start: " + action); holder.compareAndSet(null, pod); latch.countDown(); } }
protected boolean isReady(Pod pod) { PodStatus status = pod.getStatus(); if (pod.getMetadata().getDeletionTimestamp() == null) { if ("Running".equalsIgnoreCase(status.getPhase())) { List<PodCondition> conditions = status.getConditions(); if (conditions != null) { for (PodCondition condition : conditions) { if ("Ready".equalsIgnoreCase(condition.getType())) { return "True".equalsIgnoreCase(condition.getStatus()); } } } } } return false; } }
@Override public void eventReceived(Action action, Pod pod) { switch (action) { case ADDED: case MODIFIED: if (pod.getStatus().getPhase().equalsIgnoreCase("Running")) { addConsole(pod.getMetadata().getName()); } break; case DELETED: case ERROR: delConsole(pod.getMetadata().getName()); break; } }
@Override public void eventReceived(Action action, Pod pod) { switch (action) { case ADDED: case MODIFIED: if (pod.getStatus().getPhase().equalsIgnoreCase("Running")) { addConsole(pod.getMetadata().getName()); } break; case DELETED: case ERROR: delConsole(pod.getMetadata().getName()); break; } }
for (Pod pod : podList.getItems()) { session.getLogger() .info("Pod: [" + pod.getMetadata().getName() + "] Status: [" + pod.getStatus().getPhase() + "]");
for (Pod pod : podList.getItems()) { session.getLogger() .info("Pod: [" + pod.getMetadata().getName() + "] Status: [" + pod.getStatus().getPhase() + "]");