priority

package
v0.0.0-...-e6acfc1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UpdateConfig

type UpdateConfig struct {
	// Minimum change of resources recommended vs actual that will trigger update
	// TODO: should have separate for Mem and CPU?
	MinChange float64
}

UpdateConfig holds configuration for UpdatePriorityCalculator

type UpdatePriorityCalculator

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

UpdatePriorityCalculator is responsible for prioritizing updates on pods. Can return sorted list of pods in order of update priority. Update priority is proportional to fraction by which resources should be increased / decreased. i.e. pod with 10M current memory and recommendation 20M will have higher update priority than pod with pod with 100M current memory and and 150M recommendation (100% increase vs 50% increase)

func NewUpdatePriorityCalculator

func NewUpdatePriorityCalculator(policy *apimock.ResourcesPolicy, config *UpdateConfig) UpdatePriorityCalculator

NewUpdatePriorityCalculator creates new UpdatePriorityCalculator for given sesources policy and configuration. Policy nil means no policy restriction on update. If configuration is nil, default values are used.

func (*UpdatePriorityCalculator) AddPod

func (calc *UpdatePriorityCalculator) AddPod(pod *apiv1.Pod, recommendation *apimock.Recommendation)

AddPod adds pod to priority list

func (*UpdatePriorityCalculator) GetSortedPods

func (calc *UpdatePriorityCalculator) GetSortedPods() []*apiv1.Pod

GetSortedPods returns list of pods ordered by priority (highest update priority first)

Jump to

Keyboard shortcuts

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