Skip to content

Commit

Permalink
Print daemons visible interfaces on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
nfisher committed May 29, 2020
1 parent bfdf969 commit 99fdd81
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmd/daemon/daemon_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,22 @@ var (

// Exec is the primary execution for the daemon application.
func Exec(address string, info DownwardInfo) error {
log.Printf("daemon=%s listen=%s pod=%s/%s podIP=%s nodeIP=%s", Revision, address, info.Namespace, info.Name, info.PodIP, info.NodeIP)
log.Printf("daemon=%s pod=%s/%s listen=%s podIP=%s nodeIP=%s", Revision, info.Namespace, info.Name, address, info.PodIP, info.NodeIP)
publish("address", address)
publish("name", info.Name)
publish("namespace", info.Namespace)
publish("nodeIP", info.NodeIP)
publish("podIP", info.PodIP)

_, err := MapInterfaces()
ifs, err := MapInterfaces()
if err != nil {
return err
}

for k, v := range ifs {
log.Printf("pod=%s/%s if=%s ips=%v\n", info.Namespace, info.Name, k, v)
}

http.HandleFunc("/ping", PingHandler(info))

return http.ListenAndServe(address, nil)
Expand Down Expand Up @@ -81,7 +85,7 @@ func main() {
err := Exec(address, downward)

if err != nil {
log.Printf("status=shutdown error='%v'\n", err)
log.Printf("status=shutdown pod=%s/%s error='%v'\n", downward.Namespace, downward.Name, err)
os.Exit(-1)
}
}
Expand Down

0 comments on commit 99fdd81

Please sign in to comment.