Add kubewatcher to fission-bundle
This commit is contained in:
+17
-6
@@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/docopt/docopt-go"
|
"github.com/docopt/docopt-go"
|
||||||
"github.com/platform9/fission/controller"
|
"github.com/platform9/fission/controller"
|
||||||
|
"github.com/platform9/fission/kubewatcher"
|
||||||
"github.com/platform9/fission/poolmgr"
|
"github.com/platform9/fission/poolmgr"
|
||||||
"github.com/platform9/fission/router"
|
"github.com/platform9/fission/router"
|
||||||
)
|
)
|
||||||
@@ -19,11 +20,7 @@ func runController(port int, etcdUrl string, filepath string) {
|
|||||||
log.Fatalf("Error: %v", err)
|
log.Fatalf("Error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
api := &controller.API{
|
api := controller.MakeAPI(rs)
|
||||||
FunctionStore: controller.FunctionStore{ResourceStore: *rs},
|
|
||||||
HTTPTriggerStore: controller.HTTPTriggerStore{ResourceStore: *rs},
|
|
||||||
EnvironmentStore: controller.EnvironmentStore{ResourceStore: *rs},
|
|
||||||
}
|
|
||||||
api.Serve(port)
|
api.Serve(port)
|
||||||
log.Fatalf("Error: Controller exited.")
|
log.Fatalf("Error: Controller exited.")
|
||||||
}
|
}
|
||||||
@@ -40,6 +37,13 @@ func runPoolmgr(port int, controllerUrl string, namespace string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func runKubeWatcher(controllerUrl, routerUrl string) {
|
||||||
|
err := kubewatcher.Start(controllerUrl, routerUrl)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Error starting kubewatcher: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func getPort(portArg interface{}) int {
|
func getPort(portArg interface{}) int {
|
||||||
portArgStr := portArg.(string)
|
portArgStr := portArg.(string)
|
||||||
port, err := strconv.Atoi(portArgStr)
|
port, err := strconv.Atoi(portArgStr)
|
||||||
@@ -72,12 +76,14 @@ Usage:
|
|||||||
fission-bundle --controllerPort=<port> [--etcdUrl=<etcdUrl>] --filepath=<filepath>
|
fission-bundle --controllerPort=<port> [--etcdUrl=<etcdUrl>] --filepath=<filepath>
|
||||||
fission-bundle --routerPort=<port> [--controllerUrl=<url> --poolmgrUrl=<url>]
|
fission-bundle --routerPort=<port> [--controllerUrl=<url> --poolmgrUrl=<url>]
|
||||||
fission-bundle --poolmgrPort=<port> [--controllerUrl=<url>]
|
fission-bundle --poolmgrPort=<port> [--controllerUrl=<url>]
|
||||||
|
fission-bundle --kubewatcher [--controllerUrl=<url> --routerUrl=<url>]
|
||||||
Options:
|
Options:
|
||||||
--controllerPort=<port> Port that the controller should listen on.
|
--controllerPort=<port> Port that the controller should listen on.
|
||||||
--routerPort=<port> Port that the router should listen on.
|
--routerPort=<port> Port that the router should listen on.
|
||||||
--poolmgrPort=<port> Port that the poolmgr should listen on.
|
--poolmgrPort=<port> Port that the poolmgr should listen on.
|
||||||
--controllerUrl=<url> Controller URL. Not required if --controllerPort is specified.
|
--controllerUrl=<url> Controller URL. Not required if --controllerPort is specified.
|
||||||
--poolmgrUrl=<url> Controller URL. Not required if --poolmgrPort is specified.
|
--poolmgrUrl=<url> Poolmgr URL. Not required if --poolmgrPort is specified.
|
||||||
|
--routerUrl=<url> Router URL.
|
||||||
--etcdUrl=<etcdUrl> Etcd URL.
|
--etcdUrl=<etcdUrl> Etcd URL.
|
||||||
--filepath=<filepath> Directory to store functions in.
|
--filepath=<filepath> Directory to store functions in.
|
||||||
--namespace=<namespace> Kubernetes namespace in which to run function containers. Defaults to 'fission-function'.
|
--namespace=<namespace> Kubernetes namespace in which to run function containers. Defaults to 'fission-function'.
|
||||||
@@ -92,6 +98,7 @@ Options:
|
|||||||
controllerUrl := getStringArgWithDefault(arguments["--controllerUrl"], "http://controller.fission")
|
controllerUrl := getStringArgWithDefault(arguments["--controllerUrl"], "http://controller.fission")
|
||||||
etcdUrl := getStringArgWithDefault(arguments["--etcdUrl"], "http://etcd:2379")
|
etcdUrl := getStringArgWithDefault(arguments["--etcdUrl"], "http://etcd:2379")
|
||||||
poolmgrUrl := getStringArgWithDefault(arguments["--poolmgrUrl"], "http://poolmgr.fission")
|
poolmgrUrl := getStringArgWithDefault(arguments["--poolmgrUrl"], "http://poolmgr.fission")
|
||||||
|
routerUrl := getStringArgWithDefault(arguments["--routerUrl"], "http://router.fission")
|
||||||
|
|
||||||
if arguments["--controllerPort"] != nil {
|
if arguments["--controllerPort"] != nil {
|
||||||
port := getPort(arguments["--controllerPort"])
|
port := getPort(arguments["--controllerPort"])
|
||||||
@@ -108,5 +115,9 @@ Options:
|
|||||||
runPoolmgr(port, controllerUrl, namespace)
|
runPoolmgr(port, controllerUrl, namespace)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if arguments["--kubewatcher"] != nil {
|
||||||
|
runKubeWatcher(controllerUrl, routerUrl)
|
||||||
|
}
|
||||||
|
|
||||||
select {}
|
select {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user