mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-30 02:38:17 +08:00
[REV] optimize node status
This commit is contained in:
parent
f91a2749d5
commit
37366342c2
@ -77,15 +77,23 @@ func GetNodes(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _,v:=range nodes {
|
for _,v:=range nodes {
|
||||||
if v.NodeStatus!=nil{
|
handleStatus(v)
|
||||||
for _,condiction:=range v.Conditions{
|
}
|
||||||
|
httputil.ReturnSuccess(r, w, nodes)
|
||||||
|
}
|
||||||
|
|
||||||
|
func handleStatus(v *model.HostNode){
|
||||||
|
if v.NodeStatus!=nil{
|
||||||
|
for _,condiction:=range v.Conditions{
|
||||||
|
if v.Status == "unschedulable" {
|
||||||
|
|
||||||
|
}else{
|
||||||
if condiction.Type=="Ready"&&condiction.Status=="True" {
|
if condiction.Type=="Ready"&&condiction.Status=="True" {
|
||||||
v.Status="running"
|
v.Status="running"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
httputil.ReturnSuccess(r, w, nodes)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//GetNode 获取一个节点详情
|
//GetNode 获取一个节点详情
|
||||||
|
@ -124,6 +124,11 @@ func (n *NodeService) CordonNode(nodeID string, unschedulable bool) *utils.APIHa
|
|||||||
//更新节点状态
|
//更新节点状态
|
||||||
hostNode.Unschedulable = unschedulable
|
hostNode.Unschedulable = unschedulable
|
||||||
//k8s节点存在
|
//k8s节点存在
|
||||||
|
if unschedulable {
|
||||||
|
hostNode.Status="unschedulable"
|
||||||
|
}else{
|
||||||
|
hostNode.Status="schedulable"
|
||||||
|
}
|
||||||
if hostNode.NodeStatus != nil {
|
if hostNode.NodeStatus != nil {
|
||||||
//true表示drain,不可调度
|
//true表示drain,不可调度
|
||||||
node, err := k8s.CordonOrUnCordon(hostNode.ID, unschedulable)
|
node, err := k8s.CordonOrUnCordon(hostNode.ID, unschedulable)
|
||||||
|
Loading…
Reference in New Issue
Block a user