volcano.sh/volcano@v1.9.0/docs/design/extender.md (about) 1 # Volcano Framework Extender 2 ## Summary 3 At present, volcano has not provided a mechanism for non-invasive function realization. If the user needs to implement an internal scheduling function, the source code of volcano must be modified. 4 Such as kube-scheduler, this proposal is to dynamically extend Volcano's scheduling capabilities via an http request. 5 ## Motivation 6 Currently, the only way to implement a scheduling strategy based on Volcano is to modify Volcano's code and recompile. 7 This method requires developers to deeply understand the working principle of Volcano and the related architecture, which is not friendly to beginners. 8 By adding other processes and based on network communication, it will bring some performance degradation, but it will also improve scalability. Users can make their own trade-offs between the two. 9 ### Goals 10 Similar to kube-scheduler, the user-defined scheduling algorithm is registered to volcano through http server. 11 ### Non-Goals 12 Does not solve the performance degradation caused by the network. 13 14 ## Design Details 15 ### Implementation Details 16 Implement a plugin named extender, the plugin will register related functions in the SessionOpen function, and pass the snapshot to the endpoint through the http method. 17 The extender plugin will choose which methods to register according to the configuration file, and is responsible for serializing and deserializing the parameters. When there is an error in the http call, the plugin decides how to deal with it according to the configuration file. 18 ### Extender Arguments 19 ``` 20 - plugins: 21 - name: extender 22 arguments: 23 extender.urlPrefix: http://127.0.0.1 24 extender.httpTimeout: 100ms 25 extender.onSessionOpenVerb: onSessionOpen 26 extender.onSessionCloseVerb: onSessionClose 27 extender.predicateVerb: predicate 28 extender.prioritizeVerb: prioritize 29 extender.preemptableVerb: preemptable 30 extender.reclaimableVerb: reclaimable 31 extender.queueOverusedVerb: queueOverused 32 extender.jobEnqueueableVerb: jobEnqueueable 33 extender.ignorable: true 34 ``` 35 36 ### Extender Arguments Detail 37 - extender.urlPrefix : Address of extender endpoint 38 - extender.httpTimeout : The timeout duration for a call to the extender. 39 - extender.*Verb : Verbs of extender function, ignore if verb is empty. Those verbs are appended to the urlPrefix when issuing the http call. 40 - extender.ignorable : Ignorable indicates scheduling should fail or not when this extender is unavailable. 41 42 ### Example 43 ``` 44 func (ep *ExtenderPlugin) OnSessionOpen(ssn *framework.Session) { 45 if len(ep.urlPrefix) == 0 { 46 return 47 } 48 if len(ep.openSessionOpenVerb) != 0 { 49 ep.onSessionOpen(ssn) 50 } 51 if len(ep.predicateVerb) != 0 { 52 ssn.AddPredicateFn(ep.Name(), ep.predicateFn) 53 } 54 55 // ... 56 } 57 ``` 58 Extender implementation should define how to handle this function call : 59 - If there are no verb exist in configuration, return nil. 60 - If there are verb definition in configuration, send http request to endpoint and handle the network error. 61 Plugin-based methods currently only support one Extender as an extension at the same time. 62 ## Future Improvement 63 - Support batchPredicateFn method: Add a new plugin method to calculate all nodes in one function, and implement extender method for that. 64 - Support extender Bind method : Delegate bind action to extender