From 7047a962ef3d44c3cb63d21df609b0ca31b256d5 Mon Sep 17 00:00:00 2001 From: Haytham AbuelFutuh Date: Thu, 30 Apr 2020 13:50:10 -0700 Subject: [PATCH] Add missing objet metadata on abort (#127) --- flytepropeller/pkg/controller/nodes/task/k8s/plugin_manager.go | 2 ++ .../pkg/controller/nodes/task/k8s/plugin_manager_test.go | 1 + 2 files changed, 3 insertions(+) diff --git a/flytepropeller/pkg/controller/nodes/task/k8s/plugin_manager.go b/flytepropeller/pkg/controller/nodes/task/k8s/plugin_manager.go index 998bbc42b0..42f6556a28 100644 --- a/flytepropeller/pkg/controller/nodes/task/k8s/plugin_manager.go +++ b/flytepropeller/pkg/controller/nodes/task/k8s/plugin_manager.go @@ -305,6 +305,8 @@ func (e PluginManager) Abort(ctx context.Context, tCtx pluginsCore.TaskExecution return nil } + AddObjectMetadata(tCtx.TaskExecutionMetadata(), o, config.GetK8sPluginConfig()) + err = e.kubeClient.GetClient().Delete(ctx, o) if err != nil && !IsK8sObjectNotExists(err) { logger.Warningf(ctx, "Failed to clear finalizers for Resource with name: %v/%v. Error: %v", diff --git a/flytepropeller/pkg/controller/nodes/task/k8s/plugin_manager_test.go b/flytepropeller/pkg/controller/nodes/task/k8s/plugin_manager_test.go index b1e0d4cbcd..6835e53e13 100644 --- a/flytepropeller/pkg/controller/nodes/task/k8s/plugin_manager_test.go +++ b/flytepropeller/pkg/controller/nodes/task/k8s/plugin_manager_test.go @@ -372,6 +372,7 @@ func TestPluginManager_Abort(t *testing.T) { // common setup code tctx := getMockTaskContext(PluginPhaseStarted, PluginPhaseStarted) fc := extendedFakeClient{Client: fake.NewFakeClientWithScheme(scheme.Scheme, res)} + // common setup code mockResourceHandler := &pluginsk8sMock.Plugin{} mockResourceHandler.OnBuildIdentityResourceMatch(mock.Anything, tctx.TaskExecutionMetadata()).Return(&v1.Pod{}, nil)