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

Update bingen asset version number, fix adjustment field on cluster management

Signed-off-by: Sean Holcomb <seanholcomb@gmail.com>
Sean Holcomb 3 лет назад
Родитель
Сommit
f3d0ca7f1c
3 измененных файлов с 15 добавлено и 16 удалено
  1. 1 1
      pkg/kubecost/asset.go
  2. 1 1
      pkg/kubecost/bingen.go
  3. 13 14
      pkg/kubecost/kubecost_codecs.go

+ 1 - 1
pkg/kubecost/asset.go

@@ -856,8 +856,8 @@ type ClusterManagement struct {
 	labels     AssetLabels
 	properties *AssetProperties
 	window     Window
-	adjustment float64
 	Cost       float64
+	adjustment float64 // @bingen:field[version=16]
 }
 
 // NewClusterManagement creates and returns a new ClusterManagement instance

+ 1 - 1
pkg/kubecost/bingen.go

@@ -24,7 +24,7 @@ package kubecost
 // @bingen:generate:Window
 
 // Asset Version Set: Includes Asset pipeline specific resources
-// @bingen:set[name=Assets,version=15]
+// @bingen:set[name=Assets,version=16]
 // @bingen:generate:Any
 // @bingen:generate:Asset
 // @bingen:generate:AssetLabels

+ 13 - 14
pkg/kubecost/kubecost_codecs.go

@@ -13,12 +13,11 @@ package kubecost
 
 import (
 	"fmt"
+	util "github.com/opencost/opencost/pkg/util"
 	"reflect"
 	"strings"
 	"sync"
 	"time"
-
-	util "github.com/opencost/opencost/pkg/util"
 )
 
 const (
@@ -34,17 +33,17 @@ 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 = 15
-
 	// AllocationCodecVersion is used for any resources listed in the Allocation version set
 	AllocationCodecVersion uint8 = 15
 
 	// 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
+
+	// AssetsCodecVersion is used for any resources listed in the Assets version set
+	AssetsCodecVersion uint8 = 16
 )
 
 //--------------------------------------------------------------------------
@@ -5260,8 +5259,8 @@ func (target *ClusterManagement) MarshalBinaryWithContext(ctx *EncodingContext)
 	}
 	// --- [end][write][struct](Window) ---
 
-	buff.WriteFloat64(target.adjustment) // write float64
 	buff.WriteFloat64(target.Cost)       // write float64
+	buff.WriteFloat64(target.adjustment) // write float64
 	return nil
 }
 
@@ -5399,18 +5398,18 @@ func (target *ClusterManagement) UnmarshalBinaryWithContext(ctx *DecodingContext
 
 	if uint8(0) /* field version */ <= version {
 		n := buff.ReadFloat64() // read float64
-		target.adjustment = n
+		target.Cost = n
 
 	} else {
-		target.adjustment = float64(0) // default
+		target.Cost = float64(0) // default
 	}
 
-	if uint8(0) /* field version */ <= version {
+	if uint8(16) /* field version */ <= version {
 		o := buff.ReadFloat64() // read float64
-		target.Cost = o
+		target.adjustment = o
 
 	} else {
-		target.Cost = float64(0) // default
+		target.adjustment = float64(0) // default
 	}
 
 	return nil