Fix function deletion

When deleting function, we should remove all the allocated resources
in the orchestrator, no matter what kind of source the function is
using.

Change-Id: I7ee3d1bb1e6b417194a1b86606f8fcd64cb598cf
This commit is contained in:
Lingxian Kong 2017-06-22 10:06:33 +12:00
parent fa10083c3b
commit 5587f947f6
2 changed files with 4 additions and 5 deletions

View File

@ -176,10 +176,9 @@ class FunctionsController(rest.RestController):
if source == 'package':
self.storage_provider.delete(context.get_ctx().projectid, id)
if source == 'image':
# If it's image function, need to delete all resources created
# by orchestrator asynchronously.
self.engine_client.delete_function(id)
# Delete all resources created by orchestrator asynchronously.
self.engine_client.delete_function(id)
# This will also delete function service mapping as well.
db_api.delete_function(id)

View File

@ -324,7 +324,7 @@ class KubernetesManager(base.OrchestratorBase):
return {'result': output}
def delete_function(self, function_id, labels=[]):
def delete_function(self, function_id, labels=None):
selector = common.convert_dict_to_string(labels)
ret = self.v1.list_namespaced_service(