Bläddra i källkod

Update TODOs; add log

Niko Kovacevic 5 år sedan
förälder
incheckning
52337cb94e
2 ändrade filer med 5 tillägg och 15 borttagningar
  1. 2 12
      pkg/kubecost/allocation.go
  2. 3 3
      pkg/kubecost/asset.go

+ 2 - 12
pkg/kubecost/allocation.go

@@ -245,16 +245,8 @@ func (a *Allocation) String() string {
 }
 
 func (a *Allocation) add(that *Allocation, isShared, isAccumulating bool) {
-	// TODO niko/allocation-etl this can't possibly work as it reads
-	// ...right?? (See https://play.golang.org/p/UDZ-GsNJ1rI)
 	if a == nil {
-		a = that
-
-		// reset properties
-		thatCluster, _ := that.Properties.GetCluster()
-		thatNode, _ := that.Properties.GetNode()
-		a.Properties = Properties{ClusterProp: thatCluster, NodeProp: thatNode}
-
+		log.Warningf("Allocation.AggregateBy: trying to add a nil receiver")
 		return
 	}
 
@@ -743,8 +735,6 @@ func (as *AllocationSet) AggregateBy(properties Properties, options *AllocationA
 	for _, alloc := range externalSet.allocations {
 		key, err := alloc.generateKey(properties)
 		if err != nil {
-			// TODO niko/allocation-etl remove log after testing
-			log.Infof("ExternalAllocations: AggregateBy: skipping %s: %s", alloc.Name, err)
 			continue
 		}
 
@@ -1125,7 +1115,7 @@ func (as *AllocationSet) ComputeIdleAllocations(assetSet *AssetSet) (map[string]
 		return nil, fmt.Errorf("cannot compute idle allocation for nil AllocationSet")
 	}
 
-	// TODO niko/allocation-etl remove after testing and benchmarking
+	// TODO: external allocation: remove after testing and benchmarking
 	profStart := time.Now()
 	defer log.Profile(profStart, fmt.Sprintf("ComputeIdleAllocations: %s", as.Window))
 

+ 3 - 3
pkg/kubecost/asset.go

@@ -164,7 +164,7 @@ func AssetToExternalAllocation(asset Asset, aggregateBy []string, allocationProp
 				case ContainerProp.String():
 					props.SetContainer(value)
 				case ServiceProp.String():
-					// TODO niko/allocation-etl how to do this? multi-service?
+					// TODO: external allocation: how to do this? multi-service?
 					props.SetServices([]string{value})
 				}
 			}
@@ -183,8 +183,8 @@ func AssetToExternalAllocation(asset Asset, aggregateBy []string, allocationProp
 
 	names = append(names, ExternalSuffix)
 
-	// TODO niko/allocation-etl efficiency?
-	// TODO niko/allocation-etl resource totals?
+	// TODO: external allocation: efficiency?
+	// TODO: external allocation: resource totals?
 	return &Allocation{
 		Name:         strings.Join(names, "/"),
 		Properties:   props,