routines

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AggregateContainerStateGCInterval defines how often expired AggregateContainerStates are garbage collected.
	AggregateContainerStateGCInterval = 1 * time.Hour
)

Variables

This section is empty.

Functions

func GetContainerNameToAggregateStateMap

func GetContainerNameToAggregateStateMap(mpa *model.Mpa) vpa_model.ContainerNameToAggregateStateMap

GetContainerNameToAggregateStateMap returns ContainerNameToAggregateStateMap for pods. Updated to integrate with the MPA API.

Types

type NormalizationArg added in v0.2.0

type NormalizationArg struct {
	Key               model.MpaID
	ScaleUpBehavior   *autoscalingv2.HPAScalingRules
	ScaleDownBehavior *autoscalingv2.HPAScalingRules
	MinReplicas       int32
	MaxReplicas       int32
	CurrentReplicas   int32
	DesiredReplicas   int32
}

NormalizationArg is used to pass all needed information between functions as one structure

type Recommender

type Recommender interface {
	// RunOnce performs one iteration of recommender duties followed by update of recommendations in MPA objects.
	RunOnce(workers int)
	// GetClusterState returns ClusterState used by Recommender
	GetClusterState() *model.ClusterState
	// GetClusterStateFeeder returns ClusterStateFeeder used by Recommender
	GetClusterStateFeeder() input.ClusterStateFeeder
	// UpdateMPAs computes recommendations and sends MPAs status updates to API Server
	UpdateMPAs(ctx context.Context)
	// MaintainCheckpoints stores current checkpoints in API Server and garbage collect old ones
	// MaintainCheckpoints writes at least minCheckpoints if there are more checkpoints to write.
	// Checkpoints are written until ctx permits or all checkpoints are written.
	MaintainCheckpoints(ctx context.Context, minCheckpoints int)
}

Recommender recommend resources for certain containers, based on utilization periodically got from metrics api.

func NewRecommender

func NewRecommender(config *rest.Config, checkpointsGCInterval time.Duration, useCheckpoints bool, namespace string, recommenderName string, evtNamespacer v1core.EventsGetter, metricsClient metricsclient.MetricsClient, resyncPeriod time.Duration, downscaleStabilisationWindow time.Duration, tolerance float64, cpuInitializationPeriod time.Duration, delayOfInitialReadinessStatus time.Duration,
) Recommender

NewRecommender creates a new recommender instance. Dependencies are created automatically. Deprecated; use RecommenderFactory instead.

type RecommenderFactory

type RecommenderFactory struct {
	ClusterState *model.ClusterState

	ClusterStateFeeder     input.ClusterStateFeeder
	ControllerFetcher      controllerfetcher.ControllerFetcher
	CheckpointWriter       checkpoint.CheckpointWriter
	PodResourceRecommender logic.PodResourceRecommender
	MpaClient              mpa_api.MultidimPodAutoscalersGetter

	CheckpointsGCInterval time.Duration
	UseCheckpoints        bool

	// For HPA.
	EvtNamespacer                 v1core.EventsGetter
	PodInformer                   coreinformers.PodInformer
	MetricsClient                 metricsclient.MetricsClient
	ResyncPeriod                  time.Duration
	DownscaleStabilisationWindow  time.Duration
	Tolerance                     float64
	CpuInitializationPeriod       time.Duration
	DelayOfInitialReadinessStatus time.Duration
}

RecommenderFactory makes instances of Recommender.

func (RecommenderFactory) Make

Make creates a new recommender instance, which can be run in order to provide continuous resource recommendations for containers.

Jump to

Keyboard shortcuts

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