Skip to content

Commit

Permalink
Use hostname as node_name if NODE_NAME envvar is not found
Browse files Browse the repository at this point in the history
This will enable node_name field in standalone mode.

Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
  • Loading branch information
lambdanis committed Feb 19, 2024
1 parent 2e3d543 commit f5657ad
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/reader/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ import "os"
// Set HUBBLE_NODE_NAME to override the node_name field for JSON export.
func GetNodeNameForExport() string {
nodeName := os.Getenv("HUBBLE_NODE_NAME")
if nodeName != "" {
return nodeName
if nodeName == "" {
nodeName = os.Getenv("NODE_NAME")
}
return os.Getenv("NODE_NAME")
if nodeName == "" {
nodeName, _ = os.Hostname()

}
return nodeName
}

0 comments on commit f5657ad

Please sign in to comment.