Kaynağa Gözat

Remove irresponsible default cost in ClusterLoadBalancers

Niko Kovacevic 2 hafta önce
ebeveyn
işleme
3766848e91
2 değiştirilmiş dosya ile 3 ekleme ve 3 silme
  1. 3 0
      pkg/cloud/provider/provider.go
  2. 0 3
      pkg/costmodel/cluster.go

+ 3 - 0
pkg/cloud/provider/provider.go

@@ -366,6 +366,9 @@ func ParsePVID(id string) string {
 
 // ParseLBID attempts to parse a LB ProviderId from a string based on formats from the various providers and
 // returns the string as is if it cannot find a match
+//
+// TODO KCM-5667: loadBalancerAWSRegex does not correctly identify the ProviderID for gateway host names
+// e.g. k8s-kgateway-customer-abcd-1234.elb.us-east-1.amazonaws.com => "k8s"
 func ParseLBID(id string) string {
 	match := loadBalancerAWSRegex.FindStringSubmatch(id)
 	if len(match) >= 2 {

+ 0 - 3
pkg/costmodel/cluster.go

@@ -622,7 +622,6 @@ func ClusterLoadBalancers(dataSource source.OpenCostDataSource, start, end time.
 			Cluster:    key.Cluster,
 			Namespace:  key.Namespace,
 			Name:       key.Name,
-			Cost:       lbPricePerHr, // default to hourly cost, overwrite if active entry exists
 			Ip:         key.IngressIP,
 			Private:    privateIPCheck(key.IngressIP),
 			ProviderID: provider.ParseLBID(key.IngressIP),
@@ -635,8 +634,6 @@ func ClusterLoadBalancers(dataSource source.OpenCostDataSource, start, end time.
 
 			if lb.Minutes > 0 {
 				lb.Cost = lbPricePerHr * (lb.Minutes / 60.0)
-			} else {
-				log.DedupedWarningf(20, "ClusterLoadBalancers: found zero minutes for key: %v", key)
 			}
 		}