calculator

package
v0.0.0-...-3c7030d Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const CLUSTER_FEE = 0.1

Variables

This section is empty.

Functions

func ValidateAndRoundResources

func ValidateAndRoundResources(mCPU int64, memory int64, storage int64) (int64, int64, int64)

TODO: implement ini file minimums

Types

type AutopilotPriceList

type AutopilotPriceList struct {
	// generic for all
	Region       string
	StoragePrice float64

	// Non-specific workloads
	CpuPrice        float64
	MemoryPrice     float64
	SpotCpuPrice    float64
	SpotMemoryPrice float64

	CpuBalancedPrice        float64
	MemoryBalancedPrice     float64
	SpotCpuBalancedPrice    float64
	SpotMemoryBalancedPrice float64

	CpuScaleoutPrice        float64
	MemoryScaleoutPrice     float64
	SpotCpuScaleoutPrice    float64
	SpotMemoryScaleoutPrice float64

	CpuArmScaleoutPrice        float64
	MemoryArmScaleoutPrice     float64
	SpotArmCpuScaleoutPrice    float64
	SpotArmMemoryScaleoutPrice float64

	// gpu pricing
	GPUPodvCPUPrice              float64
	GPUPodMemoryPrice            float64
	GPUPodLocalSSDPrice          float64
	NVIDIAL4PodGPUPrice          float64
	NVIDIAT4PodGPUPrice          float64
	NVIDIAA10040GPodGPUPrice     float64
	NVIDIAA10080GPodGPUPrice     float64
	SpotGPUPodvCPUPrice          float64
	SpotGPUPodMemoryPrice        float64
	SpotGPUPodLocalSSDPrice      float64
	SpotGPUPodPDPricePremium     float64
	SpotNVIDIAL4PodGPUPrice      float64
	SpotNVIDIAT4PodGPUPrice      float64
	SpotNVIDIAA10040GPodGPUPrice float64
	SpotNVIDIAA10080GPodGPUPrice float64

	// performance tier baseline pricing
	PerformanceCpuPricePremium          float64
	PerformanceMemoryPricePremium       float64
	PerformancePDPricePremium           float64
	PerformanceLocalSSDPricePremium     float64
	SpotPerformanceCpuPricePremium      float64
	SpotPerformanceMemoryPricePremium   float64
	SpotPerformancePDPricePremium       float64
	SpotPerformanceLocalSSDPricePremium float64

	// accelerator tier baseline pricing
	AcceleratorCpuPricePremium            float64
	AcceleratorMemoryGPUPricePremium      float64
	AcceleratorPDPricePremium             float64
	AcceleratorLocalSSDPricePremium       float64
	AcceleratorT4GPUPricePremium          float64
	AcceleratorL4GPUPricePremium          float64
	AcceleratorA10040GGPUPricePremium     float64
	AcceleratorA10080GGPUPricePremium     float64
	AcceleratorH100GPUPricePremium        float64
	SpotAcceleratorCpuPricePremium        float64
	SpotAcceleratorMemoryGPUPricePremium  float64
	SpotAcceleratorPDPricePremium         float64
	SpotAcceleratorLocalSSDPricePremium   float64
	SpotAcceleratorT4GPUPricePremium      float64
	SpotAcceleratorL4GPUPricePremium      float64
	SpotAcceleratorA10040GGPUPricePremium float64
	SpotAcceleratorA10080GGPUPricePremium float64
	SpotAcceleratorH100GPUPricePremium    float64
}

func GetAutopilotPricing

func GetAutopilotPricing(sku string, region string) (AutopilotPriceList, error)

type GCEPriceList

type GCEPriceList struct {
	// generic for all
	Region string

	H3CpuPrice    float64
	H3MemoryPrice float64

	C2CpuPrice     float64
	C2MemoryPrice  float64
	C2DCpuPrice    float64
	C2DMemoryPrice float64

	G2CpuPrice    float64
	G2MemoryPrice float64
	A2CpuPrice    float64
	A2MemoryPrice float64
	A3CpuPrice    float64
	A3MemoryPrice float64

	SpotC2CpuPrice     float64
	SpotC2MemoryPrice  float64
	SpotC2DCpuPrice    float64
	SpotC2DMemoryPrice float64

	SpotG2DCpuPrice    float64
	SpotG2DMemoryPrice float64
	SpotA2CpuPrice     float64
	SpotA2MemoryPrice  float64
	SpotA3CpuPrice     float64
	SpotA3MemoryPrice  float64
}

func GetGCEPricing

func GetGCEPricing(sku string, region string) (GCEPriceList, error)

type PricingService

type PricingService struct {
	AutopilotPricing AutopilotPriceList
	GCEPricing       GCEPriceList
	Config           *ini.File
	// contains filtered or unexported fields
}

func NewService

func NewService(sku map[string]string, region string, clientset *kubernetes.Clientset, metricsClientset *metricsv.Clientset, config *ini.File) (*PricingService, error)

func (*PricingService) CalculatePricing

func (service *PricingService) CalculatePricing(cpu int64, memory int64, storage int64, gpu int64, gpuModel string, class cluster.ComputeClass, instanceType string, spot bool) float64

func (*PricingService) DecideComputeClass

func (service *PricingService) DecideComputeClass(workloadName string, machineType string, mCPU int64, memory int64, gpu int64, gpuModel string, arm64 bool) cluster.ComputeClass

func (*PricingService) GetGCEMachinePrice

func (service *PricingService) GetGCEMachinePrice(instanceType string, spot bool) (float64, error)

func (*PricingService) PopulateWorkloads

func (service *PricingService) PopulateWorkloads(nodes map[string]cluster.Node) ([]cluster.Workload, error)

Jump to

Keyboard shortcuts

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