query

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueryAllocation

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

QueryAllocation queries the Allocation API 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 QueryAssets added in v0.2.4

func QueryAssets(p AssetParameters) ([]map[string]AssetNode, error)

QueryAssets queries /model/assets 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 AllocationParameters added in v0.2.1

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

	QueryParams map[string]string

	QueryBackendOptions
}

type AssetNode added in v0.2.4

type AssetNode struct {
	Type         string                   `json:"type"`
	Properties   kubecost.AssetProperties `json:"properties"`
	Labels       kubecost.AssetLabels     `json:"labels"`
	Start        string                   `json:"start"`
	End          string                   `json:"end"`
	Minutes      float64                  `json:"minutes"`
	NodeType     string                   `json:"nodeType"`
	CpuCores     float64                  `json:"cpuCores"`
	RamBytes     float64                  `json:"ramBytes"`
	CPUCoreHours float64                  `json:"cpuCoreHours"`
	RAMByteHours float64                  `json:"ramByteHours"`
	GPUHours     float64                  `json:"GPUHours"`
	CPUBreakdown kubecost.Breakdown       `json:"cpuBreakdown"`
	GPUBreakdown kubecost.Breakdown       `json:"ramBreakdown"`
	Preemptible  float64                  `json:"preemptible"`
	Discount     float64                  `json:"discount"`
	CPUCost      float64                  `json:"cpuCost"`
	GPUCost      float64                  `json:"gpuCost"`
	GPUCount     float64                  `json:"gpuCount"`
	RAMCost      float64                  `json:"ramCost"`
	Adjustment   float64                  `json:"adjustment"`
	TotalCost    float64                  `json:"totalCost"`
}

type AssetParameters added in v0.2.4

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

	Window             string
	Aggregate          string
	DisableAdjustments bool
	Accumulate         string
	FilterTypes        string

	QueryBackendOptions
}

type CurrencyCodeParameters added in v0.2.1

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

	QueryBackendOptions
}

type QueryBackendOptions added in v0.2.7

type QueryBackendOptions struct {
	// If set, will proxy a request through the K8s API server
	// instead of port forwarding.
	UseProxy bool

	// The name of the cost-analyzer service in the cluster,
	// in case user is running a non-standard name (like the
	// staging helm chart). Combines with
	// commonOptions.configFlags.Namespace to direct the API
	// request.
	ServiceName string

	// The port at which the Service should be queried
	ServicePort int

	// The namespace in which Kubecost is running
	KubecostNamespace string

	// The path at which can serve Allocation queries, e.g. "/model/allocation"
	AllocationPath string
}

QueryBackendOptions holds common options for managing the query backend used by kubectl-cost, like service name, namespace, etc.

Jump to

Keyboard shortcuts

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