Просмотр исходного кода

Merge pull request #252 from kubecost/AjayTripathy-negotiated-discount

support saving of negotiated discounts
Ajay Tripathy 6 лет назад
Родитель
Сommit
1db698c365
4 измененных файлов с 13 добавлено и 0 удалено
  1. 3 0
      cloud/awsprovider.go
  2. 3 0
      cloud/azureprovider.go
  3. 3 0
      cloud/gcpprovider.go
  4. 4 0
      cloud/provider.go

+ 3 - 0
cloud/awsprovider.go

@@ -258,6 +258,9 @@ func (aws *AWS) GetConfig() (*CustomPricing, error) {
 	if c.Discount == "" {
 		c.Discount = "0%"
 	}
+	if c.NegotiatedDiscount == "" {
+		c.NegotiatedDiscount = "0%"
+	}
 	if err != nil {
 		return nil, err
 	}

+ 3 - 0
cloud/azureprovider.go

@@ -560,6 +560,9 @@ func (az *Azure) GetConfig() (*CustomPricing, error) {
 	if c.Discount == "" {
 		c.Discount = "0%"
 	}
+	if c.NegotiatedDiscount == "" {
+		c.NegotiatedDiscount = "0%"
+	}
 	if c.CurrencyCode == "" {
 		c.CurrencyCode = "USD"
 	}

+ 3 - 0
cloud/gcpprovider.go

@@ -93,6 +93,9 @@ func (gcp *GCP) GetConfig() (*CustomPricing, error) {
 	if c.Discount == "" {
 		c.Discount = "30%"
 	}
+	if c.NegotiatedDiscount == "" {
+		c.NegotiatedDiscount = "0%"
+	}
 	return c, nil
 }
 

+ 4 - 0
cloud/provider.go

@@ -145,6 +145,7 @@ type CustomPricing struct {
 	AzureBillingRegion    string `json:"azureBillingRegion"`
 	CurrencyCode          string `json:"currencyCode"`
 	Discount              string `json:"discount"`
+	NegotiatedDiscount    string `json:"negotiatedDiscount"`
 	ClusterName           string `json:"clusterName"`
 }
 
@@ -191,6 +192,9 @@ func CustomPricesEnabled(p Provider) bool {
 	if err != nil {
 		return false
 	}
+	if config.NegotiatedDiscount == "" {
+		config.NegotiatedDiscount = "0%"
+	}
 
 	return config.CustomPricesEnabled == "true"
 }