aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin/plugins/service/plugin.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/k8splugin/plugins/service/plugin.go')
-rw-r--r--src/k8splugin/plugins/service/plugin.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/k8splugin/plugins/service/plugin.go b/src/k8splugin/plugins/service/plugin.go
index 2fceffc0..4c1f37be 100644
--- a/src/k8splugin/plugins/service/plugin.go
+++ b/src/k8splugin/plugins/service/plugin.go
@@ -22,10 +22,14 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
utils "github.com/onap/multicloud-k8s/src/k8splugin/internal"
+ "github.com/onap/multicloud-k8s/src/k8splugin/internal/config"
"github.com/onap/multicloud-k8s/src/k8splugin/internal/helm"
"github.com/onap/multicloud-k8s/src/k8splugin/internal/plugin"
)
+// Compile time check to see if servicePlugin implements the correct interface
+var _ plugin.Reference = servicePlugin{}
+
// ExportedVariable is what we will look for when calling the plugin
var ExportedVariable servicePlugin
@@ -49,6 +53,14 @@ func (p servicePlugin) Create(yamlFilePath string, namespace string, client plug
}
service.Namespace = namespace
+ labels := service.GetLabels()
+ //Check if labels exist for this object
+ if labels == nil {
+ labels = map[string]string{}
+ }
+ labels[config.GetConfiguration().KubernetesLabelName] = client.GetInstanceID()
+ service.SetLabels(labels)
+
result, err := client.GetStandardClient().CoreV1().Services(namespace).Create(service)
if err != nil {
return "", pkgerrors.Wrap(err, "Create Service error")