Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code int
Code is the Status code/type which is returned from plugins.
const ( // Success means that plugin ran correctly and found resource schedulable. // NOTE: A nil status is also considered as "Success". Success Code = iota // Unschedulable is used when a plugin finds the resource unschedulable. // The accompanying status message should explain why it is unschedulable. Unschedulable // Noopperation is used when a plugin is disabled or the plugin list is empty. Noopperation // Error is used for internal plugin errors, unexpected input, etc. Error )
These are predefined codes used in a Status.
type EstimateComponentsPlugin ¶ added in v1.16.0
type EstimateComponentsPlugin interface {
Plugin
// EstimateComponents is called for each MaxAvailableComponentSets request.
// It returns an integer and a Result.
// The integer represents the estimated number of complete component sets that can be scheduled.
// The Result contains code, reasons and error.
// It is merged from all plugins' returned result codes.
EstimateComponents(ctx context.Context, snapshot *schedcache.Snapshot, components []pb.Component, namespace string) (int32, *Result)
}
EstimateComponentsPlugin is an interface for component set estimation plugins. These estimators are used to estimate the maximum number of complete component sets for a given set of components with different replica requirements.
type EstimateReplicasPlugin ¶
type EstimateReplicasPlugin interface {
Plugin
// Estimate is called for each MaxAvailableReplicas request.
// It returns an integer and a Result.
// The integer represents the number of calculated replicas for the given replicaRequirements.
// The Result contains code, reasons and error.
// It is merged from all plugins' returned result codes.
Estimate(ctx context.Context, snapshot *schedcache.Snapshot, replicaRequirements *pb.ReplicaRequirements) (int32, *Result)
}
EstimateReplicasPlugin is an interface for replica estimation plugins. These estimators are used to estimate the replicas for a given pb.ReplicaRequirements.
type Framework ¶
type Framework interface {
Handle
// RunEstimateReplicasPlugins runs the set of configured EstimateReplicasPlugins
// for estimating replicas based on the given replicaRequirements.
// It returns an integer and a Result.
// The integer represents the minimum calculated value of estimated replicas from each EstimateReplicasPlugin.
// The Result contains code, reasons and error.
// It is merged from all plugins' returned result codes.
RunEstimateReplicasPlugins(ctx context.Context, snapshot *schedcache.Snapshot, replicaRequirements *pb.ReplicaRequirements) (int32, *Result)
// RunEstimateComponentsPlugins runs the set of configured EstimateComponentsPlugins
// for estimating the maximum number of complete component sets based on the given components.
// It returns an integer and a Result.
// The integer represents the minimum calculated value of estimated component sets from each EstimateComponentsPlugin.
// The Result contains code, reasons and error.
// It is merged from all plugins' returned result codes.
RunEstimateComponentsPlugins(ctx context.Context, snapshot *schedcache.Snapshot, components []pb.Component, namespace string) (int32, *Result)
}
Framework manages the set of plugins in use by the estimator.
type Handle ¶
Handle provides data and some tools that plugins can use. It is passed to the plugin factories at the time of plugin initialization. Plugins must store and use this handle to call framework functions. We follow the design pattern of the Kubernetes scheduler framework.
type Plugin ¶
type Plugin interface {
Name() string
}
Plugin is the parent type for all the scheduling framework plugins.
type PluginToResult ¶
PluginToResult maps plugin name to Result.
func (PluginToResult) Merge ¶
func (p PluginToResult) Merge() *Result
Merge merges the statuses in the map into one. The resulting status code has the following precedence: Error, Unschedulable, Nooperation.
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result indicates the result of running a plugin. It consists of a code, a message and (optionally) an error. When the status code is not `Success`, the reasons should explain why.
func (*Result) AsError ¶
AsError returns nil if the Result is a success; otherwise returns an "error" object with a concatenated message on reasons of the Result.
func (*Result) IsFailed ¶ added in v1.16.0
IsFailed returns true if "Result" is not nil and Code is "Error".
func (*Result) IsNoOperation ¶
IsNoOperation returns true if "Result" is not nil and Code is "Nooperation". TODO (wengyao04): we can remove it once we include node resource estimation as the default plugin in the future.
func (*Result) IsSuccess ¶
IsSuccess returns true if and only if "Result" is nil or Code is "Success".
func (*Result) IsUnschedulable ¶ added in v1.9.3
IsUnschedulable returns true if "Result" is not nil and Code is "Unschedulable".