fix addAnnotationWithClusterName crash
Signed-off-by: yingjinhui <yingjinhui@didiglobal.com>
This commit is contained in:
parent
48a37ab5b1
commit
5763248181
|
@ -119,7 +119,7 @@ func (r *SearchREST) getObjectItemsFromClusters(
|
||||||
objGVR, namespace, name, cluster.Name, err)
|
objGVR, namespace, name, cluster.Name, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
items = append(items, addAnnotationWithClusterName([]runtime.Object{resourceObject}, cluster.Name)...)
|
items = append(items, addAnnotationWithClusterName([]runtime.Object{resourceObject.DeepCopyObject()}, cluster.Name)...)
|
||||||
} else {
|
} else {
|
||||||
var resourceObjects []runtime.Object
|
var resourceObjects []runtime.Object
|
||||||
if len(namespace) > 0 {
|
if len(namespace) > 0 {
|
||||||
|
@ -132,7 +132,13 @@ func (r *SearchREST) getObjectItemsFromClusters(
|
||||||
objGVR, cluster.Name, err)
|
objGVR, cluster.Name, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
items = append(items, addAnnotationWithClusterName(resourceObjects, cluster.Name)...)
|
|
||||||
|
cloneObjects := make([]runtime.Object, len(resourceObjects))
|
||||||
|
for i := range resourceObjects {
|
||||||
|
cloneObjects[i] = resourceObjects[i].DeepCopyObject()
|
||||||
|
}
|
||||||
|
|
||||||
|
items = append(items, addAnnotationWithClusterName(cloneObjects, cluster.Name)...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue