scheduling

package
v0.0.0-...-d7985ca Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: Apache-2.0 Imports: 17 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HostPortUsage

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

HostPortUsage tracks HostPort usage within a node. On a node, each <hostIP, hostPort, protocol> used by pods bound to the node must be unique. We need to track this to keep an accurate concept of what pods can potentially schedule together.

func NewHostPortUsage

func NewHostPortUsage() *HostPortUsage

func (*HostPortUsage) Add

func (u *HostPortUsage) Add(ctx context.Context, pod *v1.Pod)

Add adds a port to the HostPortUsage, returning an error in the case of a conflict

func (*HostPortUsage) DeepCopy

func (u *HostPortUsage) DeepCopy() *HostPortUsage

func (*HostPortUsage) DeepCopyInto

func (u *HostPortUsage) DeepCopyInto(out *HostPortUsage)

func (*HostPortUsage) DeletePod

func (u *HostPortUsage) DeletePod(key types.NamespacedName)

DeletePod deletes all host port usage from the HostPortUsage that were created by the pod with the given name.

func (*HostPortUsage) Validate

func (u *HostPortUsage) Validate(pod *v1.Pod) error

Validate performs host port conflict validation to allow for determining if we can schedule the pod to the node before doing so.

type Requirement

type Requirement struct {
	Key string
	// contains filtered or unexported fields
}

Requirement is an efficient represenatation of v1.NodeSelectorRequirement

func NewRequirement

func NewRequirement(key string, operator v1.NodeSelectorOperator, values ...string) *Requirement

func (*Requirement) Any

func (r *Requirement) Any() string

func (*Requirement) Has

func (r *Requirement) Has(value string) bool

Has returns true if the requirement allows the value

func (*Requirement) Insert

func (r *Requirement) Insert(items ...string)

func (*Requirement) Intersection

func (r *Requirement) Intersection(requirement *Requirement) *Requirement

Intersection constraints the Requirement from the incoming requirements nolint:gocyclo

func (*Requirement) Len

func (r *Requirement) Len() int

func (*Requirement) NodeSelectorRequirement

func (r *Requirement) NodeSelectorRequirement() v1.NodeSelectorRequirement

func (*Requirement) Operator

func (r *Requirement) Operator() v1.NodeSelectorOperator

func (*Requirement) String

func (r *Requirement) String() string

func (*Requirement) Values

func (r *Requirement) Values() []string

type Requirements

type Requirements map[string]*Requirement

Requirements are an efficient set representation under the hood. Since its underlying types are slices and maps, this type should not be used as a pointer.

func NewLabelRequirements

func NewLabelRequirements(labels map[string]string) Requirements

NewLabelRequirements constructs requirements from labels

func NewNodeSelectorRequirements

func NewNodeSelectorRequirements(requirements ...v1.NodeSelectorRequirement) Requirements

NewRequirements constructs requirements from NodeSelectorRequirements

func NewPodRequirements

func NewPodRequirements(pod *v1.Pod) Requirements

NewPodRequirements constructs requirements from a pod

func NewRequirements

func NewRequirements(requirements ...*Requirement) Requirements

func (Requirements) Add

func (r Requirements) Add(requirements ...*Requirement)

Add requirements to provided requirements. Mutates existing requirements

func (Requirements) Compatible

func (r Requirements) Compatible(requirements Requirements) (errs error)

Compatible ensures the provided requirements can be met.

func (Requirements) Get

func (r Requirements) Get(key string) *Requirement

func (Requirements) Has

func (r Requirements) Has(key string) bool

func (Requirements) Intersects

func (r Requirements) Intersects(requirements Requirements) (errs error)

Intersects returns errors if the requirements don't have overlapping values, undefined keys are allowed

func (Requirements) Keys

func (r Requirements) Keys() sets.String

Keys returns unique set of the label keys from the requirements

func (Requirements) Labels

func (r Requirements) Labels() map[string]string

func (Requirements) NodeSelectorRequirements

func (r Requirements) NodeSelectorRequirements() []v1.NodeSelectorRequirement

func (Requirements) String

func (r Requirements) String() string

func (Requirements) Values

func (r Requirements) Values() []*Requirement

type Taints

type Taints []v1.Taint

Taints is a decorated alias type for []v1.Taint

func (Taints) Merge

func (ts Taints) Merge(with Taints) Taints

Merge merges in taints with the passed in taints.

func (Taints) Tolerates

func (ts Taints) Tolerates(pod *v1.Pod) (errs error)

Tolerates returns true if the pod tolerates all taints.

type VolumeCount

type VolumeCount map[string]int

func (VolumeCount) Exceeds

func (c VolumeCount) Exceeds(limits VolumeCount) bool

Exceeds returns true if the volume count exceeds the limits provided. If there is no value for a storage provider, it is treated as unlimited.

func (VolumeCount) Fits

func (c VolumeCount) Fits(rhs VolumeCount) bool

Fits returns true if the rhs 'fits' within the volume count.

type VolumeUsage

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

VolumeUsage tracks volume limits on a per node basis. The number of volumes that can be mounted varies by instance type. We need to be aware and track the mounted volume usage to inform our awareness of which pods can schedule to which nodes.

func NewVolumeLimits

func NewVolumeLimits(kubeClient client.Client) *VolumeUsage

func (*VolumeUsage) Add

func (v *VolumeUsage) Add(ctx context.Context, pod *v1.Pod)

func (*VolumeUsage) DeepCopy

func (v *VolumeUsage) DeepCopy() *VolumeUsage

func (*VolumeUsage) DeepCopyInto

func (v *VolumeUsage) DeepCopyInto(out *VolumeUsage)

func (*VolumeUsage) DeletePod

func (v *VolumeUsage) DeletePod(key types.NamespacedName)

func (*VolumeUsage) Validate

func (v *VolumeUsage) Validate(ctx context.Context, pod *v1.Pod) (VolumeCount, error)

Jump to

Keyboard shortcuts

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