mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +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"`
|
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.
|
// NodeStatus is information about the current status of a node.
|
||||||
type NodeStatus struct {
|
type NodeStatus struct {
|
||||||
// NodePhase is the current lifecycle phase of the node.
|
// NodePhase is the current lifecycle phase of the node.
|
||||||
@ -796,6 +804,8 @@ type NodeStatus struct {
|
|||||||
Conditions []NodeCondition `json:"conditions,omitempty"`
|
Conditions []NodeCondition `json:"conditions,omitempty"`
|
||||||
// Queried from cloud provider, if available.
|
// Queried from cloud provider, if available.
|
||||||
Addresses []NodeAddress `json:"addresses,omitempty"`
|
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.
|
// NodeInfo is the information collected on the node.
|
||||||
@ -803,6 +813,8 @@ type NodeInfo struct {
|
|||||||
TypeMeta `json:",inline"`
|
TypeMeta `json:",inline"`
|
||||||
// Capacity represents the available resources of a node
|
// Capacity represents the available resources of a node
|
||||||
Capacity ResourceList `json:"capacity,omitempty"`
|
Capacity ResourceList `json:"capacity,omitempty"`
|
||||||
|
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node
|
||||||
|
NodeSystemInfo `json:",inline,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type NodePhase string
|
type NodePhase string
|
||||||
|
@ -699,6 +699,9 @@ func init() {
|
|||||||
if err := s.Convert(&in.Status.Addresses, &out.Status.Addresses, 0); err != nil {
|
if err := s.Convert(&in.Status.Addresses, &out.Status.Addresses, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := s.Convert(&in.Status.NodeInfo, &out.Status.NodeInfo, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
for _, address := range in.Status.Addresses {
|
for _, address := range in.Status.Addresses {
|
||||||
if address.Type == newer.NodeLegacyHostIP {
|
if address.Type == newer.NodeLegacyHostIP {
|
||||||
@ -728,6 +731,9 @@ func init() {
|
|||||||
if err := s.Convert(&in.Status.Addresses, &out.Status.Addresses, 0); err != nil {
|
if err := s.Convert(&in.Status.Addresses, &out.Status.Addresses, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := s.Convert(&in.Status.NodeInfo, &out.Status.NodeInfo, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if in.HostIP != "" {
|
if in.HostIP != "" {
|
||||||
newer.AddToNodeAddresses(&out.Status.Addresses,
|
newer.AddToNodeAddresses(&out.Status.Addresses,
|
||||||
|
@ -618,6 +618,14 @@ type EndpointsList struct {
|
|||||||
Items []Endpoints `json:"items" description:"list of service endpoint lists"`
|
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.
|
// NodeStatus is information about the current status of a node.
|
||||||
type NodeStatus struct {
|
type NodeStatus struct {
|
||||||
// NodePhase is the current lifecycle phase of the node.
|
// 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"`
|
Conditions []NodeCondition `json:"conditions,omitempty" description:"conditions is an array of current node conditions"`
|
||||||
// Queried from cloud provider, if available.
|
// Queried from cloud provider, if available.
|
||||||
Addresses []NodeAddress `json:"addresses,omitempty" description:"list of addresses reachable to the node"`
|
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.
|
// NodeInfo is the information collected on the node.
|
||||||
@ -633,6 +643,8 @@ type NodeInfo struct {
|
|||||||
TypeMeta `json:",inline"`
|
TypeMeta `json:",inline"`
|
||||||
// Capacity represents the available resources.
|
// 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"`
|
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
|
type NodePhase string
|
||||||
|
@ -619,6 +619,9 @@ func init() {
|
|||||||
if err := s.Convert(&in.Status.Addresses, &out.Status.Addresses, 0); err != nil {
|
if err := s.Convert(&in.Status.Addresses, &out.Status.Addresses, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := s.Convert(&in.Status.NodeInfo, &out.Status.NodeInfo, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
for _, address := range in.Status.Addresses {
|
for _, address := range in.Status.Addresses {
|
||||||
if address.Type == newer.NodeLegacyHostIP {
|
if address.Type == newer.NodeLegacyHostIP {
|
||||||
@ -648,6 +651,9 @@ func init() {
|
|||||||
if err := s.Convert(&in.Status.Addresses, &out.Status.Addresses, 0); err != nil {
|
if err := s.Convert(&in.Status.Addresses, &out.Status.Addresses, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := s.Convert(&in.Status.NodeInfo, &out.Status.NodeInfo, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if in.HostIP != "" {
|
if in.HostIP != "" {
|
||||||
newer.AddToNodeAddresses(&out.Status.Addresses,
|
newer.AddToNodeAddresses(&out.Status.Addresses,
|
||||||
|
@ -623,6 +623,14 @@ type EndpointsList struct {
|
|||||||
Items []Endpoints `json:"items" description:"list of service endpoint lists"`
|
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.
|
// NodeStatus is information about the current status of a node.
|
||||||
//
|
//
|
||||||
// https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/node.md#node-status
|
// 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"`
|
Conditions []NodeCondition `json:"conditions,omitempty" description:"conditions is an array of current node conditions"`
|
||||||
// Queried from cloud provider, if available.
|
// Queried from cloud provider, if available.
|
||||||
Addresses []NodeAddress `json:"addresses,omitempty" description:"list of addresses reachable to the node"`
|
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.
|
// NodeInfo is the information collected on the node.
|
||||||
@ -640,6 +650,8 @@ type NodeInfo struct {
|
|||||||
TypeMeta `json:",inline"`
|
TypeMeta `json:",inline"`
|
||||||
// Capacity represents the available resources.
|
// 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"`
|
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.
|
// 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)"`
|
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.
|
// NodeStatus is information about the current status of a node.
|
||||||
type NodeStatus struct {
|
type NodeStatus struct {
|
||||||
// NodePhase is the current lifecycle phase of the node.
|
// 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"`
|
Conditions []NodeCondition `json:"conditions,omitempty" description:"list of node conditions observed"`
|
||||||
// Queried from cloud provider, if available.
|
// Queried from cloud provider, if available.
|
||||||
Addresses []NodeAddress `json:"addresses,omitempty" description:"list of addresses reachable to the node"`
|
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.
|
// NodeInfo is the information collected on the node.
|
||||||
@ -834,6 +844,8 @@ type NodeInfo struct {
|
|||||||
TypeMeta `json:",inline"`
|
TypeMeta `json:",inline"`
|
||||||
// Capacity represents the available resources of a node
|
// Capacity represents the available resources of a node
|
||||||
Capacity ResourceList `json:"capacity,omitempty"`
|
Capacity ResourceList `json:"capacity,omitempty"`
|
||||||
|
// NodeSystemInfo is a set of ids/uuids to uniquely identify the node
|
||||||
|
NodeSystemInfo `json:",inline,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type NodePhase string
|
type NodePhase string
|
||||||
|
@ -329,6 +329,7 @@ func (s *NodeController) updateNodeInfo(node *api.Node) error {
|
|||||||
for key, value := range nodeInfo.Capacity {
|
for key, value := range nodeInfo.Capacity {
|
||||||
node.Spec.Capacity[key] = value
|
node.Spec.Capacity[key] = value
|
||||||
}
|
}
|
||||||
|
node.Status.NodeInfo = nodeInfo.NodeSystemInfo
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,6 +361,10 @@ func (s *Server) handleNodeInfoVersioned(w http.ResponseWriter, req *http.Reques
|
|||||||
}
|
}
|
||||||
data, err := json.Marshal(api.NodeInfo{
|
data, err := json.Marshal(api.NodeInfo{
|
||||||
Capacity: capacity,
|
Capacity: capacity,
|
||||||
|
NodeSystemInfo: api.NodeSystemInfo{
|
||||||
|
MachineID: info.MachineID,
|
||||||
|
SystemUUID: info.SystemUUID,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.error(w, err)
|
s.error(w, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user