Documentation
¶
Index ¶
- Variables
- func RegisterNodeMetaSyncExtender(filter FilterFn, plugins ...NodeMetaSyncPlugin)
- func RegisterNodePrepareExtender(filter FilterFn, plugins ...NodePreparePlugin)
- func RegisterNodeSyncExtender(filter FilterFn, plugins ...NodeSyncPlugin)
- func RegisterResourceCalculateExtender(filter FilterFn, plugins ...ResourceCalculatePlugin)
- func RegisterSetupExtender(filter FilterFn, plugins ...SetupPlugin)
- func RunNodeMetaSyncExtenders(strategy *configuration.ColocationStrategy, oldNode, newNode *corev1.Node) bool
- func RunNodePrepareExtenders(strategy *configuration.ColocationStrategy, node *corev1.Node, ...)
- func RunNodeSyncExtenders(strategy *configuration.ColocationStrategy, oldNode, newNode *corev1.Node) bool
- func RunResourceCalculateExtenders(nr *NodeResource, strategy *configuration.ColocationStrategy, ...)
- func RunResourceResetExtenders(nr *NodeResource, node *corev1.Node, message string)
- func RunSetupExtenders(opt *Option)
- func UnregisterNodeMetaSyncExtender(name string)
- func UnregisterNodePrepareExtender(name string)
- func UnregisterNodeSyncExtender(name string)
- func UnregisterResourceCalculateExtender(name string)
- func UnregisterSetupExtender(name string)
- type FilterFn
- type NodeMetaSyncPlugin
- type NodePreparePlugin
- type NodeResource
- type NodeSyncPlugin
- type Option
- type Plugin
- type PluginConfig
- type PluginRegistry
- type ResourceCalculatePlugin
- type ResourceItem
- type ResourceMetrics
- type ResourceResetPlugin
- type SetupPlugin
- type SyncContext
Constants ¶
This section is empty.
Variables ¶
var AllPass = func(string) bool { return true }
Functions ¶
func RegisterNodeMetaSyncExtender ¶ added in v1.3.0
func RegisterNodeMetaSyncExtender(filter FilterFn, plugins ...NodeMetaSyncPlugin)
func RegisterNodePrepareExtender ¶
func RegisterNodePrepareExtender(filter FilterFn, plugins ...NodePreparePlugin)
func RegisterNodeSyncExtender ¶
func RegisterNodeSyncExtender(filter FilterFn, plugins ...NodeSyncPlugin)
func RegisterResourceCalculateExtender ¶
func RegisterResourceCalculateExtender(filter FilterFn, plugins ...ResourceCalculatePlugin)
func RegisterSetupExtender ¶ added in v1.3.0
func RegisterSetupExtender(filter FilterFn, plugins ...SetupPlugin)
func RunNodeMetaSyncExtenders ¶ added in v1.3.0
func RunNodeMetaSyncExtenders(strategy *configuration.ColocationStrategy, oldNode, newNode *corev1.Node) bool
func RunNodePrepareExtenders ¶
func RunNodePrepareExtenders(strategy *configuration.ColocationStrategy, node *corev1.Node, nr *NodeResource)
func RunNodeSyncExtenders ¶
func RunNodeSyncExtenders(strategy *configuration.ColocationStrategy, oldNode, newNode *corev1.Node) bool
func RunResourceCalculateExtenders ¶
func RunResourceCalculateExtenders(nr *NodeResource, strategy *configuration.ColocationStrategy, node *corev1.Node, podList *corev1.PodList, resourceMetrics *ResourceMetrics)
func RunResourceResetExtenders ¶
func RunResourceResetExtenders(nr *NodeResource, node *corev1.Node, message string)
func RunSetupExtenders ¶ added in v1.3.0
func RunSetupExtenders(opt *Option)
func UnregisterNodeMetaSyncExtender ¶ added in v1.3.0
func UnregisterNodeMetaSyncExtender(name string)
func UnregisterNodePrepareExtender ¶
func UnregisterNodePrepareExtender(name string)
func UnregisterNodeSyncExtender ¶
func UnregisterNodeSyncExtender(name string)
func UnregisterResourceCalculateExtender ¶
func UnregisterResourceCalculateExtender(name string)
func UnregisterSetupExtender ¶ added in v1.3.0
func UnregisterSetupExtender(name string)
Types ¶
type NodeMetaSyncPlugin ¶ added in v1.3.0
type NodeMetaSyncPlugin interface { Plugin NeedSyncMeta(strategy *configuration.ColocationStrategy, oldNode, newNode *corev1.Node) (bool, string) }
type NodePreparePlugin ¶
type NodePreparePlugin interface { Plugin Execute(strategy *configuration.ColocationStrategy, node *corev1.Node, nr *NodeResource) error }
NodePreparePlugin implements node resource preparing for the calculated results. For example, assign extended resources in the node allocatable. It is invoked each time the controller tries updating the latest NodeResource object with calculated results.
type NodeResource ¶
type NodeResource struct { Resources map[corev1.ResourceName]*resource.Quantity `json:"resources,omitempty"` Labels map[string]string `json:"labels,omitempty"` Annotations map[string]string `json:"annotations,omitempty"` Messages map[corev1.ResourceName]string `json:"messages,omitempty"` Resets map[corev1.ResourceName]bool `json:"resets,omitempty"` }
func NewNodeResource ¶
func NewNodeResource(items ...ResourceItem) *NodeResource
func (*NodeResource) Delete ¶
func (nr *NodeResource) Delete(items ...ResourceItem)
func (*NodeResource) Get ¶
func (nr *NodeResource) Get(name corev1.ResourceName) *resource.Quantity
func (*NodeResource) Set ¶
func (nr *NodeResource) Set(items ...ResourceItem)
func (*NodeResource) SetResourceList ¶
func (nr *NodeResource) SetResourceList(rl corev1.ResourceList, message string)
type NodeSyncPlugin ¶
type NodeSyncPlugin interface { Plugin NeedSync(strategy *configuration.ColocationStrategy, oldNode, newNode *corev1.Node) (bool, string) }
NodeSyncPlugin implements the check of resource updating. For example, trigger an update if the values of the current is more than 10% different with the former.
type Option ¶ added in v1.3.0
func (*Option) WithRecorder ¶ added in v1.3.0
func (o *Option) WithRecorder(r record.EventRecorder) *Option
type Plugin ¶
type Plugin interface {
Name() string
}
Plugin has its name. Plugins in a registry are executed in order of the registration.
type PluginConfig ¶
type PluginConfig struct {
Plugin Plugin
}
type PluginRegistry ¶
func NewRegistry ¶
func NewRegistry(registryName string, plugins ...Plugin) *PluginRegistry
func (*PluginRegistry) GetAll ¶
func (r *PluginRegistry) GetAll() []Plugin
func (*PluginRegistry) MustRegister ¶
func (r *PluginRegistry) MustRegister(plugins ...Plugin)
func (*PluginRegistry) Size ¶
func (r *PluginRegistry) Size() int
func (*PluginRegistry) Unregister ¶
func (r *PluginRegistry) Unregister(name string)
type ResourceCalculatePlugin ¶
type ResourceCalculatePlugin interface { ResourceResetPlugin Calculate(strategy *configuration.ColocationStrategy, node *corev1.Node, podList *corev1.PodList, metrics *ResourceMetrics) ([]ResourceItem, error) }
ResourceCalculatePlugin implements resource counting and overcommitment algorithms. It implements Reset which can be invoked when the calculated resources need a reset. A ResourceCalculatePlugin can handle the case when the metrics are abnormal by implementing degraded calculation.
type ResourceItem ¶
type ResourceItem struct { Name corev1.ResourceName `json:"name,omitempty"` Quantity *resource.Quantity `json:"quantity,omitempty"` Labels map[string]string `json:"labels,omitempty"` Annotations map[string]string `json:"annotations,omitempty"` Message string `json:"message,omitempty"` // the message about the resource calculation Reset bool `json:"reset,omitempty"` // whether to reset the resource or not }
type ResourceMetrics ¶
type ResourceMetrics struct { NodeMetric *slov1alpha1.NodeMetric `json:"nodeMetric,omitempty"` // extended metrics Extensions *slov1alpha1.ExtensionsMap `json:"extensions,omitempty"` }
type ResourceResetPlugin ¶
type ResourceResetPlugin interface { Plugin Reset(node *corev1.Node, message string) []ResourceItem }
type SetupPlugin ¶ added in v1.3.0
SetupPlugin implements setup for the plugin. The Setup of each plugin will be called before other extension stages and invoked only once.
type SyncContext ¶
type SyncContext struct {
// contains filtered or unexported fields
}
func NewSyncContext ¶
func NewSyncContext() *SyncContext
func (*SyncContext) Delete ¶
func (s *SyncContext) Delete(key string)
func (*SyncContext) WithContext ¶
func (s *SyncContext) WithContext(m map[string]time.Time) *SyncContext