Documentation ¶
Index ¶
- Constants
- Variables
- func DiscoverDefaultStorageClassName(ctx context.Context, kubeClient client.Client) (string, error)
- func HasPreferredNodeAffinity(p *v1.Pod) bool
- func ResetDefaultStorageClass()
- type CompatibilityOptions
- type HostPort
- type HostPortUsage
- func (u *HostPortUsage) Add(usedBy *v1.Pod, ports []HostPort)
- func (u *HostPortUsage) Conflicts(usedBy *v1.Pod, ports []HostPort) error
- func (in *HostPortUsage) DeepCopy() *HostPortUsage
- func (in *HostPortUsage) DeepCopyInto(out *HostPortUsage)
- func (u *HostPortUsage) DeletePod(key types.NamespacedName)
- type Requirement
- func (r *Requirement) Any() string
- func (r *Requirement) Has(value string) bool
- func (r *Requirement) Insert(items ...string)
- func (r *Requirement) Intersection(requirement *Requirement) *Requirement
- func (r *Requirement) Len() int
- func (r *Requirement) NodeSelectorRequirement() v1beta1.NodeSelectorRequirementWithMinValues
- func (r *Requirement) Operator() v1.NodeSelectorOperator
- func (r *Requirement) String() string
- func (r *Requirement) Values() []string
- type Requirements
- func NewLabelRequirements(labels map[string]string) Requirements
- func NewNodeSelectorRequirements(requirements ...v1.NodeSelectorRequirement) Requirements
- func NewNodeSelectorRequirementsWithMinValues(requirements ...v1beta1.NodeSelectorRequirementWithMinValues) Requirements
- func NewPodRequirements(pod *v1.Pod) Requirements
- func NewRequirements(requirements ...*Requirement) Requirements
- func NewStrictPodRequirements(pod *v1.Pod) Requirements
- func (r Requirements) Add(requirements ...*Requirement)
- func (r Requirements) Compatible(requirements Requirements, options ...functional.Option[CompatibilityOptions]) (errs error)
- func (r Requirements) Get(key string) *Requirement
- func (r Requirements) Has(key string) bool
- func (r Requirements) HasMinValues() bool
- func (r Requirements) Intersects(requirements Requirements) (errs error)
- func (r Requirements) Keys() sets.Set[string]
- func (r Requirements) Labels() map[string]string
- func (r Requirements) NodeSelectorRequirements() []v1beta1.NodeSelectorRequirementWithMinValues
- func (r Requirements) String() string
- func (r Requirements) Values() []*Requirement
- type Taints
- type VolumeUsage
- func (v *VolumeUsage) Add(pod *v1.Pod, volumes Volumes)
- func (v *VolumeUsage) AddLimit(storageDriver string, value int)
- func (in *VolumeUsage) DeepCopy() *VolumeUsage
- func (in *VolumeUsage) DeepCopyInto(out *VolumeUsage)
- func (v *VolumeUsage) DeletePod(key types.NamespacedName)
- func (v *VolumeUsage) ExceedsLimits(vols Volumes) error
- type Volumes
Constants ¶
const IsDefaultStorageClassAnnotation = "storageclass.kubernetes.io/is-default-class"
Variables ¶
var AllowUndefinedWellKnownLabels = func(options CompatibilityOptions) CompatibilityOptions { options.AllowUndefined = v1beta1.WellKnownLabels return options }
var KnownEphemeralTaints = []v1.Taint{ {Key: v1.TaintNodeNotReady, Effect: v1.TaintEffectNoSchedule}, {Key: v1.TaintNodeUnreachable, Effect: v1.TaintEffectNoSchedule}, {Key: cloudproviderapi.TaintExternalCloudProvider, Effect: v1.TaintEffectNoSchedule, Value: "true"}, }
KnownEphemeralTaints are taints that are expected to be added to a node while it's initializing If the node is a Karpenter-managed node, we don't consider these taints while the node is uninitialized since we expect these taints to eventually be removed
Functions ¶
func HasPreferredNodeAffinity ¶
HasPreferredNodeAffinity returns true if the pod has a preferred node affinity term
func ResetDefaultStorageClass ¶
func ResetDefaultStorageClass()
ResetDefaultStorageClass is intended to be called from unit tests to reset the default storage class
Types ¶
type CompatibilityOptions ¶ added in v0.34.0
type HostPort ¶
+k8s:deepcopy-gen=true
func GetHostPorts ¶
func (*HostPort) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostPort.
func (*HostPort) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
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 ¶
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 ¶
Requirement is an efficient represenatation of v1.NodeSelectorRequirement
func NewRequirement ¶
func NewRequirement(key string, operator v1.NodeSelectorOperator, values ...string) *Requirement
func NewRequirementWithFlexibility ¶ added in v0.35.0
func NewRequirementWithFlexibility(key string, operator v1.NodeSelectorOperator, minValues *int, values ...string) *Requirement
NewRequirementWithFlexibility constructs new requirement from the combination of key, values, minValues and the operator that connects the keys and values.
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() v1beta1.NodeSelectorRequirementWithMinValues
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 NewNodeSelectorRequirementsWithMinValues ¶ added in v0.35.0
func NewNodeSelectorRequirementsWithMinValues(requirements ...v1beta1.NodeSelectorRequirementWithMinValues) Requirements
NewRequirements constructs requirements from NodeSelectorRequirementWithMinValues
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 ¶
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[CompatibilityOptions]) (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) HasMinValues ¶ added in v0.35.0
func (r Requirements) HasMinValues() 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() []v1beta1.NodeSelectorRequirementWithMinValues
func (Requirements) String ¶
func (r Requirements) String() string
func (Requirements) Values ¶
func (r Requirements) Values() []*Requirement
type Taints ¶
Taints is a decorated alias type for []v1.Taint
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. +k8s:deepcopy-gen=true
func NewVolumeUsage ¶
func NewVolumeUsage() *VolumeUsage
func (*VolumeUsage) AddLimit ¶
func (v *VolumeUsage) AddLimit(storageDriver string, value int)
func (*VolumeUsage) DeepCopy ¶
func (in *VolumeUsage) DeepCopy() *VolumeUsage
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeUsage.
func (*VolumeUsage) DeepCopyInto ¶
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 ¶
func (v *VolumeUsage) DeletePod(key types.NamespacedName)
func (*VolumeUsage) ExceedsLimits ¶
func (v *VolumeUsage) ExceedsLimits(vols Volumes) error
type Volumes ¶
+k8s:deepcopy-gen=true
func GetVolumes ¶
func (Volumes) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Volumes.
func (Volumes) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.