return nil when the obj not managed by Karmada in work status controller

Signed-off-by: lihanbo <lihanbo2@huawei.com>
This commit is contained in:
lihanbo 2021-11-01 17:00:52 +08:00
parent 209be7f540
commit cc0f6ed08b
1 changed files with 3 additions and 3 deletions

View File

@ -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)