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)
|
||||
continue
|
||||
}
|
||||
items = append(items, addAnnotationWithClusterName([]runtime.Object{resourceObject}, cluster.Name)...)
|
||||
items = append(items, addAnnotationWithClusterName([]runtime.Object{resourceObject.DeepCopyObject()}, cluster.Name)...)
|
||||
} else {
|
||||
var resourceObjects []runtime.Object
|
||||
if len(namespace) > 0 {
|
||||
|
@ -132,7 +132,13 @@ func (r *SearchREST) getObjectItemsFromClusters(
|
|||
objGVR, cluster.Name, err)
|
||||
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