cloudcost

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerAllocation

type ContainerAllocation struct {
	Key           string
	Pod           string
	Node          string
	Namespace     string
	CpuAllocation float64
	RamAllocation float64
}

type CostModel

type CostModel interface {
	// GetNodesCost get all the real nodes price of kubernetes cluster with name as the key.
	GetNodesCost() (map[string]*cloud.Node, error)
	// GetPodsCost get the eks or tke pod price.
	// if the pod is in the real node of kubernetes cluster, then its price is computed from the instance backed the node by cost breakdown.
	// if the pod is in virtual node of kubernetes cluster, then its price came from the pod billing directly or the virtual machine instance price backed the the pod.
	// Note!!! In distributed cloud, the cluster master maybe in one cloud provider, but the nodes in the cluster maybe in multiple clouds from different cloud datasource-providers
	// so the node and pod pricing is crossing clouds, currently do not support it.
	// GetPodsCost, key is namespace/name
	GetPodsCost() (map[string]*cloud.Pod, error)

	// UpdateConfigFromConfigMap update CustomPricing from configmap
	UpdateConfigFromConfigMap(map[string]string) (*cloud.CustomPricing, error)
	// GetConfig return CustomPricing
	GetConfig() (*cloud.CustomPricing, error)

	// ContainerAllocation return the container resource allocation. resource allocation is max(request, usage)
	ContainerAllocation() (map[string]*ContainerAllocation, error)

	GetNodesPricing() (map[string]*cloud.Price, error)
}

CostModel define a model

func NewCloudCost

func NewCloudCost(cache cache.Cache, provider cloud.CloudPrice) CostModel

Jump to

Keyboard shortcuts

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