Poolmgr: clean up orphaned resources on restart
Label all poolmgr-created resources with an id that's unique to a running poolmgr instance. On poolmgr start up, clean up resources created by old instances. Resources that are idle are killed immediately; resources that could be running a user function are killed after the maximum function timeout.
This commit is contained in:
+5
-2
@@ -20,6 +20,7 @@ import (
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
"github.com/dchest/uniuri"
|
||||
"k8s.io/client-go/1.5/kubernetes"
|
||||
"k8s.io/client-go/1.5/rest"
|
||||
|
||||
@@ -56,11 +57,13 @@ func StartPoolmgr(controllerUrl string, namespace string, port int) error {
|
||||
return err
|
||||
}
|
||||
|
||||
instanceId := uniuri.NewLen(8)
|
||||
cleanupOldPoolmgrResources(kubernetesClient, namespace, instanceId)
|
||||
|
||||
fsCache := MakeFunctionServiceCache()
|
||||
gpm := MakeGenericPoolManager(controllerUrl, kubernetesClient, namespace, fsCache, instanceId)
|
||||
|
||||
gpm := MakeGenericPoolManager(controllerUrl, kubernetesClient, namespace, fsCache)
|
||||
api := MakeAPI(gpm, controllerClient, fsCache)
|
||||
|
||||
go api.Serve(port)
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user