Fix newdeploy failed to find serviceEntry in cache (#1349)
When a function with executor type newdeploy got created, Newdeploy is expected to create deployment/HPA/service for it and insert serviceEntry to the cache for later use. Once clients call the function, newdeploy returns the serviceEntry to the router. However, the log shows that the newdeploy was unable to find the entry and prints "Resource not found - key 'xxx' not found". The root cause is that the informer controller instead of processing items in parallel, it dispatches XXFunc to process items one by one. So if there is any problem during the creation of the kubernetes resource, it takes a longer time to process the next item and hence the serviceEntry was not inserted before clients call the function. This PR lets the newdeploy to process items in extra goroutines instead of blocking the process loop. It's a workaround to solve the problem above, we should consider using workqueue to solve it in the future.
This commit is contained in:
@@ -207,6 +207,9 @@ func serveMetric(logger *zap.Logger) {
|
||||
// deploymgr and potential future executor types
|
||||
func StartExecutor(logger *zap.Logger, functionNamespace string, envBuilderNamespace string, port int) error {
|
||||
fissionClient, kubernetesClient, _, err := crd.MakeFissionClient()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get kubernetes client")
|
||||
}
|
||||
|
||||
err = fissionClient.WaitForCRDs()
|
||||
if err != nil {
|
||||
@@ -219,10 +222,6 @@ func StartExecutor(logger *zap.Logger, functionNamespace string, envBuilderNames
|
||||
}
|
||||
|
||||
restClient := fissionClient.GetCrdClient()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get kubernetes client")
|
||||
}
|
||||
|
||||
fsCache := fscache.MakeFunctionServiceCache(logger)
|
||||
|
||||
poolID := strings.ToLower(uniuri.NewLen(8))
|
||||
|
||||
Reference in New Issue
Block a user