-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14946 from FroMage/14943
Do not produce KubernetesClient if we have OpenShiftClient available
- Loading branch information
Showing
7 changed files
with
57 additions
and
29 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
19 changes: 19 additions & 0 deletions
19
.../runtime/src/main/java/io/quarkus/kubernetes/client/runtime/KubernetesConfigProducer.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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.quarkus.kubernetes.client.runtime; | ||
|
||
import javax.enterprise.inject.Produces; | ||
import javax.inject.Singleton; | ||
|
||
import io.fabric8.kubernetes.client.Config; | ||
import io.quarkus.arc.DefaultBean; | ||
import io.quarkus.runtime.TlsConfig; | ||
|
||
@Singleton | ||
public class KubernetesConfigProducer { | ||
|
||
@DefaultBean | ||
@Singleton | ||
@Produces | ||
public Config config(KubernetesClientBuildConfig buildConfig, TlsConfig tlsConfig) { | ||
return KubernetesClientUtils.createConfig(buildConfig, tlsConfig); | ||
} | ||
} |
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
14 changes: 10 additions & 4 deletions
14
integration-tests/openshift-client/src/main/java/io/quarkus/it/openshift/client/Routes.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,24 +1,30 @@ | ||
package io.quarkus.it.openshift.client; | ||
|
||
import javax.inject.Inject; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
import javax.ws.rs.core.Response; | ||
|
||
import io.fabric8.kubernetes.client.KubernetesClient; | ||
import io.fabric8.openshift.client.OpenShiftClient; | ||
|
||
@Path("/route") | ||
public class Routes { | ||
|
||
private final OpenShiftClient openshiftClient; | ||
// make sure we can inject both aspects of it | ||
@Inject | ||
KubernetesClient kubernetesClient; | ||
|
||
public Routes(OpenShiftClient openshiftClient) { | ||
this.openshiftClient = openshiftClient; | ||
} | ||
@Inject | ||
OpenShiftClient openshiftClient; | ||
|
||
@GET | ||
@Path("/{namespace}") | ||
public Response routes(@PathParam("namespace") String namespace) { | ||
if (kubernetesClient != openshiftClient) { | ||
return Response.serverError().entity("The clients are different").build(); | ||
} | ||
return Response.ok(openshiftClient.routes().inNamespace(namespace).list().getItems()).build(); | ||
} | ||
} |