scheduling

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TaintToToleration

func TaintToToleration(taint v1.Taint) v1.Toleration

TaintToToleration converts a taint to a toleration that tolerates the specified taint.

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

func (u *HostPortUsage) Copy() *HostPortUsage

Copy creates a copy of the HostPortUsage. It's not a deep copy as some of the internal state is reused, but that state is read-only so changes made to the copy or the original don't affect each other.

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 Requirements

type Requirements map[string]sets.Set

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 ...Requirements) Requirements

func (Requirements) Add

func (r Requirements) Add(requirements Requirements)

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) sets.Set

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() stringsets.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

type Taints

type Taints []v1.Taint

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

func (Taints) Has

func (ts Taints) Has(taint v1.Taint) bool

Has returns true if taints has a taint for the given key and effect

func (Taints) HasKey

func (ts Taints) HasKey(taintKey string) bool

HasKey returns true if taints has a taint for the given key

func (Taints) Tolerates

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

Tolerates returns true if the pod tolerates all taints. 'additional' are extra tolerations for things like startup taints or the standard not-ready taint applied to nodes we have launched.

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

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