diff --git a/go/tasks/pluginmachinery/k8s/mocks/plugin_cleanup_policy.go b/go/tasks/pluginmachinery/k8s/mocks/plugin_cleanup_policy.go new file mode 100644 index 000000000..553fd69ed --- /dev/null +++ b/go/tasks/pluginmachinery/k8s/mocks/plugin_cleanup_policy.go @@ -0,0 +1,30 @@ +// Code generated by mockery v1.0.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + + client "sigs.k8s.io/controller-runtime/pkg/client" + + mock "github.com/stretchr/testify/mock" +) + +// PluginCleanupPolicy is an autogenerated mock type for the PluginCleanupPolicy type +type PluginCleanupPolicy struct { + mock.Mock +} + +// OnAbort provides a mock function with given fields: ctx, kubeClient, resource +func (_m *PluginCleanupPolicy) OnAbort(ctx context.Context, kubeClient client.Client, resource client.Object) error { + ret := _m.Called(ctx, kubeClient, resource) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, client.Client, client.Object) error); ok { + r0 = rf(ctx, kubeClient, resource) + } else { + r0 = ret.Error(0) + } + + return r0 +} diff --git a/go/tasks/pluginmachinery/k8s/plugin.go b/go/tasks/pluginmachinery/k8s/plugin.go index 0a746c991..92c2f9eeb 100644 --- a/go/tasks/pluginmachinery/k8s/plugin.go +++ b/go/tasks/pluginmachinery/k8s/plugin.go @@ -91,3 +91,8 @@ type Plugin interface { // Properties desired by the plugin GetProperties() PluginProperties } + +// Defines functions to clean up the resource object after the task has been completed or cancelled. +type PluginCleanupPolicy interface { + OnAbort(ctx context.Context, kubeClient client.Client, resource client.Object) error +}