Documentation
¶
Index ¶
- Constants
- func AddQueryBackendOptionsFlags(cmd *cobra.Command, options *QueryBackendOptions)
- func QueryAllocation(p AllocationParameters) ([]map[string]opencost.Allocation, error)
- func QueryAssets(p AssetParameters) ([]map[string]AssetNode, error)
- func QueryClusterID(p ClusterInfoParameters) (string, error)
- func QueryCurrencyCode(p CurrencyCodeParameters) (string, error)
- type AllocationParameters
- type AssetNode
- type AssetParameters
- type ClusterInfoParameters
- type CostPrediction
- type CurrencyCodeParameters
- type PortForwardQuerier
- type QueryBackendOptions
- type SpecCostDiff
- type SpecCostParameters
- type SpecCostResponse
Constants ¶
View Source
const ( OpenCostServiceName = "opencost" OpenCostServiceNamespace = "opencost" OpenCostServicePort = 9003 OpenCostAllocationPath = "/allocation/compute" )
OpenCost specification parameter values
Variables ¶
This section is empty.
Functions ¶
func AddQueryBackendOptionsFlags ¶ added in v0.5.0
func AddQueryBackendOptionsFlags(cmd *cobra.Command, options *QueryBackendOptions)
func QueryAllocation ¶
func QueryAllocation(p AllocationParameters) ([]map[string]opencost.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 QueryClusterID ¶ added in v0.5.0
func QueryClusterID(p ClusterInfoParameters) (string, error)
func QueryCurrencyCode ¶ added in v0.1.9
func QueryCurrencyCode(p CurrencyCodeParameters) (string, error)
Types ¶
type AllocationParameters ¶ added in v0.2.1
type AllocationParameters struct { Ctx context.Context QueryParams map[string]string QueryBackendOptions }
type AssetNode ¶ added in v0.2.4
type AssetNode struct { Type string `json:"type"` Properties opencost.AssetProperties `json:"properties"` Labels opencost.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 opencost.Breakdown `json:"cpuBreakdown"` GPUBreakdown opencost.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 ClusterInfoParameters ¶ added in v0.5.0
type ClusterInfoParameters struct { Ctx context.Context QueryBackendOptions }
type CostPrediction ¶ added in v0.5.0
type CostPrediction struct { TotalMonthlyRate float64 `json:"totalMonthlyRate"` CPUMonthlyRate float64 `json:"cpuMonthlyRate"` RAMMonthlyRate float64 `json:"ramMonthlyRate"` GPUMonthlyRate float64 `json:"gpuMonthlyRate"` MonthlyCPUCoreHours float64 `json:"monthlyCPUCoreHours"` MonthlyRAMByteHours float64 `json:"monthlyRAMByteHours"` MonthlyGPUHours float64 `json:"monthlyGPUHours"` }
type CurrencyCodeParameters ¶ added in v0.2.1
type CurrencyCodeParameters struct { Ctx context.Context QueryBackendOptions }
type PortForwardQuerier ¶ added in v0.3.0
type PortForwardQuerier struct {
// contains filtered or unexported fields
}
func CreatePortForwardForService ¶ added in v0.3.0
func (*PortForwardQuerier) Stop ¶ added in v0.3.0
func (pfq *PortForwardQuerier) Stop()
Stop ends the port forward session.
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 // HelmReleaseName is used to template into service name/etc. to require // less flags if Kubecost is installed in a non-"kubecost" namespace. // // Defaults to "kubecost". HelmReleaseName string // The name of the K8s service for Kubecost. By default, this is templated // from HelmReleaseName. ServiceName string // The namespace in which Kubecost is running. By default, this is templated // from HelmReleaseName. KubecostNamespace string // The port at which the Service should be queried ServicePort int // A path which can serve Allocation queries, e.g. "/model/allocation" AllocationPath string // A path which can serve Spec Cost Prediction queries. // e.g. "/prediction/speccost" PredictSpecCostPath string // A boolean value to automatically set parameters according to OpenCost specification. OpenCost bool // contains filtered or unexported fields }
QueryBackendOptions holds common options for managing the query backend used by kubectl-cost, like service name, namespace, etc.
func (*QueryBackendOptions) Complete ¶ added in v0.3.0
func (o *QueryBackendOptions) Complete(restConfig *rest.Config) error
func (*QueryBackendOptions) Validate ¶ added in v0.3.0
func (o *QueryBackendOptions) Validate() error
type SpecCostDiff ¶ added in v0.5.0
type SpecCostDiff struct { Namespace string `json:"namespace"` ControllerKind string `json:"controllerKind"` ControllerName string `json:"controllerName"` CostBefore CostPrediction `json:"costBefore"` CostAfter CostPrediction `json:"costAfter"` CostChange CostPrediction `json:"costChange"` }
type SpecCostParameters ¶ added in v0.5.0
type SpecCostResponse ¶ added in v0.5.0
type SpecCostResponse = []SpecCostDiff
func QuerySpecCost ¶ added in v0.5.0
func QuerySpecCost(p SpecCostParameters) (SpecCostResponse, error)
Click to show internal directories.
Click to hide internal directories.