scheduling

package
v0.32.10 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const IsDefaultStorageClassAnnotation = "storageclass.kubernetes.io/is-default-class"

Variables

View Source
var AllowUndefinedWellKnownLabelsV1Alpha5 = func(options CompatabilityOptions) CompatabilityOptions {
	options.AllowUndefined = v1alpha5.WellKnownLabels
	return options
}
View Source
var AllowUndefinedWellKnownLabelsV1Beta1 = func(options CompatabilityOptions) CompatabilityOptions {
	options.AllowUndefined = v1beta1.WellKnownLabels
	return options
}
View Source
var KnownEphemeralTaints = []v1.Taint{
	{Key: v1.TaintNodeNotReady, Effect: v1.TaintEffectNoSchedule},
	{Key: v1.TaintNodeUnreachable, Effect: v1.TaintEffectNoSchedule},
	{Key: cloudproviderapi.TaintExternalCloudProvider, Effect: v1.TaintEffectNoSchedule, Value: "true"},
}

Functions

func DiscoverDefaultStorageClassName added in v0.30.0

func DiscoverDefaultStorageClassName(ctx context.Context, kubeClient client.Client) (string, error)

func HasPreferredNodeAffinity added in v0.30.0

func HasPreferredNodeAffinity(p *v1.Pod) bool

HasPreferredNodeAffinity returns true if the pod has a preferred node affinity term

func ResetDefaultStorageClass added in v0.30.0

func ResetDefaultStorageClass()

ResetDefaultStorageClass is intended to be called from unit tests to reset the default storage class

Types

type CompatabilityOptions added in v0.31.0

type CompatabilityOptions struct {
	AllowUndefined sets.Set[string]
}

type HostPort added in v0.30.0

type HostPort struct {
	IP       net.IP
	Port     int32
	Protocol v1.Protocol
}

+k8s:deepcopy-gen=true

func GetHostPorts added in v0.30.0

func GetHostPorts(pod *v1.Pod) []HostPort

func (*HostPort) DeepCopy added in v0.30.0

func (in *HostPort) DeepCopy() *HostPort

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostPort.

func (*HostPort) DeepCopyInto added in v0.30.0

func (in *HostPort) DeepCopyInto(out *HostPort)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (HostPort) Matches added in v0.30.0

func (p HostPort) Matches(rhs HostPort) bool

func (HostPort) String added in v0.30.0

func (p HostPort) String() string

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. +k8s:deepcopy-gen=true

func NewHostPortUsage

func NewHostPortUsage() *HostPortUsage

func (*HostPortUsage) Add

func (u *HostPortUsage) Add(usedBy *v1.Pod, ports []HostPort)

Add adds a port to the HostPortUsage

func (*HostPortUsage) Conflicts added in v0.30.0

func (u *HostPortUsage) Conflicts(usedBy *v1.Pod, ports []HostPort) error

func (*HostPortUsage) DeepCopy

func (in *HostPortUsage) DeepCopy() *HostPortUsage

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostPortUsage.

func (*HostPortUsage) DeepCopyInto

func (in *HostPortUsage) DeepCopyInto(out *HostPortUsage)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

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.

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 and treats any preferred requirements as required.

func NewRequirements

func NewRequirements(requirements ...*Requirement) Requirements

func NewStrictPodRequirements added in v0.30.0

func NewStrictPodRequirements(pod *v1.Pod) Requirements

NewStrictPodRequirements constructs requirements from a pod and only includes true requirements (not preferences).

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, options ...functional.Option[CompatabilityOptions]) (errs error)

Compatible ensures the provided requirements can loosely 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.Set[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 added in v0.24.0

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

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. +k8s:deepcopy-gen=true

func NewVolumeUsage added in v0.27.1

func NewVolumeUsage() *VolumeUsage

func (*VolumeUsage) Add added in v0.22.0

func (v *VolumeUsage) Add(pod *v1.Pod, volumes Volumes)

func (*VolumeUsage) AddLimit added in v0.30.0

func (v *VolumeUsage) AddLimit(storageDriver string, value int)

func (*VolumeUsage) DeepCopy added in v0.22.0

func (in *VolumeUsage) DeepCopy() *VolumeUsage

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeUsage.

func (*VolumeUsage) DeepCopyInto added in v0.22.0

func (in *VolumeUsage) DeepCopyInto(out *VolumeUsage)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*VolumeUsage) DeletePod added in v0.22.0

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

func (*VolumeUsage) ExceedsLimits added in v0.30.0

func (v *VolumeUsage) ExceedsLimits(vols Volumes) error

type Volumes added in v0.30.0

type Volumes map[string]sets.Set[string]

+k8s:deepcopy-gen=true

func GetVolumes added in v0.30.0

func GetVolumes(ctx context.Context, kubeClient client.Client, pod *v1.Pod) (Volumes, error)

func (Volumes) Add added in v0.30.0

func (u Volumes) Add(provisioner string, pvcID string)

func (Volumes) DeepCopy added in v0.30.0

func (in Volumes) DeepCopy() Volumes

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Volumes.

func (Volumes) DeepCopyInto added in v0.30.0

func (in Volumes) DeepCopyInto(out *Volumes)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (Volumes) Insert added in v0.30.0

func (u Volumes) Insert(volumes Volumes)

func (Volumes) Union added in v0.30.0

func (u Volumes) Union(vol Volumes) Volumes

Jump to

Keyboard shortcuts

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