query

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueryAggCostModel

func QueryAggCostModel(p AggCostModelParameters) (map[string]Aggregation, error)

QueryAggCostModel queries /model/aggregatedCostModel by proxying a request to Kubecost through the Kubernetes API server if useProxy is true or, if it isn't, by temporarily port forwarding to a Kubecost pod.

func QueryAllocation

func QueryAllocation(p AllocationParameters) ([]map[string]kubecost.Allocation, error)

QueryAllocation queries /model/allocation by proxying a request to Kubecost through the Kubernetes API server if useProxy is true or, if it isn't, by temporarily port forwarding to a Kubecost pod.

func QueryCurrencyCode added in v0.1.9

func QueryCurrencyCode(p CurrencyCodeParameters) (string, error)

Types

type AggCostModelParameters added in v0.2.1

type AggCostModelParameters struct {
	RestConfig *rest.Config
	Ctx        context.Context

	KubecostNamespace   string
	ServiceName         string
	Window              string
	Aggregate           string
	AggregationSubfield string
	UseProxy            bool
}

type Aggregation

type Aggregation struct {
	Aggregator                 string               `json:"aggregation"`
	Subfields                  []string             `json:"subfields,omitempty"`
	Environment                string               `json:"environment"`
	Cluster                    string               `json:"cluster,omitempty"`
	Properties                 *kubecost.Properties `json:"-"`
	CPUAllocationHourlyAverage float64              `json:"cpuAllocationAverage"`
	CPUAllocationVectors       []*util.Vector       `json:"-"`
	CPUAllocationTotal         float64              `json:"-"`
	CPUCost                    float64              `json:"cpuCost"`
	CPUCostVector              []*util.Vector       `json:"cpuCostVector,omitempty"`
	CPUEfficiency              float64              `json:"cpuEfficiency"`
	CPURequestedVectors        []*util.Vector       `json:"-"`
	CPUUsedVectors             []*util.Vector       `json:"-"`
	Efficiency                 float64              `json:"efficiency"`
	GPUAllocationHourlyAverage float64              `json:"gpuAllocationAverage"`
	GPUAllocationVectors       []*util.Vector       `json:"-"`
	GPUCost                    float64              `json:"gpuCost"`
	GPUCostVector              []*util.Vector       `json:"gpuCostVector,omitempty"`
	GPUAllocationTotal         float64              `json:"-"`
	RAMAllocationHourlyAverage float64              `json:"ramAllocationAverage"`
	RAMAllocationVectors       []*util.Vector       `json:"-"`
	RAMAllocationTotal         float64              `json:"-"`
	RAMCost                    float64              `json:"ramCost"`
	RAMCostVector              []*util.Vector       `json:"ramCostVector,omitempty"`
	RAMEfficiency              float64              `json:"ramEfficiency"`
	RAMRequestedVectors        []*util.Vector       `json:"-"`
	RAMUsedVectors             []*util.Vector       `json:"-"`
	PVAllocationHourlyAverage  float64              `json:"pvAllocationAverage"`
	PVAllocationVectors        []*util.Vector       `json:"-"`
	PVAllocationTotal          float64              `json:"-"`
	PVCost                     float64              `json:"pvCost"`
	PVCostVector               []*util.Vector       `json:"pvCostVector,omitempty"`
	NetworkCost                float64              `json:"networkCost"`
	NetworkCostVector          []*util.Vector       `json:"networkCostVector,omitempty"`
	SharedCost                 float64              `json:"sharedCost"`
	TotalCost                  float64              `json:"totalCost"`
	TotalCostVector            []*util.Vector       `json:"totalCostVector,omitempty"`
}

Hardcoded instead of imported because of dependency problems introduced when github.com/kubecost/cost-model/pkg/costmodel is imported. The breakage involves Azure's go-autorest, the azure-sdk-for-go, and k8s client-go. Basically, cost-model uses a very old version of client-go, etc. that causes a breakage.

type AllocationParameters added in v0.2.1

type AllocationParameters struct {
	RestConfig *rest.Config
	Ctx        context.Context

	KubecostNamespace string
	ServiceName       string
	Window            string
	Aggregate         string
	UseProxy          bool
}

type CurrencyCodeParameters added in v0.2.1

type CurrencyCodeParameters struct {
	RestConfig *rest.Config
	Ctx        context.Context

	KubecostNamespace string
	ServiceName       string
	UseProxy          bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL