diff --git a/extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/OpenshiftProcessor.java b/extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/OpenshiftProcessor.java index b64ae4b90932b..c2c828fe98e87 100644 --- a/extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/OpenshiftProcessor.java +++ b/extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/OpenshiftProcessor.java @@ -65,7 +65,7 @@ import io.quarkus.deployment.pkg.builditem.NativeImageBuildItem; import io.quarkus.deployment.pkg.builditem.OutputTargetBuildItem; import io.quarkus.deployment.pkg.steps.NativeBuild; -import io.quarkus.kubernetes.client.deployment.KubernetesClientErrorHanlder; +import io.quarkus.kubernetes.client.deployment.KubernetesClientErrorHandler; import io.quarkus.kubernetes.client.spi.KubernetesClientBuildItem; import io.quarkus.kubernetes.spi.DecoratorBuildItem; import io.quarkus.kubernetes.spi.KubernetesCommandBuildItem; @@ -340,7 +340,7 @@ public static void createContainerImage(KubernetesClientBuildItem kubernetesClie //Let's disable http2 as it causes issues with duplicate build triggers. config.setHttp2Disable(true); try (KubernetesClient client = Clients.fromConfig(config)) { - OpenShiftClient openShiftClient = client.adapt(OpenShiftClient.class); + OpenShiftClient openShiftClient = toOpenshiftClient(client); KubernetesList kubernetesList = Serialization .unmarshalAsList(new ByteArrayInputStream(openshiftManifests.getData())); @@ -353,6 +353,15 @@ public static void createContainerImage(KubernetesClientBuildItem kubernetesClie } } + private static OpenShiftClient toOpenshiftClient(KubernetesClient client) { + try { + return client.adapt(OpenShiftClient.class); + } catch (KubernetesClientException e) { + KubernetesClientErrorHandler.handle(e); + return null; // will never happen + } + } + /** * Apply the openshift resources and wait until ImageStreamTags are created. * @@ -391,7 +400,7 @@ private static void applyOpenshiftResources(OpenShiftClient client, List runningBuildsOf(OpenShiftClient client, BuildConfig private static RuntimeException openshiftException(Throwable t) { if (t instanceof KubernetesClientException) { - KubernetesClientErrorHanlder.handle((KubernetesClientException) t); + KubernetesClientErrorHandler.handle((KubernetesClientException) t); } return new RuntimeException("Execution of openshift build failed. See build output for more details", t); } diff --git a/extensions/container-image/container-image-s2i/deployment/src/main/java/io/quarkus/container/image/s2i/deployment/S2iProcessor.java b/extensions/container-image/container-image-s2i/deployment/src/main/java/io/quarkus/container/image/s2i/deployment/S2iProcessor.java index 630853e4cee47..e4fd42ada8b4f 100644 --- a/extensions/container-image/container-image-s2i/deployment/src/main/java/io/quarkus/container/image/s2i/deployment/S2iProcessor.java +++ b/extensions/container-image/container-image-s2i/deployment/src/main/java/io/quarkus/container/image/s2i/deployment/S2iProcessor.java @@ -61,7 +61,7 @@ import io.quarkus.deployment.pkg.builditem.NativeImageBuildItem; import io.quarkus.deployment.pkg.builditem.OutputTargetBuildItem; import io.quarkus.deployment.pkg.steps.NativeBuild; -import io.quarkus.kubernetes.client.deployment.KubernetesClientErrorHanlder; +import io.quarkus.kubernetes.client.deployment.KubernetesClientErrorHandler; import io.quarkus.kubernetes.client.spi.KubernetesClientBuildItem; import io.quarkus.kubernetes.spi.KubernetesCommandBuildItem; import io.quarkus.kubernetes.spi.KubernetesEnvBuildItem; @@ -313,7 +313,7 @@ private static void applyS2iResources(OpenShiftClient client, List S2iUtils.waitForImageStreamTags(client, buildResources, 2, TimeUnit.MINUTES); } catch (KubernetesClientException e) { - KubernetesClientErrorHanlder.handle(e); + KubernetesClientErrorHandler.handle(e); } } @@ -400,7 +400,7 @@ private static Stream runningBuildsOf(OpenShiftClient client, BuildConfig private static RuntimeException s2iException(Throwable t) { if (t instanceof KubernetesClientException) { - KubernetesClientErrorHanlder.handle((KubernetesClientException) t); + KubernetesClientErrorHandler.handle((KubernetesClientException) t); } return new RuntimeException("Execution of s2i build failed. See s2i output for more details", t); } diff --git a/extensions/kubernetes-client/deployment-internal/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientErrorHanlder.java b/extensions/kubernetes-client/deployment-internal/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientErrorHandler.java similarity index 92% rename from extensions/kubernetes-client/deployment-internal/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientErrorHanlder.java rename to extensions/kubernetes-client/deployment-internal/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientErrorHandler.java index 960c0b50fc5ef..ed127a722a83b 100644 --- a/extensions/kubernetes-client/deployment-internal/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientErrorHanlder.java +++ b/extensions/kubernetes-client/deployment-internal/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientErrorHandler.java @@ -4,9 +4,9 @@ import org.jboss.logging.Logger; -public class KubernetesClientErrorHanlder { +public class KubernetesClientErrorHandler { - private static final Logger LOG = Logger.getLogger(KubernetesClientErrorHanlder.class); + private static final Logger LOG = Logger.getLogger(KubernetesClientErrorHandler.class); public static void handle(Exception e) { if (e.getCause() instanceof SSLHandshakeException) { diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesDeployer.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesDeployer.java index b74b6df3f3f6c..71207dee8fcdd 100644 --- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesDeployer.java +++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesDeployer.java @@ -40,7 +40,7 @@ import io.quarkus.deployment.pkg.builditem.ArtifactResultBuildItem; import io.quarkus.deployment.pkg.builditem.DeploymentResultBuildItem; import io.quarkus.deployment.pkg.builditem.OutputTargetBuildItem; -import io.quarkus.kubernetes.client.deployment.KubernetesClientErrorHanlder; +import io.quarkus.kubernetes.client.deployment.KubernetesClientErrorHandler; import io.quarkus.kubernetes.client.spi.KubernetesClientBuildItem; import io.quarkus.kubernetes.spi.KubernetesDeploymentTargetBuildItem; @@ -192,7 +192,7 @@ private DeploymentResultBuildItem deploy(DeploymentTargetEntry deploymentTarget, } catch (FileNotFoundException e) { throw new IllegalStateException("Can't find generated kubernetes manifest: " + manifest.getAbsolutePath()); } catch (KubernetesClientException e) { - KubernetesClientErrorHanlder.handle(e); + KubernetesClientErrorHandler.handle(e); throw e; } catch (IOException e) { throw new RuntimeException("Error closing file: " + manifest.getAbsolutePath());