Change:
Why doesn't the 'node' entity have a hostname and/or IP fields? Currently its id field (soon to become name field) holds the IP but is that something that a REST api consumer can firmly rely on to get the node's IP/hostname so this field 'name/id' will always hold IP/hostname and not other information? (IP/hostname is useful for example for visualization of the minions available in a k8s cluster in UI and showing their IP/hostnames)
Minion does have a HostIP field in v1beta1, and NodeStatus has a HostIP field in v1beta3. When you GET the resource, is the value for that field not set? If so, on what cloudprovider? It's true that there is no hostname field, but the minion/node name itself is the hostname.
, I'm currently using the hack/local cluster setup , this is the output of GET for minion 127.0.0.1 with v1beta1, seems that HostIP is not returned at all (even not with empty value) { "kind": "Node", "id": "127.0.0.1", "uid": "-8527-11e4-8f4b-", "creationTimestamp": "2014-12-16T15:31:50+02:00", "selfLink": "/api/v1beta1/minions/127.0.0.1", "resourceVersion": 7, "apiVersion": "v1beta1", "resources": { "capacity": { "cpu": 1000, "memory": } } } Can you please elaborate/point to docs about the change in v3? so HostIP field is moved into a NodeStatus section/internal to Node entity? BTW why is it considered part of a status? thank you
The best documentation of v1beta3 is unfortunately the source right now: It adheres to the conventions described here: The fact that HostIP is not reported is probably a quirk with static minions. In reality, hosts can have multiple IP addresses, some private and some public, v4 and v6, dynamically assigned (e.g., using DHCP), etc. For now, we support single, private, static IP addresses, but in cases where hosts are specified using hostnames, the IP addresses are looked up. So, status makes the most sense to me.
Yeah, HostIP is only queried from cloudprovider. you won't see hostIP in json if it's empty (see the tag)
why HostIP is not returned for local static setup? the id reflects the IP anyhow. it sounds like a bug, but this issue is tagged with "documentation".
Yes, I agree that it's a bug that HostIP isn't populated. The documentation aspect is to explain somewhere why it's in Status rather than Spec.

Discussion:
import ( "fmt" <ins> "net" </ins> "time" "github.com/GoogleCloudPlatform/kubernetes/pkg/api"

if registered.Has(nodeID) { continue } <del> _, err := s.kubeClient.Nodes().Create(&api.Node{ </del> <ins> node := &api.Node{ </ins> ObjectMeta: api.ObjectMeta{Name: nodeID}, Spec: api.NodeSpec{ Capacity: s.staticResources.Capacity, }, <del> }) </del> <ins> } addr := net.ParseIP(nodeID) if addr != nil { node.Status.HostIP = nodeID } else { addrs, err := net.LookupIP(nodeID) if err != nil { glog.Errorf("Can't get ip address of node %v", nodeID) } else if len(addrs) == 0 { glog.Errorf("No ip address for node %v", nodeID) } else { node.Status.HostIP = addrs[0].String() } } _, err := s.kubeClient.Nodes().Create(node) </ins> if err == nil { registered.Insert(nodeID) }

} } <ins> func TestSyncStaticCreateNodeWithHostIP(t *testing.T) { fakeNodeHandler := &FakeNodeHandler{ CreateHook: func(fake *FakeNodeHandler, node *api.Node) bool { return true }, } nodeController := NewNodeController(nil, ".*", []string{"10.0.0.1"}, &api.NodeResources{}, fakeNodeHandler) if err := nodeController.SyncStatic(time.Millisecond); err != nil { t.Errorf("unexpected error: %v", err) } if fakeNodeHandler.CreatedNodes[0].Name != "10.0.0.1" { t.Errorf("unexpect node %v created", fakeNodeHandler.CreatedNodes[0].Name) } if fakeNodeHandler.CreatedNodes[0].Status.HostIP != "10.0.0.1" { t.Errorf("unexpect nil node HostIP for node %v", fakeNodeHandler.CreatedNodes[0].Name) } } </ins> func TestSyncStaticCreateNodeWithError(t *testing.T) { fakeNodeHandler := &FakeNodeHandler{ CreateHook: func(fake *FakeNodeHandler, node *api.Node) bool {