scheduling

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HostPortUsage added in v0.12.0

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 added in v0.12.0

func NewHostPortUsage() *HostPortUsage

func (*HostPortUsage) Add added in v0.12.0

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 added in v0.14.0

func (u *HostPortUsage) DeepCopy() *HostPortUsage

func (*HostPortUsage) DeepCopyInto added in v0.14.0

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

func (*HostPortUsage) DeletePod added in v0.12.0

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 added in v0.12.0

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 NodeTemplate

type NodeTemplate struct {
	ProvisionerName      string
	Provider             *v1alpha5.Provider
	ProviderRef          *v1alpha5.ProviderRef
	Labels               map[string]string
	Taints               Taints
	StartupTaints        Taints
	Requirements         Requirements
	KubeletConfiguration *v1alpha5.KubeletConfiguration
}

NodeTemplate encapsulates the fields required to create a node and mirrors the fields in Provisioner. These structs are maintained separately in order for fields like Requirements to be able to be stored more efficiently.

func NewNodeTemplate

func NewNodeTemplate(provisioner *v1alpha5.Provisioner) *NodeTemplate

func (*NodeTemplate) ToNode

func (n *NodeTemplate) ToNode() *v1.Node

type Requirement added in v0.14.0

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

Requirement is an efficient represenatation of v1.NodeSelectorRequirement

func NewRequirement added in v0.14.0

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

func (*Requirement) Any added in v0.14.0

func (r *Requirement) Any() string

func (*Requirement) Has added in v0.14.0

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

Has returns true if the requirement allows the value

func (*Requirement) Insert added in v0.14.0

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

func (*Requirement) Intersection added in v0.14.0

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

Intersection constraints the Requirement from the incoming requirements nolint:gocyclo

func (*Requirement) Len added in v0.14.0

func (r *Requirement) Len() int

func (*Requirement) Operator added in v0.14.0

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

func (*Requirement) String added in v0.14.0

func (r *Requirement) String() string

func (*Requirement) Values added in v0.14.0

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 added in v0.11.0

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 added in v0.11.0

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

func (Requirements) String

func (r Requirements) String() string

func (Requirements) Values added in v0.14.0

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

type Taints

type Taints []v1.Taint

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

func (Taints) Tolerates

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

Tolerates returns true if the pod tolerates all taints.

type VolumeCount added in v0.12.0

type VolumeCount map[string]int

func (VolumeCount) Exceeds added in v0.12.0

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 added in v0.12.0

func (c VolumeCount) Fits(rhs VolumeCount) bool

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

type VolumeLimits added in v0.12.0

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

VolumeLimits 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 added in v0.12.0

func NewVolumeLimits(kubeClient client.Client) *VolumeLimits

func (*VolumeLimits) Add added in v0.12.0

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

func (*VolumeLimits) DeepCopy added in v0.14.0

func (v *VolumeLimits) DeepCopy() *VolumeLimits

func (*VolumeLimits) DeepCopyInto added in v0.14.0

func (v *VolumeLimits) DeepCopyInto(out *VolumeLimits)

func (*VolumeLimits) DeletePod added in v0.12.0

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

func (*VolumeLimits) Validate added in v0.12.0

func (v *VolumeLimits) 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