diff --git a/junit/kubernetes-server-mock/src/main/java/io/fabric8/kubernetes/client/server/mock/KubernetesMockServer.java b/junit/kubernetes-server-mock/src/main/java/io/fabric8/kubernetes/client/server/mock/KubernetesMockServer.java index 690f5fc2ff5..33cebdf1a79 100644 --- a/junit/kubernetes-server-mock/src/main/java/io/fabric8/kubernetes/client/server/mock/KubernetesMockServer.java +++ b/junit/kubernetes-server-mock/src/main/java/io/fabric8/kubernetes/client/server/mock/KubernetesMockServer.java @@ -52,6 +52,7 @@ import java.util.Map; import java.util.Objects; import java.util.Queue; +import java.util.function.Consumer; import java.util.regex.Pattern; public class KubernetesMockServer extends DefaultMockServer implements Resetable, CustomResourceAware { @@ -120,17 +121,23 @@ public String[] getRootPaths() { } public NamespacedKubernetesClient createClient() { - return createClient(null); + return createClient(ignored -> { + }); } - public NamespacedKubernetesClient createClient(HttpClient.Factory factory) { - KubernetesClient client = new KubernetesClientBuilder().withConfig(getMockConfiguration()).withHttpClientFactory(factory) - .build(); + public NamespacedKubernetesClient createClient(Consumer customizer) { + KubernetesClientBuilder builder = new KubernetesClientBuilder().withConfig(getMockConfiguration()); + customizer.accept(builder); + KubernetesClient client = builder.build(); client.adapt(BaseClient.class) .setMatchingGroupPredicate(s -> unsupportedPatterns.stream().noneMatch(p -> p.matcher(s).find())); return client.adapt(NamespacedKubernetesClient.class); } + public NamespacedKubernetesClient createClient(HttpClient.Factory factory) { + return createClient(builder -> builder.withHttpClientFactory(factory)); + } + /** * Replace the current {@link VersionInfo} instance. *