logic

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 6 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterControlledResources

func FilterControlledResources(estimation model.Resources, controlledResources []model.ResourceName) model.Resources

FilterControlledResources returns estimations from 'estimation' only for resources present in 'controlledResources'.

func MapToListOfRecommendedContainerResources added in v0.13.0

func MapToListOfRecommendedContainerResources(resources RecommendedPodResources) *vpa_types.RecommendedPodResources

MapToListOfRecommendedContainerResources converts the map of RecommendedContainerResources into a stable sorted list This can be used to get a stable sequence while ranging on the data

Types

type CPUEstimator added in v1.3.0

type CPUEstimator interface {
	GetCPUEstimation(s *model.AggregateContainerState) model.ResourceAmount
}

CPUEstimator predicts CPU resources needed by a container

func NewConstCPUEstimator added in v1.3.0

func NewConstCPUEstimator(cpu model.ResourceAmount) CPUEstimator

NewConstCPUEstimator returns a CPU estimator that always returns the same value

func NewPercentileCPUEstimator added in v1.3.0

func NewPercentileCPUEstimator(percentile float64) CPUEstimator

NewPercentileCPUEstimator returns a new percentileCPUEstimator that uses provided percentile.

func WithCPUConfidenceMultiplier added in v1.3.0

func WithCPUConfidenceMultiplier(multiplier, exponent float64, baseEstimator CPUEstimator) CPUEstimator

WithCPUConfidenceMultiplier return a CPUEstimator estimator

func WithCPUMargin added in v1.3.0

func WithCPUMargin(marginFraction float64, baseEstimator CPUEstimator) CPUEstimator

WithCPUMargin returns a CPUEstimator that adds a margin to the base estimator.

func WithCPUMinResource added in v1.3.0

func WithCPUMinResource(minResource model.ResourceAmount, baseEstimator CPUEstimator) CPUEstimator

WithCPUMinResource returns a CPUEstimator that returns at least minResource

type MemoryEstimator added in v1.3.0

type MemoryEstimator interface {
	GetMemoryEstimation(s *model.AggregateContainerState) model.ResourceAmount
}

MemoryEstimator predicts memory resources needed by a container

func NewConstMemoryEstimator added in v1.3.0

func NewConstMemoryEstimator(memory model.ResourceAmount) MemoryEstimator

NewConstMemoryEstimator returns a Memory estimator that always returns the same value

func NewMemoryEstimator added in v1.3.0

func NewMemoryEstimator(percentile float64) MemoryEstimator

NewMemoryEstimator returns a new percentileMemoryEstimator that uses provided percentile.

func NewPercentileMemoryEstimator added in v1.3.0

func NewPercentileMemoryEstimator(percentile float64) MemoryEstimator

NewPercentileMemoryEstimator returns a new percentileMemoryEstimator that uses provided percentile.

func WithMemoryConfidenceMultiplier added in v1.3.0

func WithMemoryConfidenceMultiplier(multiplier, exponent float64, baseEstimator MemoryEstimator) MemoryEstimator

WithMemoryConfidenceMultiplier returns a MemoryEstimator that scales the

func WithMemoryMargin added in v1.3.0

func WithMemoryMargin(marginFraction float64, baseEstimator MemoryEstimator) MemoryEstimator

WithMemoryMargin returns a MemoryEstimator that adds a margin to the base estimator.

func WithMemoryMinResource added in v1.3.0

func WithMemoryMinResource(minResource model.ResourceAmount, baseEstimator MemoryEstimator) MemoryEstimator

WithMemoryMinResource returns a MemoryEstimator that returns at least minResource

type PodResourceRecommender

type PodResourceRecommender interface {
	GetRecommendedPodResources(containerNameToAggregateStateMap model.ContainerNameToAggregateStateMap) RecommendedPodResources
}

PodResourceRecommender computes resource recommendation for a Vpa object.

func CreatePodResourceRecommender

func CreatePodResourceRecommender() PodResourceRecommender

CreatePodResourceRecommender returns the primary recommender.

type RecommendedContainerResources

type RecommendedContainerResources struct {
	// Recommended optimal amount of resources.
	Target model.Resources
	// Recommended minimum amount of resources.
	LowerBound model.Resources
	// Recommended maximum amount of resources.
	UpperBound model.Resources
}

RecommendedContainerResources is the recommendation of resources for a container.

type RecommendedPodResources

type RecommendedPodResources map[string]RecommendedContainerResources

RecommendedPodResources is a Map from container name to recommended resources.

type ResourceEstimator

type ResourceEstimator interface {
	GetResourceEstimation(s *model.AggregateContainerState) model.Resources
}

ResourceEstimator is a function from AggregateContainerState to model.Resources, e.g. a prediction of resources needed by a group of containers.

func NewCombinedEstimator added in v1.3.0

func NewCombinedEstimator(cpuEstimator CPUEstimator, memoryEstimator MemoryEstimator) ResourceEstimator

NewCombinedEstimator returns a new combinedEstimator that uses provided estimators.

Jump to

Keyboard shortcuts

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