File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
kroxylicious-operator/src/test/java/io/kroxylicious/kubernetes/operator Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 1313import edu .umd .cs .findbugs .annotations .Nullable ;
1414
1515public class OperatorTestUtils {
16+
17+ /**
18+ * The timeouts etc of this client build are tuned to handle the case where Kubernetes isn't present.
19+ * As might be the case on a developer's machine where minikube isn't running.
20+ */
21+ private static final KubernetesClientBuilder PRESENCE_PROBING_KUBE_CLIENT_BUILD = new KubernetesClientBuilder ()
22+ .editOrNewConfig ()
23+ .withRequestRetryBackoffLimit (2 )
24+ .withConnectionTimeout (500 )
25+ .endConfig ();
26+
1627 static @ Nullable KubernetesClient kubeClientIfAvailable () {
17- var client = new KubernetesClientBuilder ().build ();
28+ return kubeClientIfAvailable (new KubernetesClientBuilder ());
29+ }
30+
31+ static @ Nullable KubernetesClient kubeClientIfAvailable (KubernetesClientBuilder kubernetesClientBuilder ) {
32+ var client = kubernetesClientBuilder .build ();
1833 try {
1934 client .namespaces ().list ();
2035 return client ;
@@ -26,7 +41,7 @@ public class OperatorTestUtils {
2641 }
2742
2843 static boolean isKubeClientAvailable () {
29- try (var client = kubeClientIfAvailable ()) {
44+ try (var client = kubeClientIfAvailable (PRESENCE_PROBING_KUBE_CLIENT_BUILD )) {
3045 return client != null ;
3146 }
3247 }
You can’t perform that action at this time.
0 commit comments