Documentation ¶
Index ¶
- Constants
- func NewAutoscaleEnforcerPlugin(ctx context.Context) func(runtime.Object, framework.Handle) (framework.Plugin, error)
- type AutoscaleEnforcer
- func (e *AutoscaleEnforcer) Filter(ctx context.Context, state *framework.CycleState, pod *corev1.Pod, ...) *framework.Status
- func (e *AutoscaleEnforcer) Name() string
- func (e *AutoscaleEnforcer) Reserve(ctx context.Context, state *framework.CycleState, pod *corev1.Pod, ...) *framework.Status
- func (e *AutoscaleEnforcer) Score(ctx context.Context, state *framework.CycleState, pod *corev1.Pod, ...) (int64, *framework.Status)
- func (e *AutoscaleEnforcer) ScoreExtensions() framework.ScoreExtensions
- func (e *AutoscaleEnforcer) Unreserve(ctx context.Context, state *framework.CycleState, pod *corev1.Pod, ...)
Constants ¶
const ( MaxHTTPBodySize int64 = 1 << 10 // 1 KiB ContentTypeJSON string = "application/json" ContentTypeError string = "text/plain" )
const ( MinPluginProtocolVersion api.PluginProtoVersion = api.PluginProtoV1_0 MaxPluginProtocolVersion api.PluginProtoVersion = api.PluginProtoV1_1 )
The scheduler plugin currently supports v1.0 to v1.1 of the agent<->scheduler plugin protocol.
If you update either of these values, make sure to also update VERSIONING.md.
const ConfigMapKey = "autoscaler-enforcer-config.json"
const ConfigMapName = "scheduler-plugin-config"
const ConfigMapNamespace = "kube-system"
const InitConfigMapTimeoutSeconds = 5
const LabelVM = vmapi.VirtualMachineNameLabel
const Name = "AutoscaleEnforcer"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AutoscaleEnforcer ¶
type AutoscaleEnforcer struct {
// contains filtered or unexported fields
}
AutoscaleEnforcer is the scheduler plugin to coordinate autoscaling
func (*AutoscaleEnforcer) Filter ¶
func (e *AutoscaleEnforcer) Filter( ctx context.Context, state *framework.CycleState, pod *corev1.Pod, nodeInfo *framework.NodeInfo, ) *framework.Status
Filter gives our plugin a chance to signal that a pod shouldn't be put onto a particular node
Required for framework.FilterPlugin
func (*AutoscaleEnforcer) Name ¶
func (e *AutoscaleEnforcer) Name() string
Name returns the name of the AutoscaleEnforcer plugin
Required for framework.Plugin
func (*AutoscaleEnforcer) Reserve ¶
func (e *AutoscaleEnforcer) Reserve( ctx context.Context, state *framework.CycleState, pod *corev1.Pod, nodeName string, ) *framework.Status
Reserve signals to our plugin that a particular pod will (probably) be bound to a node, giving us a chance to both (a) reserve the resources it needs within the node and (b) reject the pod if there aren't enough.
Required for framework.ReservePlugin
func (*AutoscaleEnforcer) Score ¶
func (e *AutoscaleEnforcer) Score( ctx context.Context, state *framework.CycleState, pod *corev1.Pod, nodeName string, ) (int64, *framework.Status)
Score allows our plugin to express which nodes should be preferred for scheduling new pods onto
Even though this function is given (pod, node) pairs, our scoring is only really dependent on values of the node. However, we have special handling for when the pod no longer fits in the node (even though it might have during the Filter plugin) - we can't return a failure, because that would cause *all* scheduling of the pod to fail, so we instead return the minimum score.
The scores might not be consistent with each other, due to ongoing changes in the node. That's ok, because nothing relies on strict correctness here, and they should be approximately correct anyways.
Required for framework.ScorePlugin
func (*AutoscaleEnforcer) ScoreExtensions ¶
func (e *AutoscaleEnforcer) ScoreExtensions() framework.ScoreExtensions
ScoreExtensions is required for framework.ScorePlugin, and can return nil if it's not used
func (*AutoscaleEnforcer) Unreserve ¶
func (e *AutoscaleEnforcer) Unreserve( ctx context.Context, state *framework.CycleState, pod *corev1.Pod, nodeName string, )
Unreserve marks a pod as no longer on-track to being bound to a node, so we can release the resources we previously reserved for it.
Required for framework.ReservePlugin.
Note: the documentation for ReservePlugin indicates that Unreserve both (a) must be idempotent and (b) may be called without a previous call to Reserve for the same pod.