From 2977d6cf0eba4394a3e805ca8a83bf12e8b67e79 Mon Sep 17 00:00:00 2001 From: wangyelei Date: Mon, 23 Dec 2024 09:40:03 +0800 Subject: [PATCH] chore: skip the component definition that is not supported by the current operator (#8684) --- controllers/apps/componentdefinition_controller.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/controllers/apps/componentdefinition_controller.go b/controllers/apps/componentdefinition_controller.go index a6f03661e1e..4dd94d69d8a 100644 --- a/controllers/apps/componentdefinition_controller.go +++ b/controllers/apps/componentdefinition_controller.go @@ -513,6 +513,10 @@ func listCompDefinitionsWithPattern(ctx context.Context, cli client.Reader, name compDefsFullyMatched := make([]*appsv1alpha1.ComponentDefinition, 0) compDefsPatternMatched := make([]*appsv1alpha1.ComponentDefinition, 0) for i, item := range compDefList.Items { + // skip the component definition that is not supported by the current operator + if !intctrlutil.ObjectAPIVersionSupported(&item) { + continue + } if item.Name == namePattern { compDefsFullyMatched = append(compDefsFullyMatched, &compDefList.Items[i]) }