binpacking

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MaxInstanceTypes defines the number of instance type options to return to the cloud provider
	MaxInstanceTypes = 20
)

Functions

This section is empty.

Types

type ByResourcesRequested

type ByResourcesRequested struct{ SortablePods }

func (ByResourcesRequested) Less

func (r ByResourcesRequested) Less(a, b int) bool

type Packable

type Packable struct {
	cloudprovider.InstanceType
	// contains filtered or unexported fields
}

func PackableFor

func PackableFor(i cloudprovider.InstanceType) *Packable

func PackablesFor

func PackablesFor(ctx context.Context, instanceTypes []cloudprovider.InstanceType, schedule *scheduling.Schedule) []*Packable

PackablesFor creates viable packables for the provided schedule, excluding those that can't fit resources or violate schedule.

func (*Packable) Pack

func (p *Packable) Pack(pods []*v1.Pod) *Result

Pack attempts to pack the pods, keeping track of previously packed ones. Any pods that cannot fit, including because of missing resources on the packable, will be left unpacked.

type Packer

type Packer struct {
}

Packer packs pods and calculates efficient placement on the instances.

func (*Packer) Pack

func (p *Packer) Pack(ctx context.Context, schedule *scheduling.Schedule, instances []cloudprovider.InstanceType) []*Packing

Pack returns the node packings for the provided pods. It computes a set of viable instance types for each packing of pods. InstanceType variety enables the cloud provider to make better cost and availability decisions. The instance types returned are sorted by resources. Pods provided are all schedulable in the same zone as tightly as possible. It follows the First Fit Decreasing bin packing technique, reference- https://en.wikipedia.org/wiki/Bin_packing_problem#First_Fit_Decreasing_(FFD)

type Packing

type Packing struct {
	Pods                [][]*v1.Pod `hash:"ignore"`
	NodeQuantity        int         `hash:"ignore"`
	InstanceTypeOptions []cloudprovider.InstanceType
	Constraints         *v1alpha5.Constraints
}

Packing is a binpacking solution of equivalently schedulable pods to a set of viable instance types upon which they fit. All pods in the packing are within the specified constraints (e.g., labels, taints).

type Result

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

type SortablePods

type SortablePods []*v1.Pod

func (SortablePods) Len

func (pods SortablePods) Len() int

func (SortablePods) Swap

func (pods SortablePods) Swap(i, j int)

Jump to

Keyboard shortcuts

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