RIC-208 - KA Decision: ask K8S to restart E2T instance - comment code

Change-Id: Ic15c8c5fcb994603544c9c7688f272057fce3a5d
Signed-off-by: Irina <ib565x@intl.att.com>
diff --git a/E2Manager/configuration/configuration.go b/E2Manager/configuration/configuration.go
index 54a0410..2169f6a 100644
--- a/E2Manager/configuration/configuration.go
+++ b/E2Manager/configuration/configuration.go
@@ -38,10 +38,10 @@
 	RoutingManager struct {
 		BaseUrl string
 	}
-	Kubernetes struct {
+/*	Kubernetes struct {
 		ConfigPath string
 		Namespace  string
-	}
+	}*/
 	NotificationResponseBuffer   int
 	BigRedButtonTimeoutSec       int
 	MaxConnectionAttempts        int
@@ -73,7 +73,7 @@
 	config.populateHttpConfig(viper.Sub("http"))
 	config.populateLoggingConfig(viper.Sub("logging"))
 	config.populateRoutingManagerConfig(viper.Sub("routingManager"))
-	config.populateKubernetesConfig(viper.Sub("kubernetes"))
+	//config.populateKubernetesConfig(viper.Sub("kubernetes"))
 	config.NotificationResponseBuffer = viper.GetInt("notificationResponseBuffer")
 	config.BigRedButtonTimeoutSec = viper.GetInt("bigRedButtonTimeoutSec")
 	config.MaxConnectionAttempts = viper.GetInt("maxConnectionAttempts")
@@ -115,13 +115,13 @@
 	c.RoutingManager.BaseUrl = rmConfig.GetString("baseUrl")
 }
 
-func (c *Configuration) populateKubernetesConfig(rmConfig *viper.Viper) {
+/*func (c *Configuration) populateKubernetesConfig(rmConfig *viper.Viper) {
 	if rmConfig == nil {
 		panic(fmt.Sprintf("#configuration.populateKubernetesConfig - failed to populate Kubernetes configuration: The entry 'kubernetes' not found\n"))
 	}
 	c.Kubernetes.ConfigPath = rmConfig.GetString("configPath")
 	c.Kubernetes.Namespace = rmConfig.GetString("namespace")
-}
+}*/
 
 func (c *Configuration) populateGlobalRicIdConfig(globalRicIdConfig *viper.Viper) {
 	if globalRicIdConfig == nil {
@@ -135,7 +135,7 @@
 	return fmt.Sprintf("{logging.logLevel: %s, http.port: %d, rmr: { port: %d, maxMsgSize: %d}, routingManager.baseUrl: %s, "+
 		"notificationResponseBuffer: %d, bigRedButtonTimeoutSec: %d, maxConnectionAttempts: %d, maxRnibConnectionAttempts: %d, "+
 		"rnibRetryIntervalMs: %d, keepAliveResponseTimeoutMs: %d, keepAliveDelayMs: %d, e2tInstanceDeletionTimeoutMs: %d, "+
-		"globalRicId: { plmnId: %s, ricNearRtId: %s}, kubernetes: {configPath: %s, namespace: %s}}",
+		"globalRicId: { plmnId: %s, ricNearRtId: %s}}",//, kubernetes: {configPath: %s, namespace: %s}}",
 		c.Logging.LogLevel,
 		c.Http.Port,
 		c.Rmr.Port,
@@ -151,7 +151,7 @@
 		c.E2TInstanceDeletionTimeoutMs,
 		c.GlobalRicId.PlmnId,
 		c.GlobalRicId.RicNearRtId,
-		c.Kubernetes.ConfigPath,
-		c.Kubernetes.Namespace,
+	//	c.Kubernetes.ConfigPath,
+		//c.Kubernetes.Namespace,
 	)
 }
diff --git a/E2Manager/configuration/configuration_test.go b/E2Manager/configuration/configuration_test.go
index ce0448d..cdbf338 100644
--- a/E2Manager/configuration/configuration_test.go
+++ b/E2Manager/configuration/configuration_test.go
@@ -42,8 +42,8 @@
 	assert.NotNil(t, config.GlobalRicId)
 	assert.NotEmpty(t, config.GlobalRicId.PlmnId)
 	assert.NotEmpty(t, config.GlobalRicId.RicNearRtId)
-	assert.NotEmpty(t, config.Kubernetes.Namespace)
-	assert.NotEmpty(t, config.Kubernetes.ConfigPath)
+	/*assert.NotEmpty(t, config.Kubernetes.Namespace)
+	assert.NotEmpty(t, config.Kubernetes.ConfigPath)*/
 }
 
 func TestStringer(t *testing.T) {
@@ -208,7 +208,7 @@
 		"logging": map[string]interface{}{"logLevel": "info"},
 		"http": map[string]interface{}{"port": 3800},
 		"routingManager":    map[string]interface{}{"baseUrl": "http://iltlv740.intl.att.com:8080/ric/v1/handles/"},
-		"kubernetes":    map[string]interface{}{"namespace": "test", "ConfigPath": "test"},
+		//"kubernetes":    map[string]interface{}{"namespace": "test", "ConfigPath": "test"},
 	}
 	buf, err := yaml.Marshal(yamlMap)
 	if err != nil {
@@ -222,7 +222,7 @@
 		func() { ParseConfiguration() })
 }
 
