diff options
author | Lukasz Rajewski <lukasz.rajewski@orange.com> | 2021-08-09 22:44:48 +0200 |
---|---|---|
committer | Lukasz Rajewski <lukasz.rajewski@orange.com> | 2021-08-09 22:44:48 +0200 |
commit | 6875d67ee2ad879170774304dd35d9a14dd9f50c (patch) | |
tree | 8d4df538a9c1d6673216e6280f72f46e5297462d /src/k8splugin/internal/app/instance.go | |
parent | b64758e33cb291a6e9afa80a89a57f6cd3a3562d (diff) |
Fixed issue of leftovers after instace create failure
Fixed issue of leftovers after instace create failure
Issue-ID: MULTICLOUD-1269
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com>
Change-Id: I69b4a170d72a482f29fd79ecdfc949f55c70a61a
Diffstat (limited to 'src/k8splugin/internal/app/instance.go')
-rw-r--r-- | src/k8splugin/internal/app/instance.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/k8splugin/internal/app/instance.go b/src/k8splugin/internal/app/instance.go index 8c924af3..c7fd8e52 100644 --- a/src/k8splugin/internal/app/instance.go +++ b/src/k8splugin/internal/app/instance.go @@ -177,6 +177,10 @@ func (v *InstanceClient) Create(i InstanceRequest) (InstanceResponse, error) { createdResources, err := k8sClient.createResources(sortedTemplates, profile.Namespace) if err != nil { + if len(createdResources) > 0 { + log.Printf("[Instance] Reverting created resources on Error: %s", err.Error()) + k8sClient.deleteResources(createdResources, profile.Namespace) + } return InstanceResponse{}, pkgerrors.Wrap(err, "Create Kubernetes Resources") } |