mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
kubelet: retport system info in node information
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
This commit is contained in:
parent
1b18440f35
commit
644d775bc1
@ -788,6 +788,14 @@ type NodeSpec struct {
|
||||
ExternalID string `json:"externalID,omitempty"`
|
||||
}
|
||||
|
||||
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node.
|
||||
type NodeSystemInfo struct {
|
||||
// MachineID is the machine-id reported by the node
|
||||
MachineID string `json:"machineID"`
|
||||
// SystemUUID is the system-uuid reported by the node
|
||||
SystemUUID string `json:"systemUUID"`
|
||||
}
|
||||
|
||||
// NodeStatus is information about the current status of a node.
|
||||
type NodeStatus struct {
|
||||
// NodePhase is the current lifecycle phase of the node.
|
||||
@ -796,6 +804,8 @@ type NodeStatus struct {
|
||||
Conditions []NodeCondition `json:"conditions,omitempty"`
|
||||
// Queried from cloud provider, if available.
|
||||
Addresses []NodeAddress `json:"addresses,omitempty"`
|
||||
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node
|
||||
NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty"`
|
||||
}
|
||||
|
||||
// NodeInfo is the information collected on the node.
|
||||
@ -803,6 +813,8 @@ type NodeInfo struct {
|
||||
TypeMeta `json:",inline"`
|
||||
// Capacity represents the available resources of a node
|
||||
Capacity ResourceList `json:"capacity,omitempty"`
|
||||
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node
|
||||
NodeSystemInfo `json:",inline,omitempty"`
|
||||
}
|
||||
|
||||
type NodePhase string
|
||||
|
@ -699,6 +699,9 @@ func init() {
|
||||
if err := s.Convert(&in.Status.Addresses, &out.Status.Addresses, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.Status.NodeInfo, &out.Status.NodeInfo, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, address := range in.Status.Addresses {
|
||||
if address.Type == newer.NodeLegacyHostIP {
|
||||
@ -728,6 +731,9 @@ func init() {
|
||||
if err := s.Convert(&in.Status.Addresses, &out.Status.Addresses, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.Status.NodeInfo, &out.Status.NodeInfo, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if in.HostIP != "" {
|
||||
newer.AddToNodeAddresses(&out.Status.Addresses,
|
||||
|
@ -618,6 +618,14 @@ type EndpointsList struct {
|
||||
Items []Endpoints `json:"items" description:"list of service endpoint lists"`
|
||||
}
|
||||
|
||||
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node.
|
||||
type NodeSystemInfo struct {
|
||||
// MachineID is the machine-id reported by the node
|
||||
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"`
|
||||
}
|
||||
|
||||
// NodeStatus is information about the current status of a node.
|
||||
type NodeStatus struct {
|
||||
// NodePhase is the current lifecycle phase of the node.
|
||||
@ -626,6 +634,8 @@ type NodeStatus struct {
|
||||
Conditions []NodeCondition `json:"conditions,omitempty" description:"conditions is an array of current node conditions"`
|
||||
// Queried from cloud provider, if available.
|
||||
Addresses []NodeAddress `json:"addresses,omitempty" description:"list of addresses reachable to the node"`
|
||||
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node
|
||||
NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty" description:"node identity is a set of ids/uuids to uniquely identify the node"`
|
||||
}
|
||||
|
||||
// NodeInfo is the information collected on the node.
|
||||
@ -633,6 +643,8 @@ type NodeInfo struct {
|
||||
TypeMeta `json:",inline"`
|
||||
// Capacity represents the available resources.
|
||||
Capacity ResourceList `json:"capacity,omitempty" description:"resource capacity of a node represented as a map of resource name to quantity of resource"`
|
||||
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node
|
||||
NodeSystemInfo `json:",inline,omitempty" description:"node identity is a set of ids/uuids to uniquely identify the node"`
|
||||
}
|
||||
|
||||
type NodePhase string
|
||||
|
@ -619,6 +619,9 @@ func init() {
|
||||
if err := s.Convert(&in.Status.Addresses, &out.Status.Addresses, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.Status.NodeInfo, &out.Status.NodeInfo, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, address := range in.Status.Addresses {
|
||||
if address.Type == newer.NodeLegacyHostIP {
|
||||
@ -648,6 +651,9 @@ func init() {
|
||||
if err := s.Convert(&in.Status.Addresses, &out.Status.Addresses, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.Status.NodeInfo, &out.Status.NodeInfo, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if in.HostIP != "" {
|
||||
newer.AddToNodeAddresses(&out.Status.Addresses,
|
||||
|
@ -623,6 +623,14 @@ type EndpointsList struct {
|
||||
Items []Endpoints `json:"items" description:"list of service endpoint lists"`
|
||||
}
|
||||
|
||||
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node.
|
||||
type NodeSystemInfo struct {
|
||||
// MachineID is the machine-id reported by the node
|
||||
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"`
|
||||
}
|
||||
|
||||
// NodeStatus is information about the current status of a node.
|
||||
//
|
||||
// https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/node.md#node-status
|
||||
@ -633,6 +641,8 @@ type NodeStatus struct {
|
||||
Conditions []NodeCondition `json:"conditions,omitempty" description:"conditions is an array of current node conditions"`
|
||||
// Queried from cloud provider, if available.
|
||||
Addresses []NodeAddress `json:"addresses,omitempty" description:"list of addresses reachable to the node"`
|
||||
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node
|
||||
NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty" description:"node identity is a set of ids/uuids to uniquely identify the node"`
|
||||
}
|
||||
|
||||
// NodeInfo is the information collected on the node.
|
||||
@ -640,6 +650,8 @@ type NodeInfo struct {
|
||||
TypeMeta `json:",inline"`
|
||||
// Capacity represents the available resources.
|
||||
Capacity ResourceList `json:"capacity,omitempty" description:"resource capacity of a node represented as a map of resource name to quantity of resource"`
|
||||
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node
|
||||
NodeSystemInfo `json:",inline,omitempty" description:"node identity is a set of ids/uuids to uniquely identify the node"`
|
||||
}
|
||||
|
||||
// Described the current lifecycle phase of a node.
|
||||
|
@ -819,6 +819,14 @@ type NodeSpec struct {
|
||||
ExternalID string `json:"externalID,omitempty" description:"external ID assigned to the node by some machine database (e.g. a cloud provider)"`
|
||||
}
|
||||
|
||||
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node.
|
||||
type NodeSystemInfo struct {
|
||||
// MachineID is the machine-id reported by the node
|
||||
MachineID string `json:"machineID"`
|
||||
// SystemUUID is the system-uuid reported by the node
|
||||
SystemUUID string `json:"systemUUID"`
|
||||
}
|
||||
|
||||
// NodeStatus is information about the current status of a node.
|
||||
type NodeStatus struct {
|
||||
// NodePhase is the current lifecycle phase of the node.
|
||||
@ -827,6 +835,8 @@ type NodeStatus struct {
|
||||
Conditions []NodeCondition `json:"conditions,omitempty" description:"list of node conditions observed"`
|
||||
// Queried from cloud provider, if available.
|
||||
Addresses []NodeAddress `json:"addresses,omitempty" description:"list of addresses reachable to the node"`
|
||||
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node
|
||||
NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty"`
|
||||
}
|
||||
|
||||
// NodeInfo is the information collected on the node.
|
||||
@ -834,6 +844,8 @@ type NodeInfo struct {
|
||||
TypeMeta `json:",inline"`
|
||||
// Capacity represents the available resources of a node
|
||||
Capacity ResourceList `json:"capacity,omitempty"`
|
||||
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node
|
||||
NodeSystemInfo `json:",inline,omitempty"`
|
||||
}
|
||||
|
||||
type NodePhase string
|
||||
|
@ -329,6 +329,7 @@ func (s *NodeController) updateNodeInfo(node *api.Node) error {
|
||||
for key, value := range nodeInfo.Capacity {
|
||||
node.Spec.Capacity[key] = value
|
||||
}
|
||||
node.Status.NodeInfo = nodeInfo.NodeSystemInfo
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -361,6 +361,10 @@ func (s *Server) handleNodeInfoVersioned(w http.ResponseWriter, req *http.Reques
|
||||
}
|
||||
data, err := json.Marshal(api.NodeInfo{
|
||||
Capacity: capacity,
|
||||
NodeSystemInfo: api.NodeSystemInfo{
|
||||
MachineID: info.MachineID,
|
||||
SystemUUID: info.SystemUUID,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
s.error(w, err)
|
||||
|
Loading…
Reference in New Issue
Block a user