소스 검색

reduce memory consumption (#2725)

avoid copying of every kubernetes object for every /metrics call

Signed-off-by: r2k1 <yokree@gmail.com>
r2k1 1 년 전
부모
커밋
a3beb32763
1개의 변경된 파일1개의 추가작업 그리고 13개의 파일을 삭제
  1. 1 13
      pkg/clustercache/watchcontroller.go

+ 1 - 13
pkg/clustercache/watchcontroller.go

@@ -88,19 +88,7 @@ func NewCachingWatcher(restClient rest.Interface, resource string, resourceType
 }
 
 func (c *CachingWatchController) GetAll() []interface{} {
-	list := c.indexer.List()
-
-	// since the indexer returns the as-is pointer to the resource,
-	// we deep copy the resources such that callers don't corrupt the
-	// index
-	cloneList := make([]interface{}, 0, len(list))
-	for _, v := range list {
-		if deepCopyable, ok := v.(rt.Object); ok {
-			cloneList = append(cloneList, deepCopyable.DeepCopyObject())
-		}
-	}
-
-	return cloneList
+	return c.indexer.List()
 }
 
 func (c *CachingWatchController) SetUpdateHandler(handler WatchHandler) WatchController {