Răsfoiți Sursa

Merge pull request #1193 from kubecost/ramich-gpu

Don't add gpu pricing when no gpu
Dan Ramich 4 ani în urmă
părinte
comite
e8ecd57d59

+ 2 - 2
pkg/costmodel/cluster_helpers.go

@@ -246,10 +246,10 @@ func buildGPUCostMap(
 		clusterAndNameToType[keyNon] = nodeType
 
 		// If gpu count is available use it to multiply gpu cost
-		if value, ok := gpuCountMap[key]; ok && value != 0 {
+		if value, ok := gpuCountMap[key]; ok {
 			gpuCostMap[key] = gpuCost * value
 		} else {
-			gpuCostMap[key] = gpuCost
+			gpuCostMap[key] = 0
 		}
 
 	}

+ 2 - 2
pkg/costmodel/cluster_helpers_test.go

@@ -772,7 +772,7 @@ func TestBuildGPUCostMap(t *testing.T) {
 					Cluster:    "cluster1",
 					Name:       "node1",
 					ProviderID: "provider1",
-				}: 2,
+				}: 0,
 			},
 		},
 		{
@@ -799,7 +799,7 @@ func TestBuildGPUCostMap(t *testing.T) {
 					Cluster:    "cluster1",
 					Name:       "node1",
 					ProviderID: "provider1",
-				}: 2,
+				}: 0,
 			},
 		},
 		{