summaryrefslogtreecommitdiffstats
path: root/src/k8splugin/internal/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/k8splugin/internal/app')
-rw-r--r--src/k8splugin/internal/app/client_test.go2
-rw-r--r--src/k8splugin/internal/app/instance.go6
-rw-r--r--src/k8splugin/internal/app/instance_test.go14
3 files changed, 9 insertions, 13 deletions
diff --git a/src/k8splugin/internal/app/client_test.go b/src/k8splugin/internal/app/client_test.go
index d023fcff..4cc533e2 100644
--- a/src/k8splugin/internal/app/client_test.go
+++ b/src/k8splugin/internal/app/client_test.go
@@ -48,7 +48,7 @@ func TestInit(t *testing.T) {
t.Run("Successfully create Kube Client", func(t *testing.T) {
kubeClient := KubernetesClient{}
- err := kubeClient.init("../../mock_files/mock_configs/mock_config")
+ err := kubeClient.init("../../mock_files/mock_configs/mock_kube_config")
if err != nil {
t.Fatalf("TestGetKubeClient returned an error (%s)", err)
}
diff --git a/src/k8splugin/internal/app/instance.go b/src/k8splugin/internal/app/instance.go
index 8e9a2b7a..8d289d85 100644
--- a/src/k8splugin/internal/app/instance.go
+++ b/src/k8splugin/internal/app/instance.go
@@ -20,8 +20,8 @@ import (
"encoding/base64"
"encoding/json"
"math/rand"
- "os"
+ "k8splugin/internal/config"
"k8splugin/internal/db"
"k8splugin/internal/helm"
"k8splugin/internal/rb"
@@ -120,7 +120,7 @@ func (v *InstanceClient) Create(i InstanceRequest) (InstanceResponse, error) {
}
k8sClient := KubernetesClient{}
- err = k8sClient.init(os.Getenv("KUBE_CONFIG_DIR") + "/" + i.CloudRegion)
+ err = k8sClient.init(config.GetConfiguration().KubeConfigDir + "/" + i.CloudRegion)
if err != nil {
return InstanceResponse{}, pkgerrors.Wrap(err, "Getting CloudRegion Information")
}
@@ -185,7 +185,7 @@ func (v *InstanceClient) Delete(id string) error {
}
k8sClient := KubernetesClient{}
- err = k8sClient.init(os.Getenv("KUBE_CONFIG_DIR") + "/" + inst.CloudRegion)
+ err = k8sClient.init(config.GetConfiguration().KubeConfigDir + "/" + inst.CloudRegion)
if err != nil {
return pkgerrors.Wrap(err, "Getting CloudRegion Information")
}
diff --git a/src/k8splugin/internal/app/instance_test.go b/src/k8splugin/internal/app/instance_test.go
index 3828ed38..ab39dfb7 100644
--- a/src/k8splugin/internal/app/instance_test.go
+++ b/src/k8splugin/internal/app/instance_test.go
@@ -15,11 +15,11 @@ package app
import (
"log"
- "os"
"reflect"
"testing"
utils "k8splugin/internal"
+ "k8splugin/internal/config"
"k8splugin/internal/db"
"k8splugin/internal/helm"
"k8splugin/internal/rb"
@@ -153,14 +153,10 @@ func TestInstanceCreate(t *testing.T) {
RBName: "test-rbdef",
RBVersion: "v1",
ProfileName: "profile1",
- CloudRegion: "mock_config",
- }
-
- err := os.Setenv("KUBE_CONFIG_DIR", "../../mock_files/mock_configs")
- if err != nil {
- t.Fatalf("TestInstanceCreate returned an error (%s)", err)
+ CloudRegion: "mock_kube_config",
}
+ config.SetConfigValue("KubeConfigDir", "../../mock_files/mock_configs")
ir, err := ic.Create(input)
if err != nil {
t.Fatalf("TestInstanceCreate returned an error (%s)", err)
@@ -326,7 +322,7 @@ func TestInstanceDelete(t *testing.T) {
"namespace":"testnamespace",
"rb-name":"test-rbdef",
"rb-version":"v1",
- "cloud-region":"mock_config",
+ "cloud-region":"mock_kube_config",
"resources": [
{
"GVK": {
@@ -369,7 +365,7 @@ func TestInstanceDelete(t *testing.T) {
"namespace":"testnamespace",
"rb-name":"test-rbdef",
"rb-version":"v1",
- "cloud-region":"mock_config",
+ "cloud-region":"mock_kube_config",
"resources": [
{
"GVK": {