Sfoglia il codice sorgente

Merge pull request #2004 from ameijer/atm/burndown-107-labels

Provide mechanism for aggregating metadata across accumulations
Thomas Evans 2 anni fa
parent
commit
b184f186e0
2 ha cambiato i file con 7 aggiunte e 0 eliminazioni
  1. 6 0
      pkg/kubecost/allocation.go
  2. 1 0
      pkg/kubecost/allocationprops.go

+ 6 - 0
pkg/kubecost/allocation.go

@@ -1221,6 +1221,12 @@ func (as *AllocationSet) AggregateBy(aggregateBy []string, options *AllocationAg
 	shouldShare := len(options.SharedHourlyCosts) > 0 || len(options.ShareFuncs) > 0
 	if !shouldAggregate && !shouldFilter && !shouldShare && options.ShareIdle == ShareNone && !options.IncludeProportionalAssetResourceCosts {
 		// There is nothing for AggregateBy to do, so simply return nil
+		// before returning, set aggregated metadata inclusion in properties
+		if options.IncludeAggregatedMetadata {
+			for index := range as.Allocations {
+				as.Allocations[index].Properties.AggregatedMetadata = true
+			}
+		}
 		return nil
 	}
 

+ 1 - 0
pkg/kubecost/allocationprops.go

@@ -161,6 +161,7 @@ func (p *AllocationProperties) Clone() *AllocationProperties {
 	}
 	clone.NamespaceAnnotations = nsAnnotations
 
+	clone.AggregatedMetadata = p.AggregatedMetadata
 	return clone
 }