From ab8bd9f57fcb0a4c2f9ef119e72727f229a9eb0b Mon Sep 17 00:00:00 2001 From: Tobia De Koninck Date: Mon, 9 Nov 2020 14:55:58 +0100 Subject: [PATCH] Use extra paramter for pod-wait-time --- .../backend/kubernetes/KubernetesBackend.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/openanalytics/containerproxy/backend/kubernetes/KubernetesBackend.java b/src/main/java/eu/openanalytics/containerproxy/backend/kubernetes/KubernetesBackend.java index 373f53f9..80fd3e8b 100644 --- a/src/main/java/eu/openanalytics/containerproxy/backend/kubernetes/KubernetesBackend.java +++ b/src/main/java/eu/openanalytics/containerproxy/backend/kubernetes/KubernetesBackend.java @@ -268,8 +268,16 @@ protected Container startContainer(ContainerSpec spec, Proxy proxy) throws Excep Pod startedPod = kubeClient.pods().inNamespace(effectiveKubeNamespace).create(patchedPod); - int totalWaitMs = Integer.parseInt(environment.getProperty("proxy.container-wait-time", "20000")); - Retrying.retry(i -> Readiness.isReady(kubeClient.resource(startedPod).fromServer().get()), totalWaitMs / 1000, 1000); + int totalWaitMs = Integer.parseInt(environment.getProperty("proxy.kubernetes.pod-wait-time", "60000")); + int maxTries = totalWaitMs / 1000; + Retrying.retry(i -> { + if (!Readiness.isReady(kubeClient.resource(startedPod).fromServer().get())) { + if (i > 1 && log != null) log.debug(String.format("Container not ready yet, trying again (%d/%d)", i, maxTries)); + return false; + } + return true; + } + , maxTries, 1000); if (!Readiness.isReady(kubeClient.resource(startedPod).fromServer().get())) { throw new ContainerProxyException("Container did not become ready in time"); }