Skip to content

Commit

Permalink
Remove workaround for testing knative environment
Browse files Browse the repository at this point in the history
This can now be done because
fabric8io/kubernetes-client#4447
is included in version 6.3 of the k8s client
  • Loading branch information
geoand committed Jan 31, 2023
1 parent 68e0f4b commit 8bc8894
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.List;
import java.util.Optional;

import io.fabric8.knative.client.DefaultKnativeClient;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.kubernetes.client.spi.KubernetesClientBuildItem;
Expand All @@ -22,12 +23,13 @@ public void checkEnvironment(Optional<SelectedKubernetesDeploymentTargetBuildIte
return;
}
if (target.getEntry().getName().equals(KNATIVE)) {
// use 'isSupported' once https://github.com/fabric8io/kubernetes-client/issues/4447 is resolved
if (client.getClient().hasApiGroup("knative.dev", false)) {
deploymentCluster.produce(new KubernetesDeploymentClusterBuildItem(KNATIVE));
} else {
throw new IllegalStateException(
"Knative was requested as a deployment, but the target cluster is not a Knative cluster!");
try (DefaultKnativeClient knativeClient = client.getClient().adapt(DefaultKnativeClient.class)) {
if (knativeClient.isSupported()) {
deploymentCluster.produce(new KubernetesDeploymentClusterBuildItem(KNATIVE));
} else {
throw new IllegalStateException(
"Knative was requested as a deployment, but the target cluster is not a Knative cluster!");
}
}
}
});
Expand Down

0 comments on commit 8bc8894

Please sign in to comment.