Documentation
¶
Index ¶
- type OTC
- func (otc *OTC) AllNodePricing() (interface{}, error)
- func (otc *OTC) ApplyReservedInstancePricing(nodes map[string]*models.Node)
- func (otc *OTC) ClusterInfo() (map[string]string, error)
- func (otc *OTC) ClusterManagementPricing() (string, float64, error)
- func (otc *OTC) CombinedDiscountForNode(nodeType string, reservedInstance bool, ...) float64
- func (otc *OTC) DownloadPricingData() error
- func (otc *OTC) GetAddresses() ([]byte, error)
- func (otc *OTC) GetConfig() (*models.CustomPricing, error)
- func (otc *OTC) GetDisks() ([]byte, error)
- func (otc *OTC) GetKey(labels map[string]string, n *clustercache.Node) models.Key
- func (otc *OTC) GetLocalStorageQuery(start, end time.Duration, isPVC, isDeleted bool) string
- func (otc *OTC) GetManagementPlatform() (string, error)
- func (otc *OTC) GetOrphanedResources() ([]models.OrphanedResource, error)
- func (otc *OTC) GetPVKey(pv *clustercache.PersistentVolume, parameters map[string]string, ...) models.PVKey
- func (otc *OTC) GpuPricing(nodeLabels map[string]string) (string, error)
- func (otc *OTC) LoadBalancerPricing() (*models.LoadBalancer, error)
- func (otc *OTC) NetworkPricing() (*models.Network, error)
- func (otc *OTC) NodePricing(k models.Key) (*models.Node, models.PricingMetadata, error)
- func (otc *OTC) PVPricing(pvk models.PVKey) (*models.PV, error)
- func (otc *OTC) PricingSourceStatus() map[string]*models.PricingSource
- func (otc *OTC) PricingSourceSummary() interface{}
- func (otc *OTC) Regions() []string
- func (otc *OTC) ServiceAccountStatus() *models.ServiceAccountStatus
- func (otc *OTC) UpdateConfig(r io.Reader, updateType string) (*models.CustomPricing, error)
- func (otc *OTC) UpdateConfigFromConfigMap(configMap map[string]string) (*models.CustomPricing, error)
- type OTCNodeAttributes
- type OTCPVAttributes
- type OTCPricing
- type Product
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OTC ¶
type OTC struct { Clientset clustercache.ClusterCache Pricing map[string]*OTCPricing Config models.ProviderConfig ClusterRegion string BaseCPUPrice string BaseRAMPrice string BaseGPUPrice string ValidPricingKeys map[string]bool DownloadPricingDataLock sync.RWMutex // contains filtered or unexported fields }
the main provider struct
func (*OTC) AllNodePricing ¶
TODO: Implement method
func (*OTC) ApplyReservedInstancePricing ¶
TODO: Implement method
func (*OTC) ClusterInfo ¶
returns general info about the cluster This method HAS to be overwritten as long as the CustomProvider Field of the OTC struct is not set when initializing the provider in "provider.go" (see all the other providers).
func (*OTC) ClusterManagementPricing ¶
TODO: Implement method
func (*OTC) CombinedDiscountForNode ¶
func (*OTC) DownloadPricingData ¶
Download the pricing data from the OTC API
When a node has a specified price of e.g. 0.014 and the kubernetes node has a RAM attribute of 8232873984 Bytes.
The price in Prometheus will be composed of:
- the cpu/h price multiplied with the amount of VCPUs: 0.006904 * 1 => 0.006904
- the RAM/h price multiplied with the amount of ram in GiB: 0.000925 * (8232873984/1024/1024/1024) => 0.0070924
And the resulting node_total_hourly_price{} metric in Prometheus will approach the total node cost retrieved from OTC:
==> 0.006904 + 0.0070924 = 0.013996399999999999 ~ 0.014
func (*OTC) GetConfig ¶
func (otc *OTC) GetConfig() (*models.CustomPricing, error)
give the order to read the custom provider config file
func (*OTC) GetKey ¶
Extract/generate a key that holds the data required to calculate the cost of the given node (like s2.large.4).
func (*OTC) GetLocalStorageQuery ¶
TODO: Implement method
func (*OTC) GetManagementPlatform ¶
TODO: Implement method
func (*OTC) GetOrphanedResources ¶
func (otc *OTC) GetOrphanedResources() ([]models.OrphanedResource, error)
TODO: Implement method
func (*OTC) GetPVKey ¶
func (otc *OTC) GetPVKey(pv *clustercache.PersistentVolume, parameters map[string]string, defaultRegion string) models.PVKey
func (*OTC) GpuPricing ¶ added in v1.114.0
TODO: Implement method
func (*OTC) LoadBalancerPricing ¶
func (otc *OTC) LoadBalancerPricing() (*models.LoadBalancer, error)
load balancer cost taken straight up from aws
func (*OTC) NodePricing ¶
NodePricing(Key) (*Node, PricingMetadata, error) Read the keys features and determine the price of the Node described by the key to construct a Pricing Node object to return and work with.
func (*OTC) PVPricing ¶
search for pricing data matching the given persistent volume key in the provider's pricing list and return it
func (*OTC) PricingSourceStatus ¶
func (otc *OTC) PricingSourceStatus() map[string]*models.PricingSource
TODO: Implement method
func (*OTC) PricingSourceSummary ¶
func (otc *OTC) PricingSourceSummary() interface{}
PricingSourceSummary returns the pricing source summary for the provider. The summary represents what was _parsed_ from the pricing source, not what was returned from the relevant API.
func (*OTC) ServiceAccountStatus ¶
func (otc *OTC) ServiceAccountStatus() *models.ServiceAccountStatus
func (*OTC) UpdateConfig ¶
TODO: Implement method
func (*OTC) UpdateConfigFromConfigMap ¶
func (otc *OTC) UpdateConfigFromConfigMap(configMap map[string]string) (*models.CustomPricing, error)
TODO: Implement method
type OTCNodeAttributes ¶
type OTCNodeAttributes struct { Type string // like s2.large.1 OS string // like windows Price string // (in EUR) like 0.023 RAM string // (in GB) like 2 VCPU string // like 8 }
OTC node pricing attributes
type OTCPVAttributes ¶
type OTCPricing ¶
type OTCPricing struct { NodeAttributes *OTCNodeAttributes PVAttributes *OTCPVAttributes }
OTC pricing is either for a node, a persistent volume (or a database, network, cluster, ...)
type Product ¶
type Product struct { OpiFlavour string `json:"opiFlavour"` OsUnit string `json:"osUnit,omitempty"` PriceAmount string `json:"priceAmount"` VCpu string `json:"vCpu,omitempty"` Ram string `json:"ram,omitempty"` }
The product (price) data that is fetched from OTC
If OsUnit, VCpu and Ram aren't given, the product is a persistent volume, else it's a node.