소스 검색

fix nil map assign

Ajay Tripathy 1 년 전
부모
커밋
709cebeb76
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      pkg/resourcequota/resourcequota.go

+ 3 - 0
pkg/resourcequota/resourcequota.go

@@ -52,6 +52,9 @@ func (qt *QuotaTracker) GetAllQuotaMetrics() (map[string]map[string][]QuotaMetri
 			log.Errorf("Warning: failed to get quota metrics for namespace %s: %v\n", ns.Name, err)
 			continue
 		}
+		if allMetrics[env.GetClusterID()] == nil {
+			allMetrics[env.GetClusterID()] = make(map[string][]QuotaMetrics)
+		}
 		allMetrics[env.GetClusterID()][ns.Name] = metrics
 	}
 	return allMetrics, nil