Support pre/post install/delete hooks   97/122397/14
authorhthieu <huu_trung.thieu@nokia-bell-labs.com>
Thu, 1 Jul 2021 18:03:09 +0000 (20:03 +0200)
committerhthieu <huu_trung.thieu@nokia-bell-labs.com>
Wed, 11 Aug 2021 13:02:27 +0000 (15:02 +0200)
commit57d1305db9f032c94949b719f0dc052ac7cd2d41
tree1249fbd139622900c4f0d04bfacf52836e471d31
parent6875d67ee2ad879170774304dd35d9a14dd9f50c
Support pre/post install/delete hooks  

Update instance create and delete handler to support pre/post install/delete hooks. 

Add hook.go: to execute and delete hook (base on delete policy). 

Implement watchUntilReady in generic plugin to wait for readiness of hook rss.

Add hook_sorter.go: to sort hook based on weight.

User can define timeout for each type of hooks in overwrite-values. Variable name is k8s-rb-instance-pre-install-timeout (default 60s),
k8s-rb-instance-post-install-timeout (default 600s), k8s-rb-instance-pre-delete-timeout (default 60s) and k8s-rb-instance-post-delete-timeout (600s). This is timeout
for each hook of a hook event (not a total time).

Add recovery capability to continue the execution of instantiation (create or delete) when the plugin stop unexpectedly.
For now, this is disabled because we have data-race issue during test. Will enable when we find the solution.

Add basic test for hooks (in hook_test.go)

Add test for hook in instance_test

For instance get request, we can request for full data by adding query param to the request: full=true.

Issue-ID: MULTICLOUD-1347
Signed-off-by: hthieu <huu_trung.thieu@nokia-bell-labs.com>
Change-Id: If2b4a90831b9bfce1af8b926e4062a7d706bee08
16 files changed:
src/k8splugin/api/api.go
src/k8splugin/api/instancehandler.go
src/k8splugin/go.sum
src/k8splugin/internal/app/client.go
src/k8splugin/internal/app/deploymentutil.go [new file with mode: 0644]
src/k8splugin/internal/app/hook.go [new file with mode: 0644]
src/k8splugin/internal/app/hook_sorter.go [new file with mode: 0644]
src/k8splugin/internal/app/hook_test.go [new file with mode: 0644]
src/k8splugin/internal/app/instance.go
src/k8splugin/internal/app/instance_test.go
src/k8splugin/internal/plugin/helpers.go
src/k8splugin/mock_files/mock_plugins/mockplugin.go
src/k8splugin/mock_files/mock_yamls/job.yaml [new file with mode: 0644]
src/k8splugin/plugins/generic/plugin.go
src/k8splugin/plugins/namespace/plugin.go
src/k8splugin/plugins/service/plugin.go