Executor abstraction (#384)

This change adds a layer of abstraction over poolmgr. Poolmgr is now just one of the ways to turn a function into a service; other implementations will be added. The executor abstraction is a uniform API over all these implementations.

* Executor layer added on top of pool manager

* Removed the external server for executor

* Minor changes to keep existing semantics as much possible

* Separating the executor vs. poolmgr backend functionality and associated data members

* Executor logic separated from Poolmgr backend completely, placeholder for new backend

* Changed references to poolmgr in tests

* Moved poolmgr to it's package, as a side effect moved Cache to its's package (was causing cyclical dependency) and had to make some data structures exposed outside package

* Rebased from master and changed references to tpr -> crd

* Executor layer added on top of pool manager

* Executor logic separated from Poolmgr backend completely, placeholder for new backend

* Changed podName to a generic objectReference in fscache (#391)

Changed podName to a generic objectReference in function service cache implementation.

* Moved poolmgr to it's package, as a side effect moved Cache to its's package (was causing cyclical dependency) and had to make some data structures exposed outside package

* Rebased from master and changed references to tpr -> crd

* Merged from master with latest changes

* Removed stale executor service & deployment from previous merge

* Addressed review comments, still testing some areas
This commit is contained in:
Vishal
2017-11-20 20:51:14 -08:00
committed by Soam Vasani
parent 7bb397dfee
commit da820186f0
20 changed files with 476 additions and 458 deletions
+19 -18
View File
@@ -6,11 +6,12 @@ import (
"strconv"
"github.com/docopt/docopt-go"
"github.com/fission/fission/buildermgr"
"github.com/fission/fission/controller"
"github.com/fission/fission/executor"
"github.com/fission/fission/kubewatcher"
"github.com/fission/fission/mqtrigger"
"github.com/fission/fission/poolmgr"
"github.com/fission/fission/router"
"github.com/fission/fission/storagesvc"
"github.com/fission/fission/timer"
@@ -21,15 +22,15 @@ func runController(port int) {
log.Fatalf("Error: Controller exited.")
}
func runRouter(port int, poolmgrUrl string) {
router.Start(port, poolmgrUrl)
func runRouter(port int, executorUrl string) {
router.Start(port, executorUrl)
log.Fatalf("Error: Router exited.")
}
func runPoolmgr(port int, fissionNamespace, functionNamespace string) {
err := poolmgr.StartPoolmgr(fissionNamespace, functionNamespace, port)
func runExecutor(port int, fissionNamespace, functionNamespace string) {
err := executor.StartExecutor(fissionNamespace, functionNamespace, port)
if err != nil {
log.Fatalf("Error starting poolmgr: %v", err)
log.Fatalf("Error starting executor: %v", err)
}
}
@@ -88,18 +89,18 @@ func getStringArgWithDefault(arg interface{}, defaultValue string) string {
}
func main() {
usage := `fission-bundle: Package of all fission microservices: controller, router, poolmgr.
usage := `fission-bundle: Package of all fission microservices: controller, router, executor.
Use it to start one or more of the fission servers:
Controller is a stateless API frontend for fission resources.
Pool manager maintains a pool of generalized function containers, and
specializes them on-demand. Poolmgr must be run from a pod in a
specializes them on-demand. Executor must be run from a pod in a
Kubernetes cluster.
Router implements HTTP triggers: it routes to running instances,
working with the controller and poolmgr.
working with the controller and executor.
Kubewatcher implements Kubernetes Watch triggers: it watches
Kubernetes resources and invokes functions described in the
@@ -111,8 +112,8 @@ Use it to start one or more of the fission servers:
Usage:
fission-bundle --controllerPort=<port>
fission-bundle --routerPort=<port> [--poolmgrUrl=<url>]
fission-bundle --poolmgrPort=<port> [--namespace=<namespace>] [--fission-namespace=<namespace>]
fission-bundle --routerPort=<port> [--executorUrl=<url>]
fission-bundle --executorPort=<port> [--namespace=<namespace>] [--fission-namespace=<namespace>]
fission-bundle --kubewatcher [--routerUrl=<url>]
fission-bundle --storageServicePort=<port> --filePath=<filePath>
fission-bundle --builderMgrPort=<port> [--storageSvcUrl=<url>] [--envbuilder-namespace=<namespace>]
@@ -121,10 +122,10 @@ Usage:
Options:
--controllerPort=<port> Port that the controller should listen on.
--routerPort=<port> Port that the router should listen on.
--poolmgrPort=<port> Port that the poolmgr should listen on.
--executorPort=<port> Port that the executor should listen on.
--storageServicePort=<port> Port that the storage service should listen on.
--builderMgrPort=<port> Port that the buildermgr should listen on.
--poolmgrUrl=<url> Poolmgr URL. Not required if --poolmgrPort is specified.
--executorUrl=<url> Executor URL. Not required if --executorPort is specified.
--routerUrl=<url> Router URL.
--etcdUrl=<etcdUrl> Etcd URL.
--storageSvcUrl=<url> StorageService URL.
@@ -143,7 +144,7 @@ Options:
fissionNs := getStringArgWithDefault(arguments["--fission-namespace"], "fission")
envBuilderNs := getStringArgWithDefault(arguments["--envbuilder-namespace"], "fission-builder")
poolmgrUrl := getStringArgWithDefault(arguments["--poolmgrUrl"], "http://poolmgr.fission")
executorUrl := getStringArgWithDefault(arguments["--executorUrl"], "http://executor.fission")
routerUrl := getStringArgWithDefault(arguments["--routerUrl"], "http://router.fission")
storageSvcUrl := getStringArgWithDefault(arguments["--storageSvcUrl"], "http://storagesvc.fission")
@@ -154,12 +155,12 @@ Options:
if arguments["--routerPort"] != nil {
port := getPort(arguments["--routerPort"])
runRouter(port, poolmgrUrl)
runRouter(port, executorUrl)
}
if arguments["--poolmgrPort"] != nil {
port := getPort(arguments["--poolmgrPort"])
runPoolmgr(port, fissionNs, functionNs)
if arguments["--executorPort"] != nil {
port := getPort(arguments["--executorPort"])
runExecutor(port, fissionNs, functionNs)
}
if arguments["--kubewatcher"] == true {