summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonrad Bańka <k.banka@samsung.com>2019-11-26 07:01:30 +0100
committerKonrad Bańka <k.banka@samsung.com>2019-12-11 06:39:57 +0100
commitd35491b7dc4a85b546179f8d7f00a389bfbded49 (patch)
tree641e617b5b30d217b6e7dcdf15a31fca3d83237d
parent88c3694fa50ea8fee314752e096f8070f017ac6c (diff)
Fix ensureNamespace behavior failing on missing ns
The behavior is now amended to ignore namespace not found errors. Signed-off-by: Konrad Bańka <k.banka@samsung.com> Issue-ID: MULTICLOUD-955 Change-Id: Ifc180eca9e8195c38f0b0f268dd142a329405d3d Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
-rw-r--r--src/k8splugin/internal/app/client.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/k8splugin/internal/app/client.go b/src/k8splugin/internal/app/client.go
index 78477a82..d3e5081a 100644
--- a/src/k8splugin/internal/app/client.go
+++ b/src/k8splugin/internal/app/client.go
@@ -15,6 +15,7 @@ package app
import (
"os"
+ "strings"
"time"
"github.com/onap/multicloud-k8s/src/k8splugin/internal/connection"
@@ -116,7 +117,9 @@ func (k *KubernetesClient) ensureNamespace(namespace string) error {
},
}, namespace, k)
- if err != nil {
+ // Check for errors getting the namespace while ignoring errors where the namespace does not exist
+ // Error message when namespace does not exist: "namespaces "namespace-name" not found"
+ if err != nil && strings.Contains(err.Error(), "not found") == false {
log.Error("Error checking for namespace", log.Fields{
"error": err,
"namespace": namespace,