package v1alpha1
import "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
Index ¶
- Constants
- type Code
- type ContextData
- type ContextKey
- type Framework
- type FrameworkHandle
- type Plugin
- type PluginContext
- func NewPluginContext() *PluginContext
- func (c *PluginContext) Delete(key ContextKey)
- func (c *PluginContext) Lock()
- func (c *PluginContext) RLock()
- func (c *PluginContext) RUnlock()
- func (c *PluginContext) Read(key ContextKey) (ContextData, error)
- func (c *PluginContext) Unlock()
- func (c *PluginContext) Write(key ContextKey, val ContextData)
- type PluginFactory
- type PrebindPlugin
- type Registry
- func NewRegistry() Registry
- func (r Registry) Register(name string, factory PluginFactory) error
- func (r Registry) Unregister(name string) error
- type ReservePlugin
- type Status
Constants ¶
const ( // NotFound is the not found error message. NotFound = "not found" )
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 pod schedulable. // NOTE: A nil status is also considered as "Success". Success Code = 0 // Error is used for internal plugin errors, unexpected input, etc. Error Code = 1 // Unschedulable is used when a plugin finds a pod unschedulable. // The accompanying status message should explain why the pod is unschedulable. Unschedulable Code = 2 )
These are predefined codes used in a Status.
type ContextData ¶
type ContextData interface{}
ContextData is a generic type for arbitrary data stored in PluginContext.
type ContextKey ¶
type ContextKey string
ContextKey is the type of keys stored in PluginContext.
type Framework ¶
type Framework interface { FrameworkHandle // RunPrebindPlugins runs the set of configured prebind plugins. It returns // *Status and its code is set to non-success if any of the plugins returns // anything but Success. If the Status code is "Unschedulable", it is // considered as a scheduling check failure, otherwise, it is considered as an // internal error. In either case the pod is not going to be bound. RunPrebindPlugins(pc *PluginContext, pod *v1.Pod, nodeName string) *Status // RunReservePlugins runs the set of configured reserve plugins. If any of these // plugins returns an error, it does not continue running the remaining ones and // returns the error. In such case, pod will not be scheduled. RunReservePlugins(pc *PluginContext, pod *v1.Pod, nodeName string) *Status }
Framework manages the set of plugins in use by the scheduling framework. Configured plugins are called at specified points in a scheduling context.
func NewFramework ¶
NewFramework initializes plugins given the configuration and the registry.
type FrameworkHandle ¶
type FrameworkHandle interface { // NodeInfoSnapshot return the latest NodeInfo snapshot. The snapshot // is taken at the beginning of a scheduling cycle and remains unchanged until // a pod finishes "Reserve" point. There is no guarantee that the information // remains unchanged in the binding phase of scheduling. NodeInfoSnapshot() *internalcache.NodeInfoSnapshot }
FrameworkHandle 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.
type Plugin ¶
type Plugin interface { Name() string }
Plugin is the parent type for all the scheduling framework plugins.
type PluginContext ¶
type PluginContext struct {
// contains filtered or unexported fields
}
PluginContext provides a mechanism for plugins to store and retrieve arbitrary data. ContextData stored by one plugin can be read, altered, or deleted by another plugin. PluginContext does not provide any data protection, as all plugins are assumed to be trusted.
func NewPluginContext ¶
func NewPluginContext() *PluginContext
NewPluginContext initializes a new PluginContext and returns its pointer.
func (*PluginContext) Delete ¶
func (c *PluginContext) Delete(key ContextKey)
Delete deletes data with the given key from PluginContext. This function is not thread safe. In multi-threaded code, lock should be acquired first.
func (*PluginContext) Lock ¶
func (c *PluginContext) Lock()
Lock acquires PluginContext lock.
func (*PluginContext) RLock ¶
func (c *PluginContext) RLock()
RLock acquires PluginContext read lock.
func (*PluginContext) RUnlock ¶
func (c *PluginContext) RUnlock()
RUnlock releases PluginContext read lock.
func (*PluginContext) Read ¶
func (c *PluginContext) Read(key ContextKey) (ContextData, error)
Read retrieves data with the given "key" from PluginContext. If the key is not present an error is returned. This function is not thread safe. In multi-threaded code, lock should be acquired first.
func (*PluginContext) Unlock ¶
func (c *PluginContext) Unlock()
Unlock releases PluginContext lock.
func (*PluginContext) Write ¶
func (c *PluginContext) Write(key ContextKey, val ContextData)
Write stores the given "val" in PluginContext with the given "key". This function is not thread safe. In multi-threaded code, lock should be acquired first.
type PluginFactory ¶
type PluginFactory = func(configuration *runtime.Unknown, f FrameworkHandle) (Plugin, error)
PluginFactory is a function that builds a plugin.
type PrebindPlugin ¶
type PrebindPlugin interface { Plugin // Prebind is called before binding a pod. All prebind plugins must return // success or the pod will be rejected and won't be sent for binding. Prebind(pc *PluginContext, p *v1.Pod, nodeName string) *Status }
PrebindPlugin is an interface that must be implemented by "prebind" plugins. These plugins are called before a pod being scheduled
type Registry ¶
type Registry map[string]PluginFactory
Registry is a collection of all available plugins. The framework uses a registry to enable and initialize configured plugins. All plugins must be in the registry before initializing the framework.
func NewRegistry ¶
func NewRegistry() Registry
NewRegistry builds a default registry with all the default plugins. This is the registry that Kubernetes default scheduler uses. A scheduler that runs custom plugins, can pass a different Registry and when initializing the scheduler.
func (Registry) Register ¶
func (r Registry) Register(name string, factory PluginFactory) error
Register adds a new plugin to the registry. If a plugin with the same name exists, it returns an error.
func (Registry) Unregister ¶
Unregister removes an existing plugin from the registry. If no plugin with the provided name exists, it returns an error.
type ReservePlugin ¶
type ReservePlugin interface { Plugin // Reserve is called by the scheduling framework when the scheduler cache is // updated. Reserve(pc *PluginContext, p *v1.Pod, nodeName string) *Status }
ReservePlugin is an interface for Reserve plugins. These plugins are called at the reservation point. These are meant to update the state of the plugin. This concept used to be called 'assume' in the original scheduler. These plugins should return only Success or Error in Status.code. However, the scheduler accepts other valid codes as well. Anything other than Success will lead to rejection of the pod.
type Status ¶
type Status struct {
// contains filtered or unexported fields
}
Status indicates the result of running a plugin. It consists of a code and a message. When the status code is not `Success`, the status message should explain why. NOTE: A nil Status is also considered as Success.
func NewStatus ¶
NewStatus makes a Status out of the given arguments and returns its pointer.
func (*Status) AsError ¶
AsError returns an "error" object with the same message as that of the Status.
func (*Status) Code ¶
Code returns code of the Status.
func (*Status) IsSuccess ¶
IsSuccess returns true if and only if "Status" is nil or Code is "Success".
func (*Status) Message ¶
Message returns message of the Status.
Source Files ¶
context.go framework.go interface.go registry.go
- Version
- v1.15.0-alpha.3
- Published
- May 7, 2019
- Platform
- js/wasm
- Imports
- 7 packages
- Last checked
- 26 seconds ago –
Tools for package owners.