mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
Merge pull request #2315 from ddysher/node-status
Add node status to API object.
This commit is contained in:
commit
ecbb6c45d0
@ -658,6 +658,54 @@ type NodeSpec struct {
|
|||||||
type NodeStatus struct {
|
type NodeStatus struct {
|
||||||
// Queried from cloud provider, if available.
|
// Queried from cloud provider, if available.
|
||||||
HostIP string `json:"hostIP,omitempty"`
|
HostIP string `json:"hostIP,omitempty"`
|
||||||
|
// NodePhase is the current lifecycle phase of the node.
|
||||||
|
Phase NodePhase `json:"phase,omitempty"`
|
||||||
|
// Conditions is an array of current node conditions.
|
||||||
|
Conditions []NodeCondition `json:"conditions,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type NodePhase string
|
||||||
|
|
||||||
|
// These are the valid phases of node.
|
||||||
|
const (
|
||||||
|
// NodePending means the node has been created/added by the system, but not configured.
|
||||||
|
NodePending NodePhase = "Pending"
|
||||||
|
// NodeRunning means the node has been configured and has Kubernetes components running.
|
||||||
|
NodeRunning NodePhase = "Running"
|
||||||
|
// NodeTerminated means the node has been removed from the cluster.
|
||||||
|
NodeTerminated NodePhase = "Terminated"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NodeConditionKind string
|
||||||
|
|
||||||
|
// These are valid conditions of node. Currently, we don't have enough information to decide
|
||||||
|
// node condition. In the future, we will add more. The proposed set of conditions are:
|
||||||
|
// NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable.
|
||||||
|
const (
|
||||||
|
// NodeReachable means the node can be reached (in the sense of HTTP connection) from node controller.
|
||||||
|
NodeReachable NodeConditionKind = "Reachable"
|
||||||
|
// NodeReady means the node returns StatusOK for HTTP health check.
|
||||||
|
NodeReady NodeConditionKind = "Ready"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NodeConditionStatus string
|
||||||
|
|
||||||
|
// These are valid condition status. "ConditionFull" means node is in the condition;
|
||||||
|
// "ConditionNone" means node is not in the condition; "ConditionUnknown" means kubernetes
|
||||||
|
// can't decide if node is in the condition or not. In the future, we could add other
|
||||||
|
// intermediate conditions, e.g. ConditionDegraded.
|
||||||
|
const (
|
||||||
|
ConditionFull NodeConditionStatus = "Full"
|
||||||
|
ConditionNone NodeConditionStatus = "None"
|
||||||
|
ConditionUnknown NodeConditionStatus = "Unknown"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NodeCondition struct {
|
||||||
|
Kind NodeConditionKind `json:"kind"`
|
||||||
|
Status NodeConditionStatus `json:"status"`
|
||||||
|
LastTransitionTime util.Time `json:"lastTransitionTime,omitempty"`
|
||||||
|
Reason string `json:"reason,omitempty"`
|
||||||
|
Message string `json:"message,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeResources is an object for conveying resource information about a node.
|
// NodeResources is an object for conveying resource information about a node.
|
||||||
|
@ -454,6 +454,12 @@ func init() {
|
|||||||
if err := s.Convert(&in.ObjectMeta.Labels, &out.Labels, 0); err != nil {
|
if err := s.Convert(&in.ObjectMeta.Labels, &out.Labels, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := s.Convert(&in.Status.Phase, &out.Status.Phase, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.Convert(&in.Status.Conditions, &out.Status.Conditions, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
out.HostIP = in.Status.HostIP
|
out.HostIP = in.Status.HostIP
|
||||||
return s.Convert(&in.Spec.Capacity, &out.NodeResources.Capacity, 0)
|
return s.Convert(&in.Spec.Capacity, &out.NodeResources.Capacity, 0)
|
||||||
@ -468,6 +474,12 @@ func init() {
|
|||||||
if err := s.Convert(&in.Labels, &out.ObjectMeta.Labels, 0); err != nil {
|
if err := s.Convert(&in.Labels, &out.ObjectMeta.Labels, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := s.Convert(&in.Status.Phase, &out.Status.Phase, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.Convert(&in.Status.Conditions, &out.Status.Conditions, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
out.Status.HostIP = in.HostIP
|
out.Status.HostIP = in.HostIP
|
||||||
return s.Convert(&in.NodeResources.Capacity, &out.Spec.Capacity, 0)
|
return s.Convert(&in.NodeResources.Capacity, &out.Spec.Capacity, 0)
|
||||||
|
@ -496,6 +496,58 @@ type EndpointsList struct {
|
|||||||
Items []Endpoints `json:"items" description:"list of service endpoint lists"`
|
Items []Endpoints `json:"items" description:"list of service endpoint lists"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NodeStatus is information about the current status of a node.
|
||||||
|
type NodeStatus struct {
|
||||||
|
// NodePhase is the current lifecycle phase of the node.
|
||||||
|
Phase NodePhase `json:"phase,omitempty" description:"node phase is the current lifecycle phase of the node"`
|
||||||
|
// Conditions is an array of current node conditions.
|
||||||
|
Conditions []NodeCondition `json:"conditions,omitempty" description:"conditions is an array of current node conditions"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type NodePhase string
|
||||||
|
|
||||||
|
// These are the valid phases of node.
|
||||||
|
const (
|
||||||
|
// NodePending means the node has been created/added by the system, but not configured.
|
||||||
|
NodePending NodePhase = "Pending"
|
||||||
|
// NodeRunning means the node has been configured and has Kubernetes components running.
|
||||||
|
NodeRunning NodePhase = "Running"
|
||||||
|
// NodeTerminated means the node has been removed from the cluster.
|
||||||
|
NodeTerminated NodePhase = "Terminated"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NodeConditionKind string
|
||||||
|
|
||||||
|
// These are valid conditions of node. Currently, we don't have enough information to decide
|
||||||
|
// node condition. In the future, we will add more. The proposed set of conditions are:
|
||||||
|
// NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable.
|
||||||
|
const (
|
||||||
|
// NodeReachable means the node can be reached (in the sense of HTTP connection) from node controller.
|
||||||
|
NodeReachable NodeConditionKind = "Reachable"
|
||||||
|
// NodeReady means the node returns StatusOK for HTTP health check.
|
||||||
|
NodeReady NodeConditionKind = "Ready"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NodeConditionStatus string
|
||||||
|
|
||||||
|
// These are valid condition status. "ConditionFull" means node is in the condition;
|
||||||
|
// "ConditionNone" means node is not in the condition; "ConditionUnknown" means kubernetes
|
||||||
|
// can't decide if node is in the condition or not. In the future, we could add other
|
||||||
|
// intermediate conditions, e.g. ConditionDegraded.
|
||||||
|
const (
|
||||||
|
ConditionFull NodeConditionStatus = "Full"
|
||||||
|
ConditionNone NodeConditionStatus = "None"
|
||||||
|
ConditionUnknown NodeConditionStatus = "Unknown"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NodeCondition struct {
|
||||||
|
Kind NodeConditionKind `json:"kind" description:"kind of the condition, one of reachable, ready"`
|
||||||
|
Status NodeConditionStatus `json:"status" description:"status of the condition, one of full, none, unknown"`
|
||||||
|
LastTransitionTime util.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"`
|
||||||
|
Reason string `json:"reason,omitempty" description:"(brief) reason for the condition's last transition"`
|
||||||
|
Message string `json:"message,omitempty" description:"human readable message indicating details about last transition"`
|
||||||
|
}
|
||||||
|
|
||||||
// NodeResources represents resources on a Kubernetes system node
|
// NodeResources represents resources on a Kubernetes system node
|
||||||
// see https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/resources.md for more details.
|
// see https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/resources.md for more details.
|
||||||
type NodeResources struct {
|
type NodeResources struct {
|
||||||
@ -515,6 +567,8 @@ type Minion struct {
|
|||||||
HostIP string `json:"hostIP,omitempty" description:"IP address of the node"`
|
HostIP string `json:"hostIP,omitempty" description:"IP address of the node"`
|
||||||
// Resources available on the node
|
// Resources available on the node
|
||||||
NodeResources NodeResources `json:"resources,omitempty" description:"characterization of node resources"`
|
NodeResources NodeResources `json:"resources,omitempty" description:"characterization of node resources"`
|
||||||
|
// Status describes the current status of a node
|
||||||
|
Status NodeStatus `json:"status,omitempty" description:"current status of node"`
|
||||||
// Labels for the node
|
// Labels for the node
|
||||||
Labels map[string]string `json:"labels,omitempty" description:"map of string keys and values that can be used to organize and categorize minions; labels of a minion assigned by the scheduler must match the scheduled pod's nodeSelector"`
|
Labels map[string]string `json:"labels,omitempty" description:"map of string keys and values that can be used to organize and categorize minions; labels of a minion assigned by the scheduler must match the scheduled pod's nodeSelector"`
|
||||||
}
|
}
|
||||||
|
@ -384,6 +384,12 @@ func init() {
|
|||||||
if err := s.Convert(&in.ObjectMeta.Labels, &out.Labels, 0); err != nil {
|
if err := s.Convert(&in.ObjectMeta.Labels, &out.Labels, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := s.Convert(&in.Status.Phase, &out.Status.Phase, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.Convert(&in.Status.Conditions, &out.Status.Conditions, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
out.HostIP = in.Status.HostIP
|
out.HostIP = in.Status.HostIP
|
||||||
return s.Convert(&in.Spec.Capacity, &out.NodeResources.Capacity, 0)
|
return s.Convert(&in.Spec.Capacity, &out.NodeResources.Capacity, 0)
|
||||||
@ -398,6 +404,12 @@ func init() {
|
|||||||
if err := s.Convert(&in.Labels, &out.ObjectMeta.Labels, 0); err != nil {
|
if err := s.Convert(&in.Labels, &out.ObjectMeta.Labels, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := s.Convert(&in.Status.Phase, &out.Status.Phase, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.Convert(&in.Status.Conditions, &out.Status.Conditions, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
out.Status.HostIP = in.HostIP
|
out.Status.HostIP = in.HostIP
|
||||||
return s.Convert(&in.NodeResources.Capacity, &out.Spec.Capacity, 0)
|
return s.Convert(&in.NodeResources.Capacity, &out.Spec.Capacity, 0)
|
||||||
|
@ -461,6 +461,58 @@ type EndpointsList struct {
|
|||||||
Items []Endpoints `json:"items" description:"list of service endpoint lists"`
|
Items []Endpoints `json:"items" description:"list of service endpoint lists"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NodeStatus is information about the current status of a node.
|
||||||
|
type NodeStatus struct {
|
||||||
|
// NodePhase is the current lifecycle phase of the node.
|
||||||
|
Phase NodePhase `json:"phase,omitempty" description:"node phase is the current lifecycle phase of the node"`
|
||||||
|
// Conditions is an array of current node conditions.
|
||||||
|
Conditions []NodeCondition `json:"conditions,omitempty" description:"conditions is an array of current node conditions"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type NodePhase string
|
||||||
|
|
||||||
|
// These are the valid phases of node.
|
||||||
|
const (
|
||||||
|
// NodePending means the node has been created/added by the system, but not configured.
|
||||||
|
NodePending NodePhase = "Pending"
|
||||||
|
// NodeRunning means the node has been configured and has Kubernetes components running.
|
||||||
|
NodeRunning NodePhase = "Running"
|
||||||
|
// NodeTerminated means the node has been removed from the cluster.
|
||||||
|
NodeTerminated NodePhase = "Terminated"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NodeConditionKind string
|
||||||
|
|
||||||
|
// These are valid conditions of node. Currently, we don't have enough information to decide
|
||||||
|
// node condition. In the future, we will add more. The proposed set of conditions are:
|
||||||
|
// NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable.
|
||||||
|
const (
|
||||||
|
// NodeReachable means the node can be reached (in the sense of HTTP connection) from node controller.
|
||||||
|
NodeReachable NodeConditionKind = "Reachable"
|
||||||
|
// NodeReady means the node returns StatusOK for HTTP health check.
|
||||||
|
NodeReady NodeConditionKind = "Ready"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NodeConditionStatus string
|
||||||
|
|
||||||
|
// These are valid condition status. "ConditionFull" means node is in the condition;
|
||||||
|
// "ConditionNone" means node is not in the condition; "ConditionUnknown" means kubernetes
|
||||||
|
// can't decide if node is in the condition or not. In the future, we could add other
|
||||||
|
// intermediate conditions, e.g. ConditionDegraded.
|
||||||
|
const (
|
||||||
|
ConditionFull NodeConditionStatus = "Full"
|
||||||
|
ConditionNone NodeConditionStatus = "None"
|
||||||
|
ConditionUnknown NodeConditionStatus = "Unknown"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NodeCondition struct {
|
||||||
|
Kind NodeConditionKind `json:"kind" description:"kind of the condition, one of reachable, ready"`
|
||||||
|
Status NodeConditionStatus `json:"status" description:"status of the condition, one of full, none, unknown"`
|
||||||
|
LastTransitionTime util.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"`
|
||||||
|
Reason string `json:"reason,omitempty" description:"(brief) reason for the condition's last transition"`
|
||||||
|
Message string `json:"message,omitempty" description:"human readable message indicating details about last transition"`
|
||||||
|
}
|
||||||
|
|
||||||
// NodeResources represents resources on a Kubernetes system node
|
// NodeResources represents resources on a Kubernetes system node
|
||||||
// see https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/resources.md for more details.
|
// see https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/resources.md for more details.
|
||||||
type NodeResources struct {
|
type NodeResources struct {
|
||||||
@ -480,6 +532,8 @@ type Minion struct {
|
|||||||
HostIP string `json:"hostIP,omitempty" description:"IP address of the node"`
|
HostIP string `json:"hostIP,omitempty" description:"IP address of the node"`
|
||||||
// Resources available on the node
|
// Resources available on the node
|
||||||
NodeResources NodeResources `json:"resources,omitempty" description:"characterization of node resources"`
|
NodeResources NodeResources `json:"resources,omitempty" description:"characterization of node resources"`
|
||||||
|
// Status describes the current status of a node
|
||||||
|
Status NodeStatus `json:"status,omitempty" description:"current status of node"`
|
||||||
// Labels for the node
|
// Labels for the node
|
||||||
Labels map[string]string `json:"labels,omitempty" description:"map of string keys and values that can be used to organize and categorize minions; labels of a minion assigned by the scheduler must match the scheduled pod's nodeSelector"`
|
Labels map[string]string `json:"labels,omitempty" description:"map of string keys and values that can be used to organize and categorize minions; labels of a minion assigned by the scheduler must match the scheduled pod's nodeSelector"`
|
||||||
}
|
}
|
||||||
|
@ -678,6 +678,54 @@ type NodeSpec struct {
|
|||||||
type NodeStatus struct {
|
type NodeStatus struct {
|
||||||
// Queried from cloud provider, if available.
|
// Queried from cloud provider, if available.
|
||||||
HostIP string `json:"hostIP,omitempty"`
|
HostIP string `json:"hostIP,omitempty"`
|
||||||
|
// NodePhase is the current lifecycle phase of the node.
|
||||||
|
Phase NodePhase `json:"phase,omitempty"`
|
||||||
|
// Conditions is an array of current node conditions.
|
||||||
|
Conditions []NodeCondition `json:"conditions,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type NodePhase string
|
||||||
|
|
||||||
|
// These are the valid phases of node.
|
||||||
|
const (
|
||||||
|
// NodePending means the node has been created/added by the system, but not configured.
|
||||||
|
NodePending NodePhase = "Pending"
|
||||||
|
// NodeRunning means the node has been configured and has Kubernetes components running.
|
||||||
|
NodeRunning NodePhase = "Running"
|
||||||
|
// NodeTerminated means the node has been removed from the cluster.
|
||||||
|
NodeTerminated NodePhase = "Terminated"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NodeConditionKind string
|
||||||
|
|
||||||
|
// These are valid conditions of node. Currently, we don't have enough information to decide
|
||||||
|
// node condition. In the future, we will add more. The proposed set of conditions are:
|
||||||
|
// NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable.
|
||||||
|
const (
|
||||||
|
// NodeReachable means the node can be reached (in the sense of HTTP connection) from node controller.
|
||||||
|
NodeReachable NodeConditionKind = "Reachable"
|
||||||
|
// NodeReady means the node returns StatusOK for HTTP health check.
|
||||||
|
NodeReady NodeConditionKind = "Ready"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NodeConditionStatus string
|
||||||
|
|
||||||
|
// These are valid condition status. "ConditionFull" means node is in the condition;
|
||||||
|
// "ConditionNone" means node is not in the condition; "ConditionUnknown" means kubernetes
|
||||||
|
// can't decide if node is in the condition or not. In the future, we could add other
|
||||||
|
// intermediate conditions, e.g. ConditionDegraded.
|
||||||
|
const (
|
||||||
|
ConditionFull NodeConditionStatus = "Full"
|
||||||
|
ConditionNone NodeConditionStatus = "None"
|
||||||
|
ConditionUnknown NodeConditionStatus = "Unknown"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NodeCondition struct {
|
||||||
|
Kind NodeConditionKind `json:"kind"`
|
||||||
|
Status NodeConditionStatus `json:"status"`
|
||||||
|
LastTransitionTime util.Time `json:"lastTransitionTime,omitempty"`
|
||||||
|
Reason string `json:"reason,omitempty"`
|
||||||
|
Message string `json:"message,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResourceName string
|
type ResourceName string
|
||||||
|
Loading…
Reference in New Issue
Block a user