Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove workaround for testing knative environment #30743

Merged
merged 1 commit into from
Jan 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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