فهرست منبع

Merge pull request #290 from kubecost/AjayTripathy-pricesplit

Ajay tripathy pricesplit
Ajay Tripathy 6 سال پیش
والد
کامیت
9b7effeadf
1فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 6 2
      costmodel/costmodel.go

+ 6 - 2
costmodel/costmodel.go

@@ -1228,8 +1228,12 @@ func (cm *CostModel) GetNodeCost(cp costAnalyzerCloud.Provider) (map[string]*cos
 
 
 			cpuPrice := ramPrice * cpuToRAMRatio
 			cpuPrice := ramPrice * cpuToRAMRatio
 
 
-			newCnode.VCPUCost = fmt.Sprintf("%f", cpuPrice)
-			newCnode.RAMCost = fmt.Sprintf("%f", ramPrice)
+			if defaultRAM != 0 {
+				newCnode.VCPUCost = fmt.Sprintf("%f", cpuPrice)
+				newCnode.RAMCost = fmt.Sprintf("%f", ramPrice)
+			} else { // just assign the full price to CPU
+				newCnode.VCPUCost = fmt.Sprintf("%f", nodePrice)
+			}
 			newCnode.RAMBytes = fmt.Sprintf("%f", ram)
 			newCnode.RAMBytes = fmt.Sprintf("%f", ram)
 
 
 			klog.V(4).Infof("Computed \"%s\" RAM Cost := %v", name, newCnode.RAMCost)
 			klog.V(4).Infof("Computed \"%s\" RAM Cost := %v", name, newCnode.RAMCost)