Преглед изворни кода

Adding exception for Cloud Services meter subcategory (#2907)

* Adding exception for Cloud Services meter subcategory

For some instance types like D4as v5 opencost fetch Cloud Services price
resulting in reporting more cost than expected. This happens because
Cloud Services meter subcategory isn't ignored like Windows.

Signed-off-by: Raghavendra <raghavendra@rafay.co>

* RC-37682 Msft returns CloudServices incase of Standard_E2as_v5 pricing API respone, while for others it returns Cloud Services. Added CloudServices into check to remove the meter. (#17)

Signed-off-by: Raghavendra <raghavendra@rafay.co>

---------

Signed-off-by: Raghavendra <raghavendra@rafay.co>
Raghavendra Challapali пре 1 година
родитељ
комит
f4ed4e1813
1 измењених фајлова са 5 додато и 0 уклоњено
  1. 5 0
      pkg/cloud/azure/provider.go

+ 5 - 0
pkg/cloud/azure/provider.go

@@ -936,6 +936,11 @@ func convertMeterToPricings(info commerce.MeterInfo, regions map[string]string,
 		return nil, nil
 	}
 
+	if strings.Contains(meterSubCategory, "Cloud Services") || strings.Contains(meterSubCategory, "CloudServices") {
+		// This meter doesn't correspond to any pricings.
+		return nil, nil
+	}
+
 	if strings.Contains(meterCategory, "Storage") {
 		if strings.Contains(meterSubCategory, "HDD") || strings.Contains(meterSubCategory, "SSD") || strings.Contains(meterSubCategory, "Premium Files") {
 			var storageClass string = ""