summaryrefslogtreecommitdiffstats
path: root/src/k8splugin/internal/app/client.go
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@orange.com>2021-10-05 14:36:01 +0200
committerLukasz Rajewski <lukasz.rajewski@orange.com>2021-10-05 14:55:01 +0200
commit258e59bf8563021f4eded42b33c6cc61a6ffebd8 (patch)
treef4d536a335401fd357628e5b2ec630ea294686a3 /src/k8splugin/internal/app/client.go
parent54b79141744e713848ae46f3170c637bc7d08ef8 (diff)
Fixed issue with order of deleted resources0.9.1
For delete operation order of resources is reverse to the order used for creation Issue-ID: MULTICLOUD-1398 Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com> Change-Id: I3f34c6000222e82c34f59042e99d2c37a343dfa5
Diffstat (limited to 'src/k8splugin/internal/app/client.go')
-rw-r--r--src/k8splugin/internal/app/client.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/k8splugin/internal/app/client.go b/src/k8splugin/internal/app/client.go
index 06c4c464..f70dc0a5 100644
--- a/src/k8splugin/internal/app/client.go
+++ b/src/k8splugin/internal/app/client.go
@@ -550,18 +550,17 @@ func (k *KubernetesClient) DeleteKind(resource helm.KubernetesResource, namespac
return pkgerrors.Wrap(err, "Error loading plugin")
}
- name, err := pluginImpl.Get(resource, namespace, k)
+ err = pluginImpl.Delete(resource, namespace, k)
- if (err == nil && name == resource.Name) || (err != nil && strings.Contains(err.Error(), "not found") == false) {
- err = pluginImpl.Delete(resource, namespace, k)
- if err != nil {
+ if err != nil {
+ if strings.Contains(err.Error(), "not found") == false {
return pkgerrors.Wrap(err, "Error deleting "+resource.Name)
+ } else {
+ log.Warn("Resource already does not exist", log.Fields{
+ "gvk": resource.GVK,
+ "resource": resource.Name,
+ })
}
- } else {
- log.Warn("Resource does not exist, Skipping delete", log.Fields{
- "gvk": resource.GVK,
- "resource": resource.Name,
- })
}
return nil