Skip to content

Commit

Permalink
register: add NICs' IPaddress to MachineInventories annotations
Browse files Browse the repository at this point in the history
The IP address information can be useful to admins and users.
Anyway, the reason to this change is to later introduce support to the
CATTLE_ADDRESS and the CATTLE_INTERNAL_ADDRESS env variables.

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
  • Loading branch information
fgiudici committed Nov 12, 2024
1 parent 7b879b1 commit 5413d8e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/register/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@ func sendAnnotations(conn *websocket.Conn, reg elementalv1.Registration) error {
log.Debugf("sending local IP: %s", data["registration-ip"])
}

netIfaces := hostinfo.GetIPAddresses()
for ifName, ipAddr := range netIfaces {
data["net."+ifName+".ip"] = ipAddr
}

err := SendJSONData(conn, MsgAnnotations, data)
if err != nil {
log.Debugf("annotation data:\n%s", litter.Sdump(data))
Expand Down

0 comments on commit 5413d8e

Please sign in to comment.