Ajay Tripathy пре 5 година
родитељ
комит
4295475cfe
2 измењених фајлова са 7 додато и 1 уклоњено
  1. 3 0
      pkg/cloud/awsprovider.go
  2. 4 1
      pkg/cloud/providerconfig.go

+ 3 - 0
pkg/cloud/awsprovider.go

@@ -134,6 +134,7 @@ type AWS struct {
 	BaseGPUPrice                string
 	BaseSpotCPUPrice            string
 	BaseSpotRAMPrice            string
+	BaseSpotGPUPrice            string
 	SpotLabelName               string
 	SpotLabelValue              string
 	SpotDataRegion              string
@@ -616,6 +617,7 @@ func (aws *AWS) DownloadPricingData() error {
 	aws.BaseGPUPrice = c.GPU
 	aws.BaseSpotCPUPrice = c.SpotCPU
 	aws.BaseSpotRAMPrice = c.SpotRAM
+	aws.BaseSpotGPUPrice = c.SpotGPU
 	aws.SpotLabelName = c.SpotLabel
 	aws.SpotLabelValue = c.SpotLabelValue
 	aws.SpotDataBucket = c.SpotDataBucket
@@ -1007,6 +1009,7 @@ func (aws *AWS) createNode(terms *AWSProductTerms, usageType string, k Key) (*No
 			VCPUCost:     aws.BaseSpotCPUPrice,
 			RAM:          terms.Memory,
 			GPU:          terms.GPU,
+			CPUCost:      aws.BaseSpotGPUPrice,
 			RAMCost:      aws.BaseSpotRAMPrice,
 			Storage:      terms.Storage,
 			BaseCPUPrice: aws.BaseCPUPrice,

+ 4 - 1
pkg/cloud/providerconfig.go

@@ -89,7 +89,9 @@ func (pc *ProviderConfig) loadConfig(writeIfNotExists bool) (*CustomPricing, err
 	}
 
 	pc.customPricing = &customPricing
-
+	if pc.customPricing.SpotGPU == "" {
+		pc.customPricing.SpotGPU = DefaultPricing().SpotGPU // Migration for users without this value set by default.
+	}
 	return pc.customPricing, nil
 }
 
@@ -169,6 +171,7 @@ func DefaultPricing() *CustomPricing {
 		RAM:                   "0.004237",
 		SpotRAM:               "0.000892",
 		GPU:                   "0.95",
+		SpotGPU:               "0.308",
 		Storage:               "0.00005479452",
 		ZoneNetworkEgress:     "0.01",
 		RegionNetworkEgress:   "0.01",