Переглянути джерело

remvoing the default of unknown and making it empty string and using unknown only if new metrics doesnt have pv information also if two storage classes are different default it to empty

Signed-off-by: Alan Rodrigues <alanr5691@yahoo.com>
Alan Rodrigues 3 роки тому
батько
коміт
9812898b03
3 змінених файлів з 7 додано та 12 видалено
  1. 0 5
      pkg/costmodel/cluster.go
  2. 3 3
      pkg/kubecost/asset.go
  3. 4 4
      pkg/kubecost/kubecost_codecs.go

+ 0 - 5
pkg/costmodel/cluster.go

@@ -351,11 +351,6 @@ func ClusterDisks(client prometheus.Client, provider cloud.Provider, start, end
 		if disk.ProviderID == "" {
 			disk.ProviderID = disk.Name
 		}
-
-		// Explicitly specify unknown storage class for disk whose information is unavailable in prometheus metrics of kubecost_pv_info
-		if disk.StorageClass == "" {
-			disk.StorageClass = kubecost.UnknownStorageClass
-		}
 	}
 
 	return diskMap, nil

+ 3 - 3
pkg/kubecost/asset.go

@@ -1069,7 +1069,7 @@ type Disk struct {
 	ByteHours    float64
 	Local        float64
 	Breakdown    *Breakdown
-	StorageClass string // @bingen:field[version=17, default=__unknown__]
+	StorageClass string // @bingen:field[version=17]
 }
 
 // NewDisk creates and returns a new Disk Asset
@@ -1262,9 +1262,9 @@ func (d *Disk) add(that *Disk) {
 
 	d.ByteHours += that.ByteHours
 
-	// If storage class don't match default it to Unknown storage class
+	// If storage class don't match default it to empty storage class
 	if d.StorageClass != that.StorageClass {
-		d.StorageClass = UnknownStorageClass
+		d.StorageClass = ""
 	}
 }
 

+ 4 - 4
pkg/kubecost/kubecost_codecs.go

@@ -33,6 +33,9 @@ const (
 )
 
 const (
+	// DefaultCodecVersion is used for any resources listed in the Default version set
+	DefaultCodecVersion uint8 = 15
+
 	// AssetsCodecVersion is used for any resources listed in the Assets version set
 	AssetsCodecVersion uint8 = 17
 
@@ -41,9 +44,6 @@ const (
 
 	// AuditCodecVersion is used for any resources listed in the Audit version set
 	AuditCodecVersion uint8 = 1
-
-	// DefaultCodecVersion is used for any resources listed in the Default version set
-	DefaultCodecVersion uint8 = 15
 )
 
 //--------------------------------------------------------------------------
@@ -5159,7 +5159,7 @@ func (target *Disk) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
 		target.StorageClass = aa
 
 	} else {
-		target.StorageClass = "__unknown__" // default
+		target.StorageClass = "" // default
 	}
 
 	return nil