Skip to content

Commit

Permalink
Merge pull request #132 from chethanv28/fix_node_register
Browse files Browse the repository at this point in the history
Invoke node Update only for providerID changes
  • Loading branch information
k8s-ci-robot authored Jan 30, 2020
2 parents 5089225 + e587dc5 commit b29317d
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 b29317d

Please sign in to comment.