Skip to content

Commit

Permalink
Merge pull request volcano-sh#27 from asifdxtreme/master
Browse files Browse the repository at this point in the history
[Cherry Pick] update node info no matter what node info changed
  • Loading branch information
volcano-sh-bot committed Jun 10, 2019
2 parents 985cba0 + 410533d commit 5dd517e
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions pkg/scheduler/cache/event_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package cache

import (
"fmt"
"reflect"

"github.com/golang/glog"

Expand Down Expand Up @@ -269,19 +268,10 @@ func (sc *SchedulerCache) addNode(node *v1.Node) error {
return nil
}

func isNodeInfoUpdated(oldNode, newNode *v1.Node) bool {
return !reflect.DeepEqual(oldNode.Status.Allocatable, newNode.Status.Allocatable) ||
!reflect.DeepEqual(oldNode.Spec.Taints, newNode.Spec.Taints) ||
!reflect.DeepEqual(oldNode.Labels, newNode.Labels) ||
!reflect.DeepEqual(oldNode.Spec.Unschedulable, newNode.Spec.Unschedulable)
}

// Assumes that lock is already acquired.
func (sc *SchedulerCache) updateNode(oldNode, newNode *v1.Node) error {
if sc.Nodes[newNode.Name] != nil {
if isNodeInfoUpdated(oldNode, newNode) {
sc.Nodes[newNode.Name].SetNode(newNode)
}
sc.Nodes[newNode.Name].SetNode(newNode)
return nil
}

Expand Down

0 comments on commit 5dd517e

Please sign in to comment.