Skip to content

Commit

Permalink
Merge branch 'master' into kb_861
Browse files Browse the repository at this point in the history
  • Loading branch information
k82cn authored Jun 10, 2019
2 parents 819e30a + bd953b0 commit dee487f
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 dee487f

Please sign in to comment.