-func TestKubernetesConfigNotFoundFailure(t *testing.T) {
+/*func TestKubernetesConfigNotFoundFailure(t *testing.T) {
 	configPath := "../resources/configuration.yaml"
 	configPathTmp := "../resources/configuration.yaml_tmp"
 	err := os.Rename(configPath, configPathTmp)
@@ -252,4 +252,4 @@
 	}
 	assert.PanicsWithValue(t, "#configuration.populateKubernetesConfig - failed to populate Kubernetes configuration: The entry 'kubernetes' not found\n",
 		func() { ParseConfiguration() })
-}
+}*/
diff --git a/E2Manager/container-tag.yaml b/E2Manager/container-tag.yaml
index 4504e37..745e65a 100644
--- a/E2Manager/container-tag.yaml
+++ b/E2Manager/container-tag.yaml
@@ -1,4 +1,4 @@
 # The Jenkins job requires a tag to build the Docker image.
 # Global-JJB script assumes this file is in the repo root.
 ---
-tag: 4.4.1
+tag: 4.4.2
diff --git a/E2Manager/managers/e2t_shutdown_manager.go b/E2Manager/managers/e2t_shutdown_manager.go
index bb89e3b..6287547 100644
--- a/E2Manager/managers/e2t_shutdown_manager.go
+++ b/E2Manager/managers/e2t_shutdown_manager.go
@@ -62,7 +62,7 @@
 		return nil
 	}
 
-	go m.kubernetesManager.DeletePod(e2tInstance.PodName)
+	//go m.kubernetesManager.DeletePod(e2tInstance.PodName)
 
 	err := m.markE2tInstanceToBeDeleted(e2tInstance)
 	if err != nil {
diff --git a/E2Manager/managers/e2t_shutdown_manager_test.go b/E2Manager/managers/e2t_shutdown_manager_test.go
index 21de338..499f067 100644
--- a/E2Manager/managers/e2t_shutdown_manager_test.go
+++ b/E2Manager/managers/e2t_shutdown_manager_test.go
@@ -35,8 +35,8 @@
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
 	"io/ioutil"
-	"k8s.io/apimachinery/pkg/runtime"
-	"k8s.io/client-go/kubernetes/fake"
+	//"k8s.io/apimachinery/pkg/runtime"
+	//"k8s.io/client-go/kubernetes/fake"
 	"net/http"
 	"testing"
 	"time"
@@ -56,11 +56,14 @@
 	httpClientMock := &mocks.HttpClientMock{}
 	rmClient := clients.NewRoutingManagerClient(log, config, httpClientMock)
 	associationManager := NewE2TAssociationManager(log, rnibDataService, e2tInstancesManager, rmClient)
-	kubernetesManager := initKubernetesManagerTest(t)
+	//kubernetesManager := initKubernetesManagerTest(t)
 
-	shutdownManager := NewE2TShutdownManager(log, config, rnibDataService, e2tInstancesManager, associationManager, kubernetesManager)
+	/*shutdownManager := NewE2TShutdownManager(log, config, rnibDataService, e2tInstancesManager, associationManager, kubernetesManager)
 
-	return shutdownManager, readerMock, writerMock, httpClientMock, kubernetesManager
+	return shutdownManager, readerMock, writerMock, httpClientMock, kubernetesManager*/
+	shutdownManager := NewE2TShutdownManager(log, config, rnibDataService, e2tInstancesManager, associationManager, nil)
+
+	return shutdownManager, readerMock, writerMock, httpClientMock, nil
 }
 
 func TestShutdownSuccess1OutOf3Instances(t *testing.T) {
@@ -409,7 +412,7 @@
 	writerMock.AssertExpectations(t)
 	httpClientMock.AssertExpectations(t)
 }
-
+/*
 func TestShutdownSuccess2Instance2Rans(t *testing.T) {
 	shutdownManager, readerMock, writerMock, httpClientMock,kubernetesManager  := initE2TShutdownManagerTest(t)
 
@@ -504,4 +507,4 @@
 		writerMock.AssertExpectations(t)
 		httpClientMock.AssertExpectations(t)
 	})
-}
\ No newline at end of file
+}*/
\ No newline at end of file
diff --git a/E2Manager/managers/kubernetes_manager.go b/E2Manager/managers/kubernetes_manager.go
index 5c3e8ee..ef36c28 100644
--- a/E2Manager/managers/kubernetes_manager.go
+++ b/E2Manager/managers/kubernetes_manager.go
@@ -22,12 +22,8 @@
 
 import (
 	"e2mgr/configuration"
-	"e2mgr/e2managererrors"
 	"e2mgr/logger"
-	metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/client-go/kubernetes"
-	"k8s.io/client-go/tools/clientcmd"
-	"path/filepath"
 )
 
 type KubernetesManager struct {
@@ -39,7 +35,7 @@
 func NewKubernetesManager(logger *logger.Logger, config *configuration.Configuration) *KubernetesManager {
 	return &KubernetesManager{
 		Logger:    logger,
-		ClientSet: createClientSet(logger, config),
+	//	ClientSet: createClientSet(logger, config),
 		Config:    config,
 	}
 }
@@ -63,7 +59,7 @@
 	km.DeletePod(podInterface, podName)
 }*/
 
-func createClientSet(logger *logger.Logger, config *configuration.Configuration) kubernetes.Interface {
+/*func createClientSet(logger *logger.Logger, config *configuration.Configuration) kubernetes.Interface {
 	////path := os.Getenv("HOME") + "/.kube/config"
 
 	absConfigPath,err := filepath.Abs(config.Kubernetes.ConfigPath)
@@ -84,7 +80,7 @@
 		return nil
 	}
 	return clientSet
-}
+}*/
 
 /*func (km KubernetesManager) DeletePod(podInterface v1.PodInterface, podName string) {
 	km.logger.Infof("#KubernetesManager.DeletePod - POD name %s ", podName)
@@ -99,7 +95,7 @@
 }
 */
 func (km KubernetesManager) DeletePod(podName string) error {
-	km.Logger.Infof("#KubernetesManager.DeletePod - POD name: %s ", podName)
+/*	km.Logger.Infof("#KubernetesManager.DeletePod - POD name: %s ", podName)
 
 	if km.ClientSet == nil {
 		km.Logger.Errorf("#KubernetesManager.DeletePod - no kubernetesManager connection")
@@ -118,7 +114,7 @@
 		return err
 	}
 
-	km.Logger.Infof("#KubernetesManager.DeletePod - POD %s was deleted", podName)
+	km.Logger.Infof("#KubernetesManager.DeletePod - POD %s was deleted", podName)*/
 	return nil
 }
 
diff --git a/E2Manager/managers/kubernetes_manager_test.go b/E2Manager/managers/kubernetes_manager_test.go
index 0f207ed..dab5943 100644
--- a/E2Manager/managers/kubernetes_manager_test.go
+++ b/E2Manager/managers/kubernetes_manager_test.go
@@ -20,6 +20,7 @@
 
 package managers
 
+/*
 import (
 	"e2mgr/configuration"
 	"e2mgr/logger"
@@ -148,3 +149,4 @@
 		},
 	}
 }
+*/
\ No newline at end of file
diff --git a/E2Manager/resources/configuration.yaml b/E2Manager/resources/configuration.yaml
index a7cfcd3..434994b 100644
--- a/E2Manager/resources/configuration.yaml
+++ b/E2Manager/resources/configuration.yaml
@@ -17,7 +17,4 @@
 e2tInstanceDeletionTimeoutMs: 15000
 globalRicId:
   plmnId: 131014
-  ricNearRtId: 556670
-kubernetes:
-  configPath: ./kub_config.yml
-  namespace: ricplt
\ No newline at end of file
+  ricNearRtId: 556670
\ No newline at end of file
diff --git a/E2Manager/resources/rmr.verbose b/E2Manager/resources/rmr.verbose
index 56a6051..c227083 100644
--- a/E2Manager/resources/rmr.verbose
+++ b/E2Manager/resources/rmr.verbose
@@ -1 +1 @@
-1
\ No newline at end of file
+0
\ No newline at end of file