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 the it is unschedulable. Unschedulable // Nooperation is used when a plugin is disabled or the plugin list are empty Noopperation // Error is used for internal plugin errors, unexpected input, etc. Error )
These are predefined codes used in a Status.
type EstimateReplicasPlugin ¶
type EstimateReplicasPlugin interface { Plugin // Estimate is called for each MaxAvailableReplicas request. // It returns an integer and an error // The integer representing the number of calculated replica 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 an 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) }
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 as 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 have the following precedence: Error, Unschedulable, Disabled.
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) 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".