فهرست منبع

Update data structures to support ad hoc queries

Sean Holcomb 4 سال پیش
والد
کامیت
f330beb062
4فایلهای تغییر یافته به همراه20 افزوده شده و 3 حذف شده
  1. 1 0
      pkg/cloud/provider.go
  2. 3 0
      pkg/kubecost/asset.go
  3. 15 3
      pkg/kubecost/query.go
  4. 1 0
      pkg/kubecost/status.go

+ 1 - 0
pkg/cloud/provider.go

@@ -188,6 +188,7 @@ type CustomPricing struct {
 	ReadOnly                     string `json:"readOnly"`
 	KubecostToken                string `json:"kubecostToken"`
 	GoogleAnalyticsTag           string `json:"googleAnalyticsTag"`
+	ExcludeProviderID            string `json:"excludeProviderID"`
 }
 
 // GetSharedOverheadCostPerMonth parses and returns a float64 representation

+ 3 - 0
pkg/kubecost/asset.go

@@ -315,6 +315,9 @@ func toString(a Asset) string {
 	return fmt.Sprintf("%s{%s}%s=%.2f", a.Type().String(), a.Properties(), a.Window(), a.TotalCost())
 }
 
+// AssetLabelAccountPrefix is the prefix added to Account level labels which are distributed to assets so that they can be identified as such
+const AssetLabelAccountPrefix = "Account_Inherited_"
+
 // AssetLabels is a schema-free mapping of key/value pairs that can be
 // attributed to an Asset as a flexible a
 type AssetLabels map[string]string

+ 15 - 3
pkg/kubecost/query.go

@@ -69,9 +69,21 @@ type AssetQueryOptions struct {
 
 // CloudUsageQueryOptions define optional parameters for querying a Store
 type CloudUsageQueryOptions struct {
-	Accumulate  bool
-	AggregateBy []string
-	FilterFuncs []CloudUsageMatchFunc
+	Accumulate   bool
+	AggregateBy  []string
+	Compute      bool
+	FilterFuncs  []CloudUsageMatchFunc
+	FilterValues CloudUsageFilter
+}
+
+type CloudUsageFilter struct {
+	Categories  []string            `json:"categories"`
+	Providers   []string            `json:"providers"`
+	ProviderIDs []string            `json:"providerIDs"`
+	Accounts    []string            `json:"accounts"`
+	Projects    []string            `json:"projects"`
+	Services    []string            `json:"services"`
+	Labels      map[string][]string `json:"labels"`
 }
 
 // QueryAllocationAsync provide a functions for retrieving results from any AllocationQuerier Asynchronously

+ 1 - 0
pkg/kubecost/status.go

@@ -38,6 +38,7 @@ type FileStatus struct {
 // CloudStatus describes CloudStore metadata
 type CloudStatus struct {
 	CloudConnectionStatus string                `json:"cloudConnectionStatus"`
+	ProviderType          string                `json:"providerType"`
 	CloudUsage            *CloudAssetStatus     `json:"cloudUsage,omitempty"`
 	Reconciliation        *ReconciliationStatus `json:"reconciliation,omitempty"`
 }