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

Merge branch 'develop' into feat/pricing-summary-endpoint

Mark 3 лет назад
Родитель
Сommit
62127329b8
2 измененных файлов с 25 добавлено и 3 удалено
  1. 24 2
      pkg/kubecost/asset.go
  2. 1 1
      pkg/kubecost/cloudcostitem.go

+ 24 - 2
pkg/kubecost/asset.go

@@ -2168,9 +2168,9 @@ func (n *Node) MonitoringKey() string {
 		if len(aliProviderID) != 2 {
 			return ""
 		}
-		return nodeProps.Provider + "/" + nodeProps.Account + "/" + aliProviderID[1]
+		return nodeProps.Provider + "/" + aliProviderID[1]
 	}
-	return nodeProps.Provider + "/" + nodeProps.Account + "/" + nodeProps.ProviderID
+	return nodeProps.Provider + "/" + nodeProps.ProviderID
 }
 
 // LoadBalancer is an Asset representing a single load balancer in a cluster
@@ -3410,6 +3410,28 @@ func (asr *AssetSetRange) InsertRange(that *AssetSetRange) error {
 	return err
 }
 
+func (asr *AssetSetRange) GetWarnings() []string {
+	warnings := []string{}
+
+	for _, as := range asr.Assets {
+		if len(as.Warnings) > 0 {
+			warnings = append(warnings, as.Warnings...)
+		}
+	}
+
+	return warnings
+}
+
+func (asr *AssetSetRange) HasWarnings() bool {
+	for _, as := range asr.Assets {
+		if len(as.Warnings) > 0 {
+			return true
+		}
+	}
+
+	return false
+}
+
 // IsEmpty returns false if AssetSetRange contains a single AssetSet that is not empty
 func (asr *AssetSetRange) IsEmpty() bool {
 	if asr == nil || asr.Length() == 0 {

+ 1 - 1
pkg/kubecost/cloudcostitem.go

@@ -81,7 +81,7 @@ func (ccip CloudCostItemProperties) Key() string {
 }
 
 func (ccip CloudCostItemProperties) MonitoringKey() string {
-	return fmt.Sprintf("%s/%s/%s", ccip.Provider, ccip.WorkGroupID, ccip.ProviderID)
+	return fmt.Sprintf("%s/%s", ccip.Provider, ccip.ProviderID)
 }
 
 // CloudCostItem represents a CUR line item, identifying a cloud resource and