mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Fixed panic in GCM data source implementation in Initial Resources
The panic occured when there was no historical data to make prediction
This commit is contained in:
		@@ -122,6 +122,9 @@ func (s *gcmSource) GetUsagePercentile(kind api.ResourceName, perc int64, image,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	count := len(rawSamples)
 | 
			
		||||
	if count == 0 {
 | 
			
		||||
		return 0, 0, nil
 | 
			
		||||
	}
 | 
			
		||||
	sort.Ints(rawSamples)
 | 
			
		||||
	usageIndex := int64(math.Ceil(float64(count)*9/10)) - 1
 | 
			
		||||
	usage := rawSamples[usageIndex]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user