Skip to content

Commit

Permalink
Merge pull request kubernetes#34803 from gmarek/automated-cherry-pick…
Browse files Browse the repository at this point in the history
…-of-#34694-upstream-release-1.4

Automatic merge from submit-queue

Automated cherry pick of kubernetes#34694

Cherry pick of kubernetes#34694 on release-1.4.

kubernetes#34694: Handle DeletedFinalStateUnknown in NodeController
  • Loading branch information
Kubernetes Submit Queue authored Oct 14, 2016
2 parents 782bc55 + a3c0bdf commit cc0b62c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions pkg/controller/node/nodecontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,21 @@ func NewNodeController(
}
},
DeleteFunc: func(obj interface{}) {
node := obj.(*api.Node)
err := nc.cidrAllocator.ReleaseCIDR(node)
if err != nil {
node, isNode := obj.(*api.Node)
// We can get DeletedFinalStateUnknown instead of *api.Node here and we need to handle that correctly. #34692
if !isNode {
deletedState, ok := obj.(cache.DeletedFinalStateUnknown)
if !ok {
glog.Errorf("Received unexpected object: %v", obj)
return
}
node, ok = deletedState.Obj.(*api.Node)
if !ok {
glog.Errorf("DeletedFinalStateUnknown contained non-Node object: %v", deletedState.Obj)
return
}
}
if err := nc.cidrAllocator.ReleaseCIDR(node); err != nil {
glog.Errorf("Error releasing CIDR: %v", err)
}
},
Expand Down

0 comments on commit cc0b62c

Please sign in to comment.