Documentation ¶
Index ¶
- Constants
- Variables
- type NRTHandler
- func (h *NRTHandler) Create(ctx context.Context, evt event.CreateEvent, q workqueue.RateLimitingInterface)
- func (h *NRTHandler) Delete(ctx context.Context, evt event.DeleteEvent, q workqueue.RateLimitingInterface)
- func (h *NRTHandler) Generic(ctx context.Context, evt event.GenericEvent, q workqueue.RateLimitingInterface)
- func (h *NRTHandler) Update(ctx context.Context, evt event.UpdateEvent, q workqueue.RateLimitingInterface)
- type Plugin
- func (p *Plugin) Calculate(strategy *configuration.ColocationStrategy, node *corev1.Node, ...) ([]framework.ResourceItem, error)
- func (p *Plugin) Name() string
- func (p *Plugin) NeedSync(strategy *configuration.ColocationStrategy, oldNode, newNode *corev1.Node) (bool, string)
- func (p *Plugin) PreUpdate(strategy *configuration.ColocationStrategy, node *corev1.Node, ...) error
- func (p *Plugin) Prepare(_ *configuration.ColocationStrategy, node *corev1.Node, ...) error
- func (p *Plugin) Reset(node *corev1.Node, message string) []framework.ResourceItem
- func (p *Plugin) Setup(opt *framework.Option) error
Constants ¶
const PluginName = "BatchResource"
Variables ¶
var (
Clock clock.WithTickerAndDelayedExecution = clock.RealClock{} // for testing
)
var (
ResourceNames = []corev1.ResourceName{extension.BatchCPU, extension.BatchMemory}
)
Functions ¶
This section is empty.
Types ¶
type NRTHandler ¶ added in v1.4.0
type NRTHandler struct {
// contains filtered or unexported fields
}
func (*NRTHandler) Create ¶ added in v1.4.0
func (h *NRTHandler) Create(ctx context.Context, evt event.CreateEvent, q workqueue.RateLimitingInterface)
func (*NRTHandler) Delete ¶ added in v1.4.0
func (h *NRTHandler) Delete(ctx context.Context, evt event.DeleteEvent, q workqueue.RateLimitingInterface)
func (*NRTHandler) Generic ¶ added in v1.4.0
func (h *NRTHandler) Generic(ctx context.Context, evt event.GenericEvent, q workqueue.RateLimitingInterface)
func (*NRTHandler) Update ¶ added in v1.4.0
func (h *NRTHandler) Update(ctx context.Context, evt event.UpdateEvent, q workqueue.RateLimitingInterface)
type Plugin ¶
type Plugin struct{}
Plugin does 2 things: 1. calculate and update the extended resources of batch-cpu and batch-memory on the Node. 2. calculate and update the zone resources of batch-cpu and batch-memory on the NodeResourceTopology.
func (*Plugin) Calculate ¶
func (p *Plugin) Calculate(strategy *configuration.ColocationStrategy, node *corev1.Node, podList *corev1.PodList, resourceMetrics *framework.ResourceMetrics) ([]framework.ResourceItem, error)
Calculate calculates Batch resources using the formula below: Node.Total - Node.Reserved - System.Used - Pod(High-Priority).Used, System.Used = Node.Used - Pod(All).Used. As node and podList are the nearly latest state at time T1, the resourceMetrics are the node metric and pod metrics collected and snapshot at time T0 (T0 < T1). There can be gaps between the states of T0 and T1. We firstly calculate an infimum of the batch allocatable at time T0. `BatchAllocatable0 = NodeAllocatable * ratio - SystemUsed0 - Pod(HP and in Pods1).Used0` - Pod(not in Pods1).Used0. Then we minus the sum requests of the pods newly scheduled but have not been reported metrics to give a safe result.
func (*Plugin) NeedSync ¶
func (p *Plugin) NeedSync(strategy *configuration.ColocationStrategy, oldNode, newNode *corev1.Node) (bool, string)
func (*Plugin) PreUpdate ¶ added in v1.4.0
func (p *Plugin) PreUpdate(strategy *configuration.ColocationStrategy, node *corev1.Node, nr *framework.NodeResource) error
func (*Plugin) Prepare ¶ added in v1.4.0
func (p *Plugin) Prepare(_ *configuration.ColocationStrategy, node *corev1.Node, nr *framework.NodeResource) error