binpacking

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: Apache-2.0 Imports: 18 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 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, constraints *v1alpha5.Constraints, pods []*v1.Pod, daemons []*v1.Pod) []*Packable

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

func (*Packable) DeepCopy added in v0.5.3

func (p *Packable) DeepCopy() *Packable

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 {
	// contains filtered or unexported fields
}

Packer packs pods and calculates efficient placement on the instances.

func NewPacker added in v0.5.2

func NewPacker(kubeClient client.Client, cloudProvider cloudprovider.CloudProvider) *Packer

func (*Packer) Pack

func (p *Packer) Pack(ctx context.Context, constraints *v1alpha5.Constraints, pods []*v1.Pod, instanceTypes []cloudprovider.InstanceType) ([]*Packing, error)

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/First-fit-decreasing_bin_packing

type Packing

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

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
}

Jump to

Keyboard shortcuts

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