Fix ensure Namespace function 29/68929/1
authorVictor Morales <victor.morales@intel.com>
Tue, 25 Sep 2018 10:32:37 +0000 (03:32 -0700)
committerVictor Morales <victor.morales@intel.com>
Tue, 25 Sep 2018 10:32:37 +0000 (03:32 -0700)
The I1e1eb40f1a18ba33c74069a117462c8df17767ac change standarizes the
Interface for the plugins, this changes affects callers and it's
necessary to update those references. This change fix that issue for
Namespace Kubernetes resources.

Change-Id: I04c957fdd526401523b72e332b6e24385a7ceefe
Signed-off-by: Victor Morales <victor.morales@intel.com>
Issue-ID: MULTICLOUD-301

src/k8splugin/csar/parser.go

index 6cb07fc..c0dd6a7 100644 (file)
@@ -23,7 +23,7 @@ import (
        "k8s.io/client-go/kubernetes"
 
        pkgerrors "github.com/pkg/errors"
-       "gopkg.in/yaml.v2"
+       yaml "gopkg.in/yaml.v2"
 
        "k8splugin/krd"
 )
@@ -46,7 +46,7 @@ func ensuresNamespace(namespace string, kubeclient kubernetes.Interface) error {
        }
 
        ns, err := symGetNamespaceFunc.(func(string, string, kubernetes.Interface) (string, error))(
-               namespace, "", kubeclient)
+               namespace, namespace, kubeclient)
        if err != nil {
                return pkgerrors.Wrap(err, "An error ocurred during the get namespace execution")
        }
@@ -57,9 +57,12 @@ func ensuresNamespace(namespace string, kubeclient kubernetes.Interface) error {
                if err != nil {
                        return pkgerrors.Wrap(err, "Error fetching create namespace plugin")
                }
+               namespaceResource := &krd.ResourceData{
+                       Namespace: namespace,
+               }
 
-               err = symGetNamespaceFunc.(func(string, kubernetes.Interface) error)(
-                       namespace, kubeclient)
+               _, err = symGetNamespaceFunc.(func(*krd.ResourceData, kubernetes.Interface) (string, error))(
+                       namespaceResource, kubeclient)
                if err != nil {
                        return pkgerrors.Wrap(err, "Error creating "+namespace+" namespace")
                }