io.fabric8.kubernetes.api.model.ContainerStateWaiting Java Examples
The following examples show how to use
io.fabric8.kubernetes.api.model.ContainerStateWaiting.
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: Reaper.java From kubernetes-plugin with Apache License 2.0 | 6 votes |
@Override public void onEvent(@NonNull Action action, @NonNull KubernetesSlave node, @NonNull Pod pod) throws IOException, InterruptedException { List<ContainerStatus> backOffContainers = PodUtils.getContainers(pod, cs -> { ContainerStateWaiting waiting = cs.getState().getWaiting(); return waiting != null && waiting.getMessage() != null && waiting.getMessage().contains("Back-off pulling image"); }); if (backOffContainers.isEmpty()) { return; } backOffContainers.forEach(cs -> { TaskListener runListener = node.getTemplate().getListener(); runListener.error("Unable to pull Docker image \""+cs.getImage()+"\". Check if image tag name is spelled correctly."); }); Queue q = Jenkins.get().getQueue(); String runUrl = pod.getMetadata().getAnnotations().get("runUrl"); for (Queue.Item item: q.getItems()) { if (item.task.getUrl().equals(runUrl)) { q.cancel(item); break; } } node.terminate(); }
Example #2
Source File: KubernetesPodEventTranslatorTest.java From styx with Apache License 2.0 | 4 votes |
private static ContainerState waitingContainerState(String reason, String message) { return new ContainerState(null, null, new ContainerStateWaiting(message, reason)); }