forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix randomly failures when deploying to OpenShift/K8s on JVM/Native
There were several places where a new KubernetesClient was being created: - Some places use `Clients.fromConfig`. - Other places use `KubernetesClientUtils.createConfig`. - And other places use `KubernetesClientBuildItem.getClient` And the problem is that every time we invoke any of these methods, Fabric8 KubernetesClient tries to locate one HttpClient.Factory and it seems that the logic to get one HttpClient.Factory sometimes gets the `VertxHttpClientFactory` implementation over the expected one `QuarkusHttpClientFactory` With this solution, it avoids to find a HttpClient.Factory using the ServiceLoader logic in Fabric8 Kubernetes Client, but it provides the expected `QuarkusHttpClientFactory` implementation always. Fix quarkusio#31476
- Loading branch information
Showing
11 changed files
with
84 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...src/main/resources/META-INF/services/io.fabric8.kubernetes.client.http.HttpClient$Factory
This file was deleted.
Oops, something went wrong.
18 changes: 11 additions & 7 deletions
18
...-client/spi/src/main/java/io/quarkus/kubernetes/client/spi/KubernetesClientBuildItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,30 @@ | ||
package io.quarkus.kubernetes.client.spi; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import io.fabric8.kubernetes.client.Config; | ||
import io.fabric8.kubernetes.client.KubernetesClient; | ||
import io.fabric8.kubernetes.client.KubernetesClientBuilder; | ||
import io.fabric8.kubernetes.client.http.HttpClient; | ||
import io.quarkus.builder.item.SimpleBuildItem; | ||
|
||
public final class KubernetesClientBuildItem extends SimpleBuildItem { | ||
|
||
private final Config config; | ||
private final HttpClient.Factory httpClientFactory; | ||
|
||
public KubernetesClientBuildItem(Config config) { | ||
public KubernetesClientBuildItem(Config config, HttpClient.Factory httpClientFactory) { | ||
this.config = config; | ||
} | ||
|
||
public Supplier<KubernetesClient> getClient() { | ||
return () -> new KubernetesClientBuilder().withConfig(config).build(); | ||
this.httpClientFactory = httpClientFactory; | ||
} | ||
|
||
public Config getConfig() { | ||
return config; | ||
} | ||
|
||
public HttpClient.Factory getHttpClientFactory() { | ||
return httpClientFactory; | ||
} | ||
|
||
public KubernetesClient buildClient() { | ||
return new KubernetesClientBuilder().withConfig(config).withHttpClientFactory(httpClientFactory).build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.