Skip to content

Commit

Permalink
Invoke node Update only for providerID changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chethanv28 committed Jan 30, 2020
1 parent 5089225 commit e587dc5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pkg/csi/service/cns/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,20 @@ func (nodes *Nodes) nodeAdd(obj interface{}) {
}

func (nodes *Nodes) nodeUpdate(oldObj interface{}, newObj interface{}) {
nodes.nodeRegister(newObj)
newNode, ok := newObj.(*v1.Node)
if !ok {
klog.Warningf("nodeUpdate: unrecognized object newObj %[1]T%+[1]v", newObj)
return
}
oldNode, ok := oldObj.(*v1.Node)
if !ok {
klog.Warningf("nodeUpdate: unrecognized object oldObj %[1]T%+[1]v", oldObj)
return
}
if oldNode.Spec.ProviderID != newNode.Spec.ProviderID {
klog.V(2).Infof("nodeUpdate: Observed ProviderID change from %q to %q for the node: %q", oldNode.Spec.ProviderID, newNode.Spec.ProviderID, newNode.Name)
nodes.nodeRegister(newObj)
}
}

func (nodes *Nodes) nodeRegister(obj interface{}) {
Expand Down

0 comments on commit e587dc5

Please sign in to comment.