From afbf401464c6f3daf8bc3dabac51aae35168ba6f Mon Sep 17 00:00:00 2001 From: Federico Simoncelli Date: Mon, 23 Mar 2015 12:30:45 -0400 Subject: [PATCH] nodeinfo: add boot id system information Signed-off-by: Federico Simoncelli --- pkg/api/types.go | 2 ++ pkg/api/v1beta1/types.go | 2 ++ pkg/api/v1beta2/types.go | 2 ++ pkg/api/v1beta3/types.go | 2 ++ pkg/kubelet/kubelet.go | 1 + pkg/kubelet/kubelet_test.go | 18 ++++++++++++++++-- pkg/kubelet/server.go | 1 + 7 files changed, 26 insertions(+), 2 deletions(-) diff --git a/pkg/api/types.go b/pkg/api/types.go index 3a4d73f36cb..81a65d13685 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -971,6 +971,8 @@ type NodeSystemInfo struct { MachineID string `json:"machineID"` // SystemUUID is the system-uuid reported by the node SystemUUID string `json:"systemUUID"` + // BootID is the boot-id reported by the node + BootID string `json:"bootID"` } // NodeStatus is information about the current status of a node. diff --git a/pkg/api/v1beta1/types.go b/pkg/api/v1beta1/types.go index 50e95fcfa82..a8cda9ca232 100644 --- a/pkg/api/v1beta1/types.go +++ b/pkg/api/v1beta1/types.go @@ -782,6 +782,8 @@ type NodeSystemInfo struct { MachineID string `json:"machineID" description:"machine id is the machine-id reported by the node"` // SystemUUID is the system-uuid reported by the node SystemUUID string `json:"systemUUID" description:"system uuid is the system-uuid reported by the node"` + // BootID is the boot-id reported by the node + BootID string `json:"bootID" description:"boot id is the boot-id reported by the node"` } // NodeStatus is information about the current status of a node. diff --git a/pkg/api/v1beta2/types.go b/pkg/api/v1beta2/types.go index 8b177282c07..325dd419bbe 100644 --- a/pkg/api/v1beta2/types.go +++ b/pkg/api/v1beta2/types.go @@ -783,6 +783,8 @@ type NodeSystemInfo struct { MachineID string `json:"machineID" description:"machine id is the machine-id reported by the node"` // SystemUUID is the system-uuid reported by the node SystemUUID string `json:"systemUUID" description:"system uuid is the system-uuid reported by the node"` + // BootID is the boot-id reported by the node + BootID string `json:"bootID" description:"boot id is the boot-id reported by the node"` } // NodeStatus is information about the current status of a node. diff --git a/pkg/api/v1beta3/types.go b/pkg/api/v1beta3/types.go index 0e338677ec3..a448020623b 100644 --- a/pkg/api/v1beta3/types.go +++ b/pkg/api/v1beta3/types.go @@ -969,6 +969,8 @@ type NodeSystemInfo struct { MachineID string `json:"machineID"` // SystemUUID is the system-uuid reported by the node SystemUUID string `json:"systemUUID"` + // BootID is the boot-id reported by the node + BootID string `json:"bootID" description:"boot id is the boot-id reported by the node"` } // NodeStatus is information about the current status of a node. diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 5ffc45bf498..ec262d24c0b 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -1922,6 +1922,7 @@ func (kl *Kubelet) tryUpdateNodeStatus() error { } else { node.Status.NodeInfo.MachineID = info.MachineID node.Status.NodeInfo.SystemUUID = info.SystemUUID + node.Status.NodeInfo.BootID = info.BootID node.Spec.Capacity = CapacityFromMachineInfo(info) } diff --git a/pkg/kubelet/kubelet_test.go b/pkg/kubelet/kubelet_test.go index dc3293a4d1a..8c696a515ef 100644 --- a/pkg/kubelet/kubelet_test.go +++ b/pkg/kubelet/kubelet_test.go @@ -3128,7 +3128,13 @@ func TestUpdateNewNodeStatus(t *testing.T) { kubeClient.MinionsList = api.NodeList{Items: []api.Node{ {ObjectMeta: api.ObjectMeta{Name: "testnode"}}, }} - machineInfo := &cadvisorApi.MachineInfo{MachineID: "123", SystemUUID: "abc", NumCores: 2, MemoryCapacity: 1024} + machineInfo := &cadvisorApi.MachineInfo{ + MachineID: "123", + SystemUUID: "abc", + BootID: "1b3", + NumCores: 2, + MemoryCapacity: 1024, + } mockCadvisor.On("MachineInfo").Return(machineInfo, nil) expectedNode := &api.Node{ ObjectMeta: api.ObjectMeta{Name: "testnode"}, @@ -3151,6 +3157,7 @@ func TestUpdateNewNodeStatus(t *testing.T) { NodeInfo: api.NodeSystemInfo{ MachineID: "123", SystemUUID: "abc", + BootID: "1b3", }, }, } @@ -3205,7 +3212,13 @@ func TestUpdateExistingNodeStatus(t *testing.T) { }, }, }} - machineInfo := &cadvisorApi.MachineInfo{MachineID: "123", SystemUUID: "abc", NumCores: 2, MemoryCapacity: 1024} + machineInfo := &cadvisorApi.MachineInfo{ + MachineID: "123", + SystemUUID: "abc", + BootID: "1b3", + NumCores: 2, + MemoryCapacity: 1024, + } mockCadvisor.On("MachineInfo").Return(machineInfo, nil) expectedNode := &api.Node{ ObjectMeta: api.ObjectMeta{Name: "testnode"}, @@ -3228,6 +3241,7 @@ func TestUpdateExistingNodeStatus(t *testing.T) { NodeInfo: api.NodeSystemInfo{ MachineID: "123", SystemUUID: "abc", + BootID: "1b3", }, }, } diff --git a/pkg/kubelet/server.go b/pkg/kubelet/server.go index c95d0fa9927..d60aa9c2697 100644 --- a/pkg/kubelet/server.go +++ b/pkg/kubelet/server.go @@ -341,6 +341,7 @@ func (s *Server) handleNodeInfoVersioned(w http.ResponseWriter, req *http.Reques NodeSystemInfo: api.NodeSystemInfo{ MachineID: info.MachineID, SystemUUID: info.SystemUUID, + BootID: info.BootID, }, })