Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'chancez/fix_pod_query'
Browse files Browse the repository at this point in the history
  • Loading branch information
soudy committed Apr 19, 2017
2 parents 1a9eaac + 685867a commit 00e486b
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,32 @@ private boolean isContainerReady(Pod pod, String container) {
}

private boolean waitUntilContainerIsReady() {
int i = 0;
int j = 10; // wait 60 seconds
Pod pod = client.pods().inNamespace(namespace).withName(podName).get();

if (pod == null) {
throw new IllegalArgumentException("Container with name:[" + containerName + "] not found in pod:[" + podName + "]");
launcher.getListener().getLogger().println("Waiting for pod [" + podName + "] to exist.");
// wait for Pod to be running.
for (; i < j; i++) {
LOGGER.log(Level.INFO, "Getting pod ({1}/{2}): {0}", new Object[] {podName, i, j});
pod = client.pods().inNamespace(namespace).withName(podName).get();
if (pod != null) {
break;
}
LOGGER.log(Level.INFO, "Waiting 6 seconds before checking if pod exists ({1}/{2}): {0}", new Object[] {podName, i, j});
try {
Thread.sleep(6000);
} catch (InterruptedException e) {
return false;
}
}
}

if (pod == null) {
throw new IllegalArgumentException("Container with name:[" + containerName + "] not found in pod:[" + podName + "], pod doesn't exist");
}

if (isContainerReady(pod, containerName)) {
return true;
}
Expand Down

0 comments on commit 00e486b

Please sign in to comment.