Skip to content

Commit

Permalink
Merge pull request #30743 from geoand/knative-fix
Browse files Browse the repository at this point in the history
Remove workaround for testing knative environment
  • Loading branch information
geoand authored Jan 31, 2023
2 parents 750a259 + 8bc8894 commit 9281ebe
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 9281ebe

Please sign in to comment.