From 6e73ff823af2867241d6f75dce5b77ad3baa6c36 Mon Sep 17 00:00:00 2001 From: Chris Laprun Date: Tue, 29 Oct 2024 18:07:18 +0100 Subject: [PATCH] fix: issue a warning if CRD couldn't be applied Fixes #981 Signed-off-by: Chris Laprun --- .../quarkiverse/operatorsdk/runtime/CRDUtils.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/CRDUtils.java b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/CRDUtils.java index f88fd25b7..ee52b60c0 100644 --- a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/CRDUtils.java +++ b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/CRDUtils.java @@ -31,7 +31,7 @@ public static void applyCRD(KubernetesClient client, CRDGenerationInfo crdInfo, } }); } catch (Exception exception) { - LOGGER.debugv(exception, "Couldn't apply ''{0}'' CRD", crdName); + LOGGER.warnv(exception, "Couldn't apply ''{0}'' CRD", crdName); } } @@ -61,13 +61,10 @@ private static void apply(KubernetesClient client, String v, Object crd) { } private static Class getCRDClassFor(String v) { - switch (v) { - case "v1": - return CustomResourceDefinition.class; - case "v1beta1": - return io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition.class; - default: - throw new IllegalArgumentException("Unknown CRD version: " + v); - } + return switch (v) { + case "v1" -> CustomResourceDefinition.class; + case "v1beta1" -> io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition.class; + default -> throw new IllegalArgumentException("Unknown CRD version: " + v); + }; } }