Merge pull request #61925 from hanxiaoshuai/fixtodo03301

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

use handle DeletedFinalStateUnknown objects in function deleteNode

**What this PR does / why we need it**:
fixtodo:ensure len(nodeName) > 0 in function deleteNode
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2018-03-30 01:09:35 -07:00 committed by GitHub
commit acd435c578
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,9 +114,14 @@ func (g *graphPopulator) updateNode(oldObj, obj interface{}) {
}
func (g *graphPopulator) deleteNode(obj interface{}) {
node := obj.(*api.Node)
// TODO(mtaufen): ensure len(nodeName) > 0 in all cases (would sure be nice to have a dependently-typed language here...)
if tombstone, ok := obj.(cache.DeletedFinalStateUnknown); ok {
obj = tombstone.Obj
}
node, ok := obj.(*api.Node)
if !ok {
glog.Infof("unexpected type %T", obj)
return
}
// NOTE: We don't remove the node, because if the node is re-created not all pod -> node
// links are re-established (we don't get relevant events because the no mutations need