Skip to content

Commit

Permalink
Convert NodeName obtained from env var to lowercase on Windows.
Browse files Browse the repository at this point in the history
Currently, the startup scripts force an environment variable
to have lowercase node name. This gets complex once we add
support to native windows services as they don't get
env variables from local shell.

An example of startup script is function: Start-AntreaAgent in
https://raw.githubusercontent.com/antrea-io/antrea/v1.2.0/hack/windows/Helper.psm1

Signed-off-by: Gurucharan Shetty <gurushetty@google.com>
  • Loading branch information
shettyg committed Aug 31, 2021
1 parent d8d70ac commit 7923400
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/util/env/env.go
Expand Up @@ -16,7 +16,9 @@ package env

import (
"os"
"runtime"
"strconv"
"strings"

"k8s.io/klog/v2"
)
Expand Down Expand Up @@ -48,6 +50,9 @@ func GetNodeName() (string, error) {
klog.Errorf("Failed to get local hostname: %v", err)
return "", err
}
if runtime.GOOS == "windows" {
return strings.ToLower(nodeName), nil
}
return nodeName, nil
}

Expand Down

0 comments on commit 7923400

Please sign in to comment.