Documentation
¶
Index ¶
- Variables
- func HugePageResourceName(pageSize resource.Quantity) v1.ResourceName
- func HugePageSizeFromResourceName(name v1.ResourceName) (resource.Quantity, error)
- func IsAttachableVolumeResourceName(name v1.ResourceName) bool
- func IsExtendedResourceName(name v1.ResourceName) bool
- func IsHugePageResourceName(name v1.ResourceName) bool
- func IsNativeResource(name v1.ResourceName) bool
- func IsPrefixedNativeResource(name v1.ResourceName) bool
- func IsScalarResourceName(name v1.ResourceName) bool
- type FilterPredicate
- type Option
- type PodSetHandle
- type Predicate
- type PredicateFactory
- type PredicateHandle
- type PredicateHandler
- func (p *PredicateHandler) FindNodesThatPassFilters(parentCtx context.Context, podsetHandle PodSetHandle, pod *v1.Pod, ...) []*v1.Node
- func (p *PredicateHandler) RunFilterPredicates(ctx context.Context, handle PodSetHandle, pod *v1.Pod, node *v1.Node) *framework.Status
- func (p *PredicateHandler) RunScorePredicates(ctx context.Context, handle PodSetHandle, pod *v1.Pod, nodes []*v1.Node) framework.NodeScoreList
- type Registry
- type Resource
- func (r *Resource) Add(rl v1.ResourceList)
- func (r *Resource) AddScalar(name v1.ResourceName, quantity int64)
- func (r *Resource) Clone() *Resource
- func (r *Resource) ResourceList() v1.ResourceList
- func (r *Resource) SetMaxResource(rl v1.ResourceList)
- func (r *Resource) SetScalar(name v1.ResourceName, quantity int64)
- type ScorePredicate
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoPredicate is returned when a predicate is not implemented. ErrNoPredicate = errors.New("no predicate found") // ErrAlreadyExists is returned when an entry already exists in registry. ErrAlreadyExists = errors.New("already exists") )
var ErrInvalidResource = errors.New("invalid resource")
ErrInvalidResource error is used when an input resource is invalid.
Functions ¶
func HugePageResourceName ¶
func HugePageResourceName(pageSize resource.Quantity) v1.ResourceName
HugePageResourceName returns a ResourceName with the canonical hugepage prefix prepended for the specified page size. The page size is converted to its canonical representation.
func HugePageSizeFromResourceName ¶
func HugePageSizeFromResourceName(name v1.ResourceName) (resource.Quantity, error)
HugePageSizeFromResourceName returns the page size for the specified huge page resource name. If the specified input is not a valid huge page resource name an error is returned.
func IsAttachableVolumeResourceName ¶
func IsAttachableVolumeResourceName(name v1.ResourceName) bool
IsAttachableVolumeResourceName checks if the resource is an attachable volume.
func IsExtendedResourceName ¶
func IsExtendedResourceName(name v1.ResourceName) bool
IsExtendedResourceName checks if the resource is an extended resource.
func IsHugePageResourceName ¶
func IsHugePageResourceName(name v1.ResourceName) bool
IsHugePageResourceName returns true if the resource name has the huge page resource prefix.
func IsNativeResource ¶
func IsNativeResource(name v1.ResourceName) bool
IsNativeResource returns true if the resource name is in the *kubernetes.io/ namespace. Partially-qualified (unprefixed) names are implicitly in the kubernetes.io/ namespace.
func IsPrefixedNativeResource ¶
func IsPrefixedNativeResource(name v1.ResourceName) bool
IsPrefixedNativeResource returns true if the resource name is in the *kubernetes.io/ namespace.
func IsScalarResourceName ¶
func IsScalarResourceName(name v1.ResourceName) bool
IsScalarResourceName checks if the resource is a scalar.
Types ¶
type FilterPredicate ¶
type FilterPredicate interface { Predicate Filter(ctx context.Context, hdl PodSetHandle, pod *v1.Pod, node *v1.Node) *framework.Status }
FilterPredicate defines an interface to implement filter predicate handlers.
type Option ¶
type Option func(o *predicateOption)
Option is the option used while creating the predicate handler.
func WithCallTimeout ¶
WithCallTimeout is the grpc timeout to be used while accessing remotes with predicates.
func WithLogger ¶
WithLogger defines the logger to be used with predicate handler.
func WithOutOfTreeRegistry ¶
WithOutOfTreeRegistry is used to extend the built-in registry with a custom set.
func WithParallelism ¶
WithParallelism defines the parallelism factor used while running the filter predicates.
type PodSetHandle ¶
type PodSetHandle interface { // ClientSet returns a k8s clientset ClientSet() clientset.Interface // List returns a list of pods for the podset on the node List(context.Context, *v1.Node) ([]*v1.Pod, error) }
PodSetHandle defines the interface for a podset used with predicate handler.
type Predicate ¶
type Predicate interface {
Name() string
}
Predicate defines an interface to implement predicate handlers.
type PredicateFactory ¶
type PredicateFactory func(handle PredicateHandle) (Predicate, error)
PredicateFactory is the initialization routine used to create a new predicate instance.
type PredicateHandle ¶
PredicateHandle defines a handle used while initializing the predicate.
type PredicateHandler ¶
type PredicateHandler struct {
// contains filtered or unexported fields
}
PredicateHandler is a framework used to run through all the predicates.
func New ¶
func New(opts ...Option) (*PredicateHandler, error)
New is used to create a predicateHandler instance.
func (*PredicateHandler) FindNodesThatPassFilters ¶
func (p *PredicateHandler) FindNodesThatPassFilters(parentCtx context.Context, podsetHandle PodSetHandle, pod *v1.Pod, eligibleNodes []*v1.Node, ) []*v1.Node
FindNodesThatPassFilters is used to find eligible nodes for a pod that pass all filters.
func (*PredicateHandler) RunFilterPredicates ¶
func (p *PredicateHandler) RunFilterPredicates(ctx context.Context, handle PodSetHandle, pod *v1.Pod, node *v1.Node, ) *framework.Status
RunFilterPredicates is used to run all filter predicates to determine if the pod can be scheduled on the given node.
func (*PredicateHandler) RunScorePredicates ¶
func (p *PredicateHandler) RunScorePredicates(ctx context.Context, handle PodSetHandle, pod *v1.Pod, nodes []*v1.Node, ) framework.NodeScoreList
RunScorePredicates is used to run all score predicates to determine the best node for the pod.
type Registry ¶
type Registry map[string]PredicateFactory
Registry contains a map of predicates to their initialization function.
func NewInTreeRegistry ¶
func NewInTreeRegistry() Registry
NewInTreeRegistry is used to instantiate a built-in registry.
type Resource ¶
type Resource struct { MilliCPU int64 Memory int64 EphemeralStorage int64 // We store allowedPodNumber (which is Node.Status.Allocatable.Pods().Value()) // explicitly as int, to avoid conversions and improve performance. AllowedPodNumber int // ScalarResources ScalarResources map[v1.ResourceName]int64 }
Resource is a collection of compute resource.
func NewResource ¶
func NewResource(rl v1.ResourceList) *Resource
NewResource creates a Resource from ResourceList.
func (*Resource) Add ¶
func (r *Resource) Add(rl v1.ResourceList)
Add adds ResourceList into Resource.
func (*Resource) AddScalar ¶
func (r *Resource) AddScalar(name v1.ResourceName, quantity int64)
AddScalar adds a resource by a scalar value of this resource.
func (*Resource) ResourceList ¶
func (r *Resource) ResourceList() v1.ResourceList
ResourceList returns a resource list of this resource.
func (*Resource) SetMaxResource ¶
func (r *Resource) SetMaxResource(rl v1.ResourceList)
SetMaxResource compares with ResourceList and takes max value for each Resource.