diff --git a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/kubernetes/GenericKubernetesResourceMatcher.java b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/kubernetes/GenericKubernetesResourceMatcher.java index 36935e08a0..3109880063 100644 --- a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/kubernetes/GenericKubernetesResourceMatcher.java +++ b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/kubernetes/GenericKubernetesResourceMatcher.java @@ -192,22 +192,17 @@ public static Result match(R d } } - final var matched = matchSpec(actualResource, desired, specEquality, context, ignoredPaths); + final var matched = matchSpec(actualResource, desired, specEquality, context, ignoreList); return Result.computed(matched, desired); } private static boolean matchSpec(R actual, R desired, boolean equality, - Context context, - String[] ignoredPaths) { - + Context context, List ignoreList) { final var kubernetesSerialization = context.getClient().getKubernetesSerialization(); var desiredNode = kubernetesSerialization.convertValue(desired, JsonNode.class); var actualNode = kubernetesSerialization.convertValue(actual, JsonNode.class); var wholeDiffJsonPatch = JsonDiff.asJson(desiredNode, actualNode); - final List ignoreList = - ignoredPaths != null && ignoredPaths.length > 0 ? Arrays.asList(ignoredPaths) - : Collections.emptyList(); // reflection will be replaced by this: // https://github.com/fabric8io/kubernetes-client/issues/3816 var specDiffJsonPatch = getDiffsImpactingPathsWithPrefixes(wholeDiffJsonPatch, SPEC); @@ -218,15 +213,10 @@ private static boolean matchSpec(R actual, R desired, bo return false; } if (!equality && !ignoreList.isEmpty()) { - if (!allDiffsOnIgnoreList(specDiffJsonPatch, ignoreList)) { - return false; - } + return allDiffsOnIgnoreList(specDiffJsonPatch, ignoreList); } else { - if (!allDiffsAreAddOps(specDiffJsonPatch)) { - return false; - } + return allDiffsAreAddOps(specDiffJsonPatch); } - return true; } private static boolean allDiffsOnIgnoreList(List metadataJSonDiffs, @@ -241,7 +231,6 @@ private static Optional R desired, R actualResource, boolean labelsAndAnnotationsEquality, Context

context) { - if (labelsAndAnnotationsEquality) { final var desiredMetadata = desired.getMetadata(); final var actualMetadata = actualResource.getMetadata();