mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
addressing comments.
This commit is contained in:
parent
c0d116c419
commit
1ae1a19e7b
@ -184,7 +184,7 @@ func (gcc *PodGCController) gcOrphaned(pods []*api.Pod) {
|
||||
if err := gcc.deletePod(pod.Namespace, pod.Name); err != nil {
|
||||
utilruntime.HandleError(err)
|
||||
} else {
|
||||
glog.V(4).Infof("Forced deletion of orphaned Pod %s succeeded", pod.Name)
|
||||
glog.V(0).Infof("Forced deletion of orphaned Pod %s succeeded", pod.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -194,11 +194,7 @@ func (gcc *PodGCController) gcUnscheduledTerminating(pods []*api.Pod) {
|
||||
glog.V(4).Infof("GC'ing unscheduled pods which are terminating.")
|
||||
|
||||
for _, pod := range pods {
|
||||
if pod.DeletionTimestamp == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if len(pod.Spec.NodeName) > 0 {
|
||||
if pod.DeletionTimestamp == nil || len(pod.Spec.NodeName) > 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -206,7 +202,7 @@ func (gcc *PodGCController) gcUnscheduledTerminating(pods []*api.Pod) {
|
||||
if err := gcc.deletePod(pod.Namespace, pod.Name); err != nil {
|
||||
utilruntime.HandleError(err)
|
||||
} else {
|
||||
glog.V(4).Infof("Forced deletion of unscheduled terminating Pod %s succeeded", pod.Name)
|
||||
glog.V(0).Infof("Forced deletion of unscheduled terminating Pod %s succeeded", pod.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,10 +226,12 @@ func TestGCUnscheduledTerminating(t *testing.T) {
|
||||
}
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
pods []nameToPhase
|
||||
deletedPodNames sets.String
|
||||
}{
|
||||
{
|
||||
name: "Unscheduled pod in any phase must be deleted",
|
||||
pods: []nameToPhase{
|
||||
{name: "a", phase: api.PodFailed, deletionTimeStamp: &unversioned.Time{}, nodeName: ""},
|
||||
{name: "b", phase: api.PodSucceeded, deletionTimeStamp: &unversioned.Time{}, nodeName: ""},
|
||||
@ -238,6 +240,7 @@ func TestGCUnscheduledTerminating(t *testing.T) {
|
||||
deletedPodNames: sets.NewString("a", "b", "c"),
|
||||
},
|
||||
{
|
||||
name: "Scheduled pod in any phase must not be deleted",
|
||||
pods: []nameToPhase{
|
||||
{name: "a", phase: api.PodFailed, deletionTimeStamp: nil, nodeName: ""},
|
||||
{name: "b", phase: api.PodSucceeded, deletionTimeStamp: nil, nodeName: "node"},
|
||||
@ -292,7 +295,7 @@ func TestGCUnscheduledTerminating(t *testing.T) {
|
||||
pass = false
|
||||
}
|
||||
if !pass {
|
||||
t.Errorf("[%v]pod's deleted expected and actual did not match.\n\texpected: %v\n\tactual: %v", i, test.deletedPodNames, deletedPodNames)
|
||||
t.Errorf("[%v]pod's deleted expected and actual did not match.\n\texpected: %v\n\tactual: %v, test: %v", i, test.deletedPodNames, deletedPodNames, test.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user