From cc0f6ed08bde6acd6662effbd6f6d6a2ba6ed899 Mon Sep 17 00:00:00 2001 From: lihanbo Date: Mon, 1 Nov 2021 17:00:52 +0800 Subject: [PATCH] return nil when the obj not managed by Karmada in work status controller Signed-off-by: lihanbo --- pkg/controllers/status/workstatus_controller.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/controllers/status/workstatus_controller.go b/pkg/controllers/status/workstatus_controller.go index 8d378c195..6f29d2c89 100644 --- a/pkg/controllers/status/workstatus_controller.go +++ b/pkg/controllers/status/workstatus_controller.go @@ -116,11 +116,11 @@ func generateKey(obj interface{}) (util.QueueKey, error) { resource := obj.(*unstructured.Unstructured) cluster, err := getClusterNameFromLabel(resource) if err != nil { - return "", err + return nil, err } - // it happens when the obj not managed by Karmada. + // return a nil key when the obj not managed by Karmada, which will be discarded before putting to queue. if cluster == "" { - return "", nil + return nil, nil } return keys.FederatedKeyFunc(cluster, obj)