diff options
author | Kiran Kamineni <kiran.k.kamineni@intel.com> | 2019-11-01 13:15:47 -0700 |
---|---|---|
committer | Kiran Kamineni <kiran.k.kamineni@intel.com> | 2019-11-01 13:15:55 -0700 |
commit | 5839289be6a6f3a1441d73bd9e8a8ee4bf1dc1a3 (patch) | |
tree | 75a92322584cb007449d99df68eae4744b6cffe0 /src/k8splugin | |
parent | 599d59f739ce9af07360e0c45a7e12bee31fe650 (diff) |
Check for err when namespace plugin returns
Check for err when a namespace GET is called.
This will catch any errors related to the cluster GET
operations before the subsequent call is made.
Issue-ID: MULTICLOUD-666
Change-Id: I47de130f7ae9e6fea627f3a881ea84b2880db886
Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
Diffstat (limited to 'src/k8splugin')
-rw-r--r-- | src/k8splugin/internal/app/client.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/k8splugin/internal/app/client.go b/src/k8splugin/internal/app/client.go index e52225d4..b75c7dfd 100644 --- a/src/k8splugin/internal/app/client.go +++ b/src/k8splugin/internal/app/client.go @@ -20,6 +20,7 @@ import ( "github.com/onap/multicloud-k8s/src/k8splugin/internal/connection" "github.com/onap/multicloud-k8s/src/k8splugin/internal/helm" + logutils "github.com/onap/multicloud-k8s/src/k8splugin/internal/logutils" "github.com/onap/multicloud-k8s/src/k8splugin/internal/plugin" pkgerrors "github.com/pkg/errors" @@ -116,11 +117,17 @@ func (k *KubernetesClient) ensureNamespace(namespace string) error { }, }, namespace, k) + if err != nil { + logutils.WithFields(err.Error(), "namespace", namespace) + return pkgerrors.Wrap(err, "Error checking for namespace: "+namespace) + } + if ns == "" { - log.Println("Creating " + namespace + " namespace") + logutils.WithFields("Creating namespace", "namespace", namespace) _, err = pluginImpl.Create("", namespace, k) if err != nil { + logutils.WithFields(err.Error(), "namespace", namespace) return pkgerrors.Wrap(err, "Error creating "+namespace+" namespace") } } |