Skip to content

Commit

Permalink
build(deps): replace direct fabric8 kubernetes-client with quarkus ku…
Browse files Browse the repository at this point in the history
…bernetes-client (#606)
  • Loading branch information
andrewazores authored Aug 14, 2024
1 parent 9661ba3 commit f7da402
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 34 deletions.
34 changes: 16 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
<surefire-plugin.version>3.3.1</surefire-plugin.version>
<surefire.rerunFailingTestsCount>2</surefire.rerunFailingTestsCount>
<failsafe-plugin.version>3.3.1</failsafe-plugin.version>
<io.fabric8.client.version>6.10.0</io.fabric8.client.version>
<failsafe.rerunFailingTestsCount>${surefire.rerunFailingTestsCount}</failsafe.rerunFailingTestsCount>
</properties>
<dependencyManagement>
Expand Down Expand Up @@ -186,6 +185,18 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-websockets</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-reactive-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-cache</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-quartz</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-panache</artifactId>
Expand All @@ -202,6 +213,10 @@
<groupId>io.quarkiverse.amazonservices</groupId>
<artifactId>quarkus-amazon-s3</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-kubernetes-client</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>url-connection-client</artifactId>
Expand Down Expand Up @@ -250,29 +265,12 @@
<artifactId>nimbus-jose-jwt</artifactId>
<version>${com.nimbusds.jose.jwt.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-reactive-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-cache</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-quartz</artifactId>
</dependency>
<dependency>
<groupId>com.google.googlejavaformat</groupId>
<artifactId>google-java-format</artifactId>
<version>${com.google.java-format.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-client</artifactId>
<version>${io.fabric8.client.version}</version>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
Expand Down
20 changes: 4 additions & 16 deletions src/main/java/io/cryostat/discovery/KubeApiDiscovery.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public class KubeApiDiscovery {

@Inject KubeConfig kubeConfig;

@Inject KubernetesClient client;

@Inject EventBus bus;

@ConfigProperty(name = "cryostat.discovery.kubernetes.enabled")
Expand Down Expand Up @@ -111,7 +113,7 @@ protected HashMap<String, SharedIndexInformer<Endpoints>> initialize()
ns -> {
result.put(
ns,
client().endpoints()
client.endpoints()
.inNamespace(ns)
.inform(
new EndpointsHandler(),
Expand Down Expand Up @@ -190,16 +192,6 @@ boolean available() {
return false;
}

KubernetesClient client() {
KubernetesClient client;
try {
client = kubeConfig.kubeClient();
} catch (ConcurrentException e) {
throw new IllegalStateException(e);
}
return client;
}

private boolean isCompatiblePort(EndpointPort port) {
return jmxPortNames.orElse(EMPTY_PORT_NAMES).contains(port.getName())
|| jmxPortNumbers.orElse(EMPTY_PORT_NUMBERS).contains(port.getPort());
Expand Down Expand Up @@ -471,7 +463,7 @@ private Pair<HasMetadata, DiscoveryNode> queryForNode(
}

HasMetadata kubeObj =
nodeType.getQueryFunction().apply(client()).apply(namespace).apply(name);
nodeType.getQueryFunction().apply(client).apply(namespace).apply(name);

DiscoveryNode node =
DiscoveryNode.getNode(
Expand Down Expand Up @@ -550,10 +542,6 @@ String getOwnNamespace() {
boolean kubeApiAvailable() {
return StringUtils.isNotBlank(serviceHost.orElse(""));
}

KubernetesClient kubeClient() throws ConcurrentException {
return kubeClient.get();
}
}

private final class EndpointsHandler implements ResourceEventHandler<Endpoints> {
Expand Down

0 comments on commit f7da402

Please sign in to comment.