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
changes/79/476279/1
Lingxian Kong 6 years ago
parent fa10083c3b
commit 5587f947f6
  1. 7
      qinling/api/controllers/v1/function.py
  2. 2
      qinling/orchestrator/kubernetes/manager.py

@ -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)

@ -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(

Loading…
Cancel
Save