Skip to content

Commit

Permalink
Merge pull request #45259 from manusa/feat/deps/kubernetes-client
Browse files Browse the repository at this point in the history
Bump kubernetes-client-bom from 6.13.4 to 7.0.1
  • Loading branch information
gastaldi authored Jan 4, 2025
2 parents cd9d9f0 + 08b7c5e commit 72dd7dc
Show file tree
Hide file tree
Showing 22 changed files with 77 additions and 408 deletions.
5 changes: 0 additions & 5 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3373,11 +3373,6 @@
<artifactId>quarkus-test-kubernetes-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-openshift-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-amazon-lambda</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import io.fabric8.kubernetes.api.model.AnyType;
import io.fabric8.kubernetes.api.model.IntOrString;
import io.fabric8.kubernetes.api.model.KubeSchema;
import io.fabric8.kubernetes.api.model.KubernetesResource;
import io.fabric8.kubernetes.api.model.KubernetesResourceList;
import io.fabric8.kubernetes.api.model.ValidationSchema;
import io.fabric8.kubernetes.client.Config;
import io.fabric8.kubernetes.client.CustomResource;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
Expand Down Expand Up @@ -64,10 +62,8 @@ public class KubernetesClientProcessor {
private static final DotName RESOURCE_EVENT_HANDLER = DotName
.createSimple(io.fabric8.kubernetes.client.informers.ResourceEventHandler.class.getName());
private static final DotName KUBERNETES_RESOURCE = DotName.createSimple(KubernetesResource.class.getName());
private static final DotName VALIDATION_SCHEMA = DotName.createSimple(ValidationSchema.class.getName());
private static final DotName KUBERNETES_RESOURCE_LIST = DotName
.createSimple(KubernetesResourceList.class.getName());
private static final DotName KUBE_SCHEMA = DotName.createSimple(KubeSchema.class.getName());
private static final DotName VISITABLE_BUILDER = DotName.createSimple(VisitableBuilder.class.getName());
private static final DotName CUSTOM_RESOURCE = DotName.createSimple(CustomResource.class.getName());

Expand Down Expand Up @@ -174,10 +170,8 @@ public void process(ApplicationIndexBuildItem applicationIndex, CombinedIndexBui
ignoredJsonDeserializationClasses.produce(new IgnoreJsonDeserializeClassBuildItem(ignoreJsonDeserialization));

// we also ignore some classes that are annotated with @JsonDeserialize that would force the registration of the entire model
ignoredJsonDeserializationClasses.produce(new IgnoreJsonDeserializeClassBuildItem(KUBE_SCHEMA));
ignoredJsonDeserializationClasses.produce(new IgnoreJsonDeserializeClassBuildItem(KUBERNETES_RESOURCE_LIST));
ignoredJsonDeserializationClasses.produce(new IgnoreJsonDeserializeClassBuildItem(KUBERNETES_RESOURCE));
ignoredJsonDeserializationClasses.produce(new IgnoreJsonDeserializeClassBuildItem(VALIDATION_SCHEMA));

final String[] deserializerClasses = fullIndex
.getAllKnownSubclasses(DotName.createSimple("com.fasterxml.jackson.databind.JsonDeserializer"))
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.quarkus.kubernetes.client.runtime.graal;

import com.oracle.svm.core.annotate.Delete;
import com.oracle.svm.core.annotate.TargetClass;

@TargetClass(className = "io.fabric8.kubernetes.client.vertx.VertxHttpClientFactory")
@Delete
public final class Fabric8VertxHttpClientFactoryDelete {
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void checkEnvironment(Optional<SelectedKubernetesDeploymentTargetBuildIte
}
if (target.getEntry().getName().equals(OPENSHIFT)) {
try (var openShiftClient = kubernetesClientBuilder.buildClient().adapt(OpenShiftClient.class)) {
if (openShiftClient.isSupported()) {
if (openShiftClient.hasApiGroup("openshift.io", false)) {
deploymentCluster.produce(new KubernetesDeploymentClusterBuildItem(OPENSHIFT));
} else {
throw new IllegalStateException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,16 @@
import io.fabric8.openshift.api.model.miscellaneous.cloudcredential.v1.CredentialsRequestList;
import io.fabric8.openshift.api.model.miscellaneous.cncf.cni.v1.NetworkAttachmentDefinition;
import io.fabric8.openshift.api.model.miscellaneous.cncf.cni.v1.NetworkAttachmentDefinitionList;
import io.fabric8.openshift.api.model.miscellaneous.imageregistry.operator.v1.Config;
import io.fabric8.openshift.api.model.miscellaneous.imageregistry.operator.v1.ConfigList;
import io.fabric8.openshift.api.model.miscellaneous.helm.v1beta1.HelmChartRepository;
import io.fabric8.openshift.api.model.miscellaneous.helm.v1beta1.HelmChartRepositoryList;
import io.fabric8.openshift.api.model.miscellaneous.helm.v1beta1.ProjectHelmChartRepository;
import io.fabric8.openshift.api.model.miscellaneous.helm.v1beta1.ProjectHelmChartRepositoryList;
import io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.BareMetalHost;
import io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.BareMetalHostList;
import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3Remediation;
import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationList;
import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplate;
import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplateList;
import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.EgressRouter;
import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.EgressRouterList;
import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.OperatorPKI;
import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.OperatorPKIList;

/**
* Allows the exclusion of the openshift-model-miscellaneous model without breaking the --link-at-build-time check.
Expand All @@ -50,12 +48,7 @@ public MixedOperation<CredentialsRequest, CredentialsRequestList, Resource<Crede
}

@Substitute
public MixedOperation<EgressRouter, EgressRouterList, Resource<EgressRouter>> egressRouters() {
throw new RuntimeException(Constants.ERROR_MESSAGE);
}

@Substitute
public NonNamespaceOperation<Config, ConfigList, Resource<Config>> imageRegistryOperatorConfigs() {
public NonNamespaceOperation<HelmChartRepository, HelmChartRepositoryList, Resource<HelmChartRepository>> helmChartRepositories() {
throw new RuntimeException(Constants.ERROR_MESSAGE);
}

Expand All @@ -75,7 +68,7 @@ public MixedOperation<NetworkAttachmentDefinition, NetworkAttachmentDefinitionLi
}

@Substitute
public MixedOperation<OperatorPKI, OperatorPKIList, Resource<OperatorPKI>> operatorPKIs() {
public MixedOperation<ProjectHelmChartRepository, ProjectHelmChartRepositoryList, Resource<ProjectHelmChartRepository>> projectHelmChartRepositories() {
throw new RuntimeException(Constants.ERROR_MESSAGE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.openshift.api.model.operator.imageregistry.v1.Config;
import io.fabric8.openshift.api.model.operator.imageregistry.v1.ConfigList;
import io.fabric8.openshift.api.model.operator.network.v1.EgressRouter;
import io.fabric8.openshift.api.model.operator.network.v1.EgressRouterList;
import io.fabric8.openshift.api.model.operator.network.v1.OperatorPKI;
import io.fabric8.openshift.api.model.operator.network.v1.OperatorPKIList;
import io.fabric8.openshift.client.dsl.OpenShiftOperatorAPIGroupDSL;

/**
Expand All @@ -14,10 +23,28 @@
@TargetClass(className = "io.fabric8.openshift.client.impl.OpenShiftClientImpl", onlyWith = OperatorSubstitutions.NoOpenShiftOperatorModel.class)
public final class OperatorSubstitutions {

@Substitute
public MixedOperation<EgressRouter, EgressRouterList, Resource<EgressRouter>> egressRouters() {
throw new RuntimeException(OperatorSubstitutions.Constants.ERROR_MESSAGE);
}

@Substitute
public NonNamespaceOperation<Config, ConfigList, Resource<Config>> imageRegistryOperatorConfigs() {
throw new RuntimeException(OperatorSubstitutions.Constants.ERROR_MESSAGE);
}

@Substitute
public OpenShiftOperatorAPIGroupDSL operator() {
throw new RuntimeException(
"OpenShift Operator API is not available, please add the openshift-model-operator module to your classpath");
throw new RuntimeException(OperatorSubstitutions.Constants.ERROR_MESSAGE);
}

@Substitute
public MixedOperation<OperatorPKI, OperatorPKIList, Resource<OperatorPKI>> operatorPKIs() {
throw new RuntimeException(OperatorSubstitutions.Constants.ERROR_MESSAGE);
}

static final class Constants {
private static final String ERROR_MESSAGE = "OpenShift Operator API is not available, please add the openshift-model-operator module to your classpath";
}

static final class NoOpenShiftOperatorModel implements BooleanSupplier {
Expand Down
5 changes: 0 additions & 5 deletions integration-tests/kubernetes-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@
<artifactId>quarkus-test-kubernetes-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-openshift-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand Down

This file was deleted.

36 changes: 11 additions & 25 deletions integration-tests/kubernetes/quarkus-standard-way-kafka/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,37 +47,23 @@
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model</artifactId>
<artifactId>kubernetes-model-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-apps</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>openshift-model</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>knative-model</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
Expand Down
6 changes: 5 additions & 1 deletion integration-tests/kubernetes/quarkus-standard-way/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model</artifactId>
<artifactId>openshift-model</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-core</artifactId>
<exclusions>
<exclusion>
<groupId>javax.annotation</groupId>
Expand Down
6 changes: 5 additions & 1 deletion integration-tests/openshift-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@
<groupId>io.fabric8</groupId>
<artifactId>openshift-model-operator</artifactId>
</exclusion>
<exclusion>
<groupId>io.fabric8</groupId>
<artifactId>openshift-model-operatorhub</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-openshift-client</artifactId>
<artifactId>quarkus-test-kubernetes-client</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
import org.junit.jupiter.api.Test;

import io.fabric8.kubernetes.api.model.PodListBuilder;
import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer;
import io.fabric8.openshift.api.model.Route;
import io.fabric8.openshift.api.model.RouteBuilder;
import io.fabric8.openshift.client.NamespacedOpenShiftClient;
import io.fabric8.openshift.client.server.mock.OpenShiftMockServer;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.kubernetes.client.KubernetesMockServerTestResource;
import io.quarkus.test.kubernetes.client.MockServer;
import io.quarkus.test.kubernetes.client.OpenShiftMockServerTestResource;
import io.restassured.RestAssured;

@QuarkusTestResource(OpenShiftMockServerTestResource.class)
@QuarkusTestResource(KubernetesMockServerTestResource.class)
@QuarkusTest
public class OpenShiftClientTest {

@MockServer
private OpenShiftMockServer mockServer;
private KubernetesMockServer mockServer;

@Test
void createRoute() {
Expand All @@ -36,7 +36,7 @@ void createRoute() {
.andReturn(200, expectedRoute)
.once();

NamespacedOpenShiftClient openShiftClient = mockServer.createOpenShiftClient();
NamespacedOpenShiftClient openShiftClient = mockServer.createClient().adapt(NamespacedOpenShiftClient.class);
openShiftClient.routes()
.create(new RouteBuilder().withNewMetadata().withName("myroute").withNamespace("test").endMetadata().build());
Route route = openShiftClient.routes().inNamespace("test").withName("myroute").get();
Expand Down
Loading

0 comments on commit 72dd7dc

Please sign in to comment.