@Override public void eventReceived(Action action, Pod aPod) { log(aPod.getMetadata().getName(), aPod.getStatus().getPhase()); if(aPod.getStatus().getPhase().equals("Succeeded")) { log("Logs -> ", client.pods().inNamespace(namespace).withName(aPod.getMetadata().getName()).getLog()); watchLatch.countDown(); } }
static String getPodPhase(Pod pod) { if (pod != null) { PodStatus podStatus = pod.getStatus(); if (podStatus != null) { String actualPhase = podStatus.getPhase(); return actualPhase != null ? actualPhase : ""; } } return ""; }
private boolean isTerminatedPod(Pod pod) { switch (pod.getStatus().getPhase()) { case "Succeeded": case "Failed": return true; default: return false; } }
private static boolean isStarted(Pod pod, Optional<ContainerStatus> mainContainerStatusOpt) { return "Running".equals(pod.getStatus().getPhase()) && mainContainerStatusOpt .map(ContainerStatus::getReady).orElse(false); }
/** * Print name of all pods in list * * @param pods list of pods that should be printed * @return */ public static String printPods(List<Pod> pods) { return pods.stream() .map(pod -> "{" + pod.getMetadata().getName() + ", " + pod.getStatus().getPhase() + "}") .collect(Collectors.joining(",")); }
public static final boolean isPodRunning(Pod pod) { return pod != null && pod.getStatus() != null && RUNNING_PHASE.equals(pod.getStatus().getPhase()); }
/** * Get list of all running pods from specific AddressSpace * * @param kubernetes client for manipulation with kubernetes cluster * @return */ public static List<Pod> listRunningPods(Kubernetes kubernetes) { return kubernetes.listPods().stream() .filter(pod -> pod.getStatus().getPhase().equals("Running") && !pod.getMetadata().getName().startsWith(SystemtestsOpenshiftApp.MESSAGING_CLIENTS.toString())) .collect(Collectors.toList()); }
/** * Get list of all running pods from specific AddressSpace * * @param kubernetes client for manipulation with kubernetes cluster * @param addressSpace * @return */ public static List<Pod> listRunningPods(Kubernetes kubernetes, AddressSpace addressSpace) { return kubernetes.listPods(Collections.singletonMap("infraUuid", addressSpace.getInfraUuid())).stream() .filter(pod -> pod.getStatus().getPhase().equals("Running") && !pod.getMetadata().getName().startsWith(SystemtestsOpenshiftApp.MESSAGING_CLIENTS.toString())) .collect(Collectors.toList()); }
private boolean isValidPod(Pod pod) { return pod.getMetadata().getName().startsWith(nodeName) && pod.getStatus().getPhase().equals("Running") && hasIpOfLB(pod.getMetadata().getLabels().get(Protocol.LB_LABEL)); }
protected boolean isPodRunning(String name) { Pod pod = client.pods().withName(name).get(); if (pod == null) { return false; } return "Running".equals(pod.getStatus().getPhase()); }
private static List<String> print(FilterWatchListDeletable<Pod, PodList, Boolean, Watch, Watcher<Pod>> pods) { return pods.list().getItems().stream() .map(pod -> String.format("%s (%s)", pod.getMetadata().getName(), pod.getStatus().getPhase())) .collect(Collectors.toList()); } }
public Pod(io.fabric8.kubernetes.api.model.Pod pod) { this.name = pod.getMetadata().getName(); if (pod.getMetadata().getAnnotations() != null) { this.annotations.putAll(pod.getMetadata().getAnnotations()); } this.kind = pod.getKind(); this.host = pod.getStatus().getPodIP(); this.phase = pod.getStatus().getPhase(); this.ready = getReadyCondition(pod.getStatus().getConditions()); this.portMap = getPortMap(pod.getSpec().getContainers()); }
public PodStatusBuilder( PodStatusFluent<?> fluent , PodStatus instance ){ this.fluent = fluent; fluent.withConditions(instance.getConditions()); fluent.withContainerStatuses(instance.getContainerStatuses()); fluent.withHostIP(instance.getHostIP()); fluent.withMessage(instance.getMessage()); fluent.withPhase(instance.getPhase()); fluent.withPodIP(instance.getPodIP()); fluent.withStartTime(instance.getStartTime()); } public PodStatusBuilder( PodStatus instance ){
public PodStatusBuilder( PodStatusFluent<?> fluent , PodStatus instance ){ this.fluent = fluent; fluent.withCondition(instance.getCondition()); fluent.withContainerStatuses(instance.getContainerStatuses()); fluent.withHostIP(instance.getHostIP()); fluent.withMessage(instance.getMessage()); fluent.withPhase(instance.getPhase()); fluent.withPodIP(instance.getPodIP()); fluent.withStartTime(instance.getStartTime()); } public PodStatusBuilder( PodStatus instance ){
public PodStatusBuilder( PodStatus instance ){ this.fluent = this; this.withCondition(instance.getCondition()); this.withContainerStatuses(instance.getContainerStatuses()); this.withHostIP(instance.getHostIP()); this.withMessage(instance.getMessage()); this.withPhase(instance.getPhase()); this.withPodIP(instance.getPodIP()); this.withStartTime(instance.getStartTime()); }
public PodStatusBuilder( PodStatus instance ){ this.fluent = this; this.withConditions(instance.getConditions()); this.withContainerStatuses(instance.getContainerStatuses()); this.withHostIP(instance.getHostIP()); this.withMessage(instance.getMessage()); this.withPhase(instance.getPhase()); this.withPodIP(instance.getPodIP()); this.withStartTime(instance.getStartTime()); }
public PodStatusFluentImpl(PodStatus instance){ this.withConditions(instance.getConditions()); this.withContainerStatuses(instance.getContainerStatuses()); this.withHostIP(instance.getHostIP()); this.withMessage(instance.getMessage()); this.withPhase(instance.getPhase()); this.withPodIP(instance.getPodIP()); this.withReason(instance.getReason()); this.withStartTime(instance.getStartTime()); }
public PodStatusBuilder(PodStatus instance,Boolean validationEnabled){ this.fluent = this; this.withConditions(instance.getConditions()); this.withContainerStatuses(instance.getContainerStatuses()); this.withHostIP(instance.getHostIP()); this.withMessage(instance.getMessage()); this.withPhase(instance.getPhase()); this.withPodIP(instance.getPodIP()); this.withReason(instance.getReason()); this.withStartTime(instance.getStartTime()); this.validationEnabled = validationEnabled; }
public PodStatusBuilder(PodStatusFluent<?> fluent,PodStatus instance,Boolean validationEnabled){ this.fluent = fluent; fluent.withConditions(instance.getConditions()); fluent.withContainerStatuses(instance.getContainerStatuses()); fluent.withHostIP(instance.getHostIP()); fluent.withMessage(instance.getMessage()); fluent.withPhase(instance.getPhase()); fluent.withPodIP(instance.getPodIP()); fluent.withReason(instance.getReason()); fluent.withStartTime(instance.getStartTime()); this.validationEnabled = validationEnabled; } public PodStatusBuilder(PodStatus instance){