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
13881388
13891389 for _ , pod := range podInfos {
13901390 // omit not managed pods
1391- _ , _ , err := kubecontainer .ParsePodFullName (pod .PodName )
1391+ podName , podNamespace , err := kubecontainer .ParsePodFullName (pod .PodName )
13921392 if err != nil {
13931393 continue
13941394 }
@@ -1423,6 +1423,22 @@ func (r *runtime) GarbageCollect(gcPolicy kubecontainer.ContainerGCPolicy) error
14231423 glog .Warningf ("Hyper GarbageCollect: remove pod %s failed, error: %s" , pod .PodID , err )
14241424 return err
14251425 }
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+ }
14261442 }
14271443 }
14281444
You can’t perform that action at this time.
0 commit comments