This repository was archived by the owner on Feb 8, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -1388,7 +1388,7 @@ func (r *runtime) GarbageCollect(gcPolicy kubecontainer.ContainerGCPolicy) error
1388
1388
1389
1389
for _ , pod := range podInfos {
1390
1390
// omit not managed pods
1391
- _ , _ , err := kubecontainer .ParsePodFullName (pod .PodName )
1391
+ podName , podNamespace , err := kubecontainer .ParsePodFullName (pod .PodName )
1392
1392
if err != nil {
1393
1393
continue
1394
1394
}
@@ -1423,6 +1423,22 @@ func (r *runtime) GarbageCollect(gcPolicy kubecontainer.ContainerGCPolicy) error
1423
1423
glog .Warningf ("Hyper GarbageCollect: remove pod %s failed, error: %s" , pod .PodID , err )
1424
1424
return err
1425
1425
}
1426
+
1427
+ // KillPod is only called for running Pods, we should teardown network here for non-running Pods
1428
+ err = r .networkPlugin .TearDownPod (podNamespace , podName , "" , "hyper" )
1429
+ if err != nil {
1430
+ glog .Warningf ("Hyper: networkPlugin.TearDownPod failed, error: %v" , err )
1431
+ }
1432
+
1433
+ // Delete pod spec file
1434
+ specFileName := path .Join (hyperPodSpecDir , pod .PodName )
1435
+ _ , err = os .Stat (specFileName )
1436
+ if err == nil {
1437
+ e := os .Remove (specFileName )
1438
+ if e != nil {
1439
+ glog .Warningf ("Hyper: delete spec file for %s failed, error: %v" , pod .PodName , e )
1440
+ }
1441
+ }
1426
1442
}
1427
1443
}
1428
1444
You can’t perform that action at this time.
0 commit comments