Skip to content

Commit

Permalink
Merge pull request #357 from denis-tingaikin/fix-pod-name-env
Browse files Browse the repository at this point in the history
qfix: replace POD_NAME and remove NODE_NAME from createpod chain element
  • Loading branch information
edwarnicke authored May 14, 2022
2 parents cb9e385 + 8461bb7 commit 3778661
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions pkg/networkservice/common/createpod/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import (

const (
nodeNameKey = "nodeName"
createdBy = "spawnedBy"
createdBy = "createdBy"
)

type createPodServer struct {
Expand All @@ -50,7 +50,6 @@ type createPodServer struct {
deserializer runtime.Decoder
podTemplate string
myNamespace string
myNode string
myName string
}

Expand All @@ -69,8 +68,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 {
Expand Down
8 changes: 4 additions & 4 deletions pkg/networkservice/common/createpod/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 3778661

Please sign in to comment.