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 120504e4..373f53f9 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,11 @@ protected Container startContainer(ContainerSpec spec, Proxy proxy) throws Excep Pod startedPod = kubeClient.pods().inNamespace(effectiveKubeNamespace).create(patchedPod); - // Workaround: waitUntilReady appears to be buggy. - Retrying.retry(i -> Readiness.isReady(kubeClient.resource(startedPod).fromServer().get()), 60, 1000); + int totalWaitMs = Integer.parseInt(environment.getProperty("proxy.container-wait-time", "20000")); + Retrying.retry(i -> Readiness.isReady(kubeClient.resource(startedPod).fromServer().get()), totalWaitMs / 1000, 1000); + if (!Readiness.isReady(kubeClient.resource(startedPod).fromServer().get())) { + throw new ContainerProxyException("Container did not become ready in time"); + } Pod pod = kubeClient.resource(startedPod).fromServer().get(); Service service = null;