public boolean isReady(ContainerCreationStatus container) { Pod pod = client.pods().withName(container.getContainerName()).get(); if (pod == null) { return false; } else { return pod.getStatus().getConditions().stream() .filter(condition -> condition.getType().equals("Ready")) .map(condition -> condition.getStatus().equals("True")) .findFirst() .orElse(false); } }
public PodConditionFluentImpl(PodCondition instance){ this.withLastProbeTime(instance.getLastProbeTime()); this.withLastTransitionTime(instance.getLastTransitionTime()); this.withMessage(instance.getMessage()); this.withReason(instance.getReason()); this.withStatus(instance.getStatus()); this.withType(instance.getType()); }
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); }
/** * Returns the ready condition of the pod. * @param pod The target pod. * @return The {@link PodCondition} or null if not found. */ private static PodCondition getPodReadyCondition(Pod pod) { Utils.checkNotNull(pod, "Pod can't be null."); if (pod.getStatus() == null || pod.getStatus().getConditions() == null) { return null; } for (PodCondition condition : pod.getStatus().getConditions()) { if (POD_READY.equals(condition.getType())) { return condition; } } return null; }
public PodConditionBuilder( PodConditionFluent<?> fluent ){ this(fluent, new PodCondition()); } public PodConditionBuilder( PodConditionFluent<?> fluent , PodCondition instance ){
public PodConditionBuilder(PodCondition instance,Boolean validationEnabled){ this.fluent = this; this.withLastProbeTime(instance.getLastProbeTime()); this.withLastTransitionTime(instance.getLastTransitionTime()); this.withMessage(instance.getMessage()); this.withReason(instance.getReason()); this.withStatus(instance.getStatus()); this.withType(instance.getType()); this.validationEnabled = validationEnabled; }
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); }
/** * Returns the ready condition of the pod. * @param pod The target pod. * @return The {@link PodCondition} or null if not found. */ private static PodCondition getPodReadyCondition(Pod pod) { Utils.checkNotNull(pod, "Pod can't be null."); if (pod.getStatus() == null || pod.getStatus().getConditions() == null) { return null; } for (PodCondition condition : pod.getStatus().getConditions()) { if (POD_READY.equals(condition.getType())) { return condition; } } return null; } }
public PodConditionBuilder(Boolean validationEnabled){ this(new PodCondition(), validationEnabled); } public PodConditionBuilder(PodConditionFluent<?> fluent){
public void run() { PodList podList = listSelectedPods(obj); int count = 0; List<Pod> items = podList.getItems(); for (Pod item : items) { for (PodCondition c : item.getStatus().getConditions()) { if (c.getType().equals("Ready") && c.getStatus().equals("True")) { count++; } } } podCount.set(count); if (count == requiredPodCount) { countDownLatch.countDown(); } } };
public PodConditionBuilder(PodConditionFluent<?> fluent,PodCondition instance,Boolean validationEnabled){ this.fluent = fluent; fluent.withLastProbeTime(instance.getLastProbeTime()); fluent.withLastTransitionTime(instance.getLastTransitionTime()); fluent.withMessage(instance.getMessage()); fluent.withReason(instance.getReason()); fluent.withStatus(instance.getStatus()); fluent.withType(instance.getType()); this.validationEnabled = validationEnabled; } public PodConditionBuilder(PodCondition instance){
public PodConditionBuilder(PodConditionFluent<?> fluent,Boolean validationEnabled){ this(fluent, new PodCondition(), validationEnabled); } public PodConditionBuilder(PodConditionFluent<?> fluent,PodCondition instance){
public PodConditionBuilder(){ this(new PodCondition()); } public PodConditionBuilder( PodConditionFluent<?> fluent ){
public PodConditionBuilder(){ this(new PodCondition()); } public PodConditionBuilder( PodConditionFluent<?> fluent ){
public PodConditionBuilder( PodConditionFluent<?> fluent ){ this(fluent, new PodCondition()); } public PodConditionBuilder( PodConditionFluent<?> fluent , PodCondition instance ){
public T addNewCondition( String status, String type){ return addToCondition(new PodCondition(status, type)); } public T addToContainerStatuses( ContainerStatus item){