@@ -189,14 +189,14 @@ func (d *Helper) EvictPods(ctx context.Context, podDeleteList *PodDeleteList) Ev
189189 log = log .WithValues ("reason" , pd .Status .Message )
190190 }
191191
192- log .V (3 ).Info ("Skip evicting Pod because it should be ignored" )
192+ log .V (4 ).Info ("Skip evicting Pod because it should be ignored" )
193193 res .PodsIgnored = append (res .PodsIgnored , pd .Pod )
194194 }
195195
196196 for _ , pd := range podsWithDeletionTimestamp {
197197 log := ctrl .LoggerFrom (ctx , "Pod" , klog .KObj (pd .Pod ))
198198
199- log .V (3 ).Info ("Skip triggering Pod eviction because it already has a deletionTimestamp" )
199+ log .V (4 ).Info ("Skip triggering Pod eviction because it already has a deletionTimestamp" )
200200 res .PodsDeletionTimestampSet = append (res .PodsDeletionTimestampSet , pd .Pod )
201201 }
202202
@@ -212,22 +212,22 @@ evictionLoop:
212212 case <- ctx .Done ():
213213 // Skip eviction if the eviction timeout is reached.
214214 err := fmt .Errorf ("eviction timeout of %s reached, eviction will be retried" , evictionTimeout )
215- log .Error (err , "Error when evicting Pod" )
215+ log .V ( 4 ). Error (err , "Error when evicting Pod" )
216216 res .PodsFailedEviction [err .Error ()] = append (res .PodsFailedEviction [err .Error ()], pd .Pod )
217217 continue evictionLoop
218218 default :
219219 }
220220
221- log .Info ("Evicting Pod" )
221+ log .V ( 4 ). Info ("Evicting Pod" )
222222
223223 err := d .evictPod (ctx , pd .Pod )
224224 switch {
225225 case err == nil :
226- log .Info ("Pod eviction successfully triggered" )
226+ log .V ( 4 ). Info ("Pod eviction successfully triggered" )
227227 res .PodsDeletionTimestampSet = append (res .PodsDeletionTimestampSet , pd .Pod )
228228 case apierrors .IsNotFound (err ):
229229 // Pod doesn't exist anymore as it has been deleted in the meantime.
230- log .Info ("Eviction not needed, Pod doesn't exist anymore" )
230+ log .V ( 4 ). Info ("Eviction not needed, Pod doesn't exist anymore" )
231231 res .PodsNotFound = append (res .PodsNotFound , pd .Pod )
232232 case apierrors .IsTooManyRequests (err ):
233233 var statusError * apierrors.StatusError
@@ -247,17 +247,17 @@ evictionLoop:
247247 err = errors .New (errorMessage )
248248 }
249249
250- log .Error (err , "Error when evicting Pod" )
250+ log .V ( 4 ). Error (err , "Error when evicting Pod" )
251251 res .PodsFailedEviction [err .Error ()] = append (res .PodsFailedEviction [err .Error ()], pd .Pod )
252252 case apierrors .IsForbidden (err ) && apierrors .HasStatusCause (err , corev1 .NamespaceTerminatingCause ):
253253 // Creating an eviction resource in a terminating namespace will throw a forbidden error, e.g.:
254254 // "pods "pod-6-to-trigger-eviction-namespace-terminating" is forbidden: unable to create new content in namespace test-namespace because it is being terminated"
255255 // The kube-controller-manager is supposed to set the deletionTimestamp on the Pod and then this error will go away.
256256 msg := "Cannot evict pod from terminating namespace: unable to create eviction (kube-controller-manager should set deletionTimestamp)"
257- log .Error (err , msg )
257+ log .V ( 4 ). Error (err , msg )
258258 res .PodsFailedEviction [msg ] = append (res .PodsFailedEviction [msg ], pd .Pod )
259259 default :
260- log .Error (err , "Error when evicting Pod" )
260+ log .V ( 4 ). Error (err , "Error when evicting Pod" )
261261 res .PodsFailedEviction [err .Error ()] = append (res .PodsFailedEviction [err .Error ()], pd .Pod )
262262 }
263263 }
0 commit comments