diff --git a/pkg/registry/common/querycache/ns_client.go b/pkg/registry/common/querycache/ns_client.go index 757f492c2..743050925 100644 --- a/pkg/registry/common/querycache/ns_client.go +++ b/pkg/registry/common/querycache/ns_client.go @@ -68,7 +68,7 @@ func (q *queryCacheNSClient) Find(ctx context.Context, query *registry.NetworkSe } list = registry.ReadNetworkServiceList(streamClient) for _, item := range list { - q.cache.Add(item.GetName(), []*registry.NetworkService{item}) + q.cache.Add(item.GetName(), []*registry.NetworkService{item.Clone()}) } } var resultStreamChannel = make(chan *registry.NetworkServiceResponse, len(list)) diff --git a/pkg/registry/common/querycache/nse_client.go b/pkg/registry/common/querycache/nse_client.go index 909005cbb..890505d23 100644 --- a/pkg/registry/common/querycache/nse_client.go +++ b/pkg/registry/common/querycache/nse_client.go @@ -68,7 +68,7 @@ func (q *queryCacheNSEClient) Find(ctx context.Context, query *registry.NetworkS } list = registry.ReadNetworkServiceEndpointList(streamClient) for _, item := range list { - q.cache.Add(item.GetName(), []*registry.NetworkServiceEndpoint{item}) + q.cache.Add(item.GetName(), []*registry.NetworkServiceEndpoint{item.Clone()}) } } var resultStreamChannel = make(chan *registry.NetworkServiceEndpointResponse, len(list))