From 6579f255bdcd040fbe58a9cec265ceca86d4a180 Mon Sep 17 00:00:00 2001 From: Denis Tingaikin Date: Sat, 14 May 2022 22:41:41 +0300 Subject: [PATCH 1/2] replace POD_NAME and remove NODE_NAME from createpod chain element Signed-off-by: Denis Tingaikin --- pkg/networkservice/common/createpod/server.go | 5 ++--- pkg/networkservice/common/createpod/server_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/networkservice/common/createpod/server.go b/pkg/networkservice/common/createpod/server.go index a1ad0b8..5d61c2b 100644 --- a/pkg/networkservice/common/createpod/server.go +++ b/pkg/networkservice/common/createpod/server.go @@ -41,7 +41,7 @@ import ( const ( nodeNameKey = "nodeName" - createdBy = "spawnedBy" + createdBy = "createdBy" ) type createPodServer struct { @@ -69,8 +69,7 @@ func NewServer(ctx context.Context, client kubernetes.Interface, podTemplate str client: client, myNamespace: "default", deserializer: deserializer, - myNode: os.Getenv("NODE_NAME"), - myName: os.Getenv("POD_NAME"), + myName: os.Getenv("HOSTNAME"), } for _, opt := range options { diff --git a/pkg/networkservice/common/createpod/server_test.go b/pkg/networkservice/common/createpod/server_test.go index c8caebf..8186a7a 100644 --- a/pkg/networkservice/common/createpod/server_test.go +++ b/pkg/networkservice/common/createpod/server_test.go @@ -68,7 +68,7 @@ objectmeta: clientSet := fake.NewSimpleClientset() - err := os.Setenv("POD_NAME", "supplier-1") + err := os.Setenv("HOSTNAME", "supplier-1") require.NoError(t, err) server := next.NewNetworkServiceServer( @@ -146,7 +146,7 @@ objectmeta: clientSet := fake.NewSimpleClientset() - err := os.Setenv("POD_NAME", "supplier-1") + err := os.Setenv("HOSTNAME", "supplier-1") require.NoError(t, err) server := next.NewNetworkServiceServer( @@ -223,7 +223,7 @@ objectmeta: clientSet := fake.NewSimpleClientset() - err := os.Setenv("POD_NAME", "supplier-1") + err := os.Setenv("HOSTNAME", "supplier-1") require.NoError(t, err) server := next.NewNetworkServiceServer( @@ -270,7 +270,7 @@ objectmeta: clientSet := fake.NewSimpleClientset() - err := os.Setenv("POD_NAME", "supplier-1") + err := os.Setenv("HOSTNAME", "supplier-1") require.NoError(t, err) server := next.NewNetworkServiceServer( From 8461bb7e54dedb8f970bd913064aca40c11c1827 Mon Sep 17 00:00:00 2001 From: Denis Tingaikin Date: Sat, 14 May 2022 22:52:01 +0300 Subject: [PATCH 2/2] remove unused env Signed-off-by: Denis Tingaikin --- pkg/networkservice/common/createpod/server.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/networkservice/common/createpod/server.go b/pkg/networkservice/common/createpod/server.go index 5d61c2b..e2f6182 100644 --- a/pkg/networkservice/common/createpod/server.go +++ b/pkg/networkservice/common/createpod/server.go @@ -50,7 +50,6 @@ type createPodServer struct { deserializer runtime.Decoder podTemplate string myNamespace string - myNode string myName string }