cost_comparator

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: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Float642Str

func Float642Str(a float64) string

func Int642Str

func Int642Str(a int64) string

func MergeTimeSeriesList

func MergeTimeSeriesList(tsList []*common.TimeSeries) *common.TimeSeries

func PathExists

func PathExists(path string) (bool, error)

func ServerlessWorkloadsResourceTotal

func ServerlessWorkloadsResourceTotal(workloadsRecs map[string]map[types.NamespacedName]*spec.WorkloadRecommendedData) v1.ResourceList

Types

type Comparator

type Comparator struct {
	// contains filtered or unexported fields
}

Now do once task analysis, mapped Data in, then reduced Data out

func NewComparator

func NewComparator(config config.Config,
	kubeDynamicClient dynamic.Interface,
	kubeDiscoveryClient discovery.DiscoveryInterface,
	restMapper meta.RESTMapper,
	fetcher targetutil.TargetInfoFetcher,
	clusterCache cache.Cache,
	baselineCloud cloud.Cloud,
	dataSource datasource.Interface) *Comparator

func (*Comparator) ContainerDataCheckpoint

func (c *Comparator) ContainerDataCheckpoint() error

func (*Comparator) ContainerTsDataInit

func (c *Comparator) ContainerTsDataInit() error

func (*Comparator) DoAnalysis

func (c *Comparator) DoAnalysis()

Now it will fetch full data to do once analysis, so it is a time consuming offline computing task, also it will consuming memory because it will do time series analysis. todo: refactor to online service model when used for online deploy, split the services to online service & offline computing job. ??? offline computing jobs like spark by operator way VS. online service by deployment way

func (*Comparator) GetAllNodesSpec

func (c *Comparator) GetAllNodesSpec() map[string]spec.CloudNodeSpec

func (*Comparator) GetAllPodsSpec

func (c *Comparator) GetAllPodsSpec() map[string]spec.CloudPodSpec

func (*Comparator) GetAllWorkloadRecommendedData

func (c *Comparator) GetAllWorkloadRecommendedData() map[string]map[types.NamespacedName]*spec.WorkloadRecommendedData

NOTE: memory & time consuming, now it is a tool for offline analytics todo: For online predicting service, we should use a model updating way not the offline once task way

func (*Comparator) GetAllWorkloads

func (c *Comparator) GetAllWorkloads() []*unstructured.Unstructured

func (*Comparator) GetWorkloadContainerData

func (c *Comparator) GetWorkloadContainerData() map[string]map[types.NamespacedName]map[string]*RawContainerTimeSeriesData

func (*Comparator) Init

func (c *Comparator) Init()

Init initialize some cached data and time series data, Must call before DoAnalysis

func (*Comparator) LoadContainerTimeSeriesDataFromCheckpoint

func (c *Comparator) LoadContainerTimeSeriesDataFromCheckpoint() (map[string]map[types.NamespacedName]map[string]*RawContainerTimeSeriesData, error)

func (*Comparator) LoadWorkloadTimeSeriesDataFromCheckpoint

func (c *Comparator) LoadWorkloadTimeSeriesDataFromCheckpoint() (map[string]map[types.NamespacedName]*RawWorkloadTimeSeriesData, error)

func (*Comparator) ReportOriginalCostSummary

func (c *Comparator) ReportOriginalCostSummary(costerCtx *coster.CosterContext)

func (*Comparator) ReportOriginalResourceSummary

func (c *Comparator) ReportOriginalResourceSummary()

func (*Comparator) ReportOriginalWorkloadsResourceDistribution

func (c *Comparator) ReportOriginalWorkloadsResourceDistribution(costerCtx *coster.CosterContext)

func (*Comparator) ReportRawServerlessCostSummary

func (c *Comparator) ReportRawServerlessCostSummary(costerCtx *coster.CosterContext)

func (*Comparator) ReportRecommendedCostSummary

func (c *Comparator) ReportRecommendedCostSummary(costerCtx *coster.CosterContext)

func (*Comparator) ReportRecommendedResourceSummary

func (c *Comparator) ReportRecommendedResourceSummary(costerCtx *coster.CosterContext)

func (*Comparator) ReportRecommendedWorkloadsResourceDistribution

func (c *Comparator) ReportRecommendedWorkloadsResourceDistribution(costerCtx *coster.CosterContext)

func (*Comparator) WorkloadTsDataInit

func (c *Comparator) WorkloadTsDataInit() error

type RawContainerTimeSeriesData

type RawContainerTimeSeriesData struct {
	Cpu         []*common.TimeSeries
	Mem         []*common.TimeSeries
	CpuRequests []*common.TimeSeries
	MemRequests []*common.TimeSeries
	CpuLimits   []*common.TimeSeries
	MemLimits   []*common.TimeSeries
}

type RawWorkloadTimeSeriesData

type RawWorkloadTimeSeriesData struct {
	Cpu         []*common.TimeSeries
	Mem         []*common.TimeSeries
	CpuRequests []*common.TimeSeries
	MemRequests []*common.TimeSeries
	CpuLimits   []*common.TimeSeries
	MemLimits   []*common.TimeSeries
	Replicas    []*common.TimeSeries
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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