From 99a0e33a4649f501bbefd6ad3ec00da57cb1dd81 Mon Sep 17 00:00:00 2001 From: xiaoma20082008 <10076393+xiaoma20082008@users.noreply.github.com> Date: Fri, 28 Jul 2023 11:16:41 +0800 Subject: [PATCH 1/2] : fix #1981 --- .../java/io/javaoperatorsdk/operator/CustomResourceUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/CustomResourceUtils.java b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/CustomResourceUtils.java index f6d4e3cfa7..2fdb3217b9 100644 --- a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/CustomResourceUtils.java +++ b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/CustomResourceUtils.java @@ -18,7 +18,7 @@ private CustomResourceUtils() {} * @throws OperatorException when the Custom Resource has validation error */ public static void assertCustomResource(Class resClass, CustomResourceDefinition crd) { - var namespaced = Arrays.asList(resClass.getInterfaces()).contains(Namespaced.class); + var namespaced = Namespaced.class.isAssignableFrom(resClass); if (!namespaced && Namespaced.class.getSimpleName().equals(crd.getSpec().getScope())) { throw new OperatorException( From 9d5c160a159b84aedc5a9bea85745c9e5e34365d Mon Sep 17 00:00:00 2001 From: machunxiao Date: Mon, 31 Jul 2023 11:15:55 +0800 Subject: [PATCH 2/2] : drop unused import --- .../java/io/javaoperatorsdk/operator/CustomResourceUtils.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/CustomResourceUtils.java b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/CustomResourceUtils.java index 2fdb3217b9..6ae222c1c3 100644 --- a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/CustomResourceUtils.java +++ b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/CustomResourceUtils.java @@ -1,7 +1,5 @@ package io.javaoperatorsdk.operator; -import java.util.Arrays; - import io.fabric8.kubernetes.api.model.Cluster; import io.fabric8.kubernetes.api.model.Namespaced; import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinition;