Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkg/gcmanager/pod_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ func (s *SpiderGC) buildPodEntry(oldPod, currentPod *corev1.Pod, deleted bool) (

if isBuildTerminatingPodEntry {
// check terminating Pod corresponding Node status
logger.Sugar().Debugf("Check should build trace entry for terminating Pod '%s/%s' by node status and GC flag", currentPod.Namespace, currentPod.Name)
enabled, err := s.isShouldGCOrTraceStatelessTerminatingPodOnNode(ctx, currentPod)
if err != nil {
return nil, err
Expand Down Expand Up @@ -254,6 +255,15 @@ func (s *SpiderGC) buildPodEntry(oldPod, currentPod *corev1.Pod, deleted bool) (

return podEntry, nil
} else if isBuildSucceededOrFailedPodEntry {
logger.Sugar().Debugf("Check should build trace entry for succeeded|failed Pod '%s/%s' by node status and GC flag", currentPod.Namespace, currentPod.Name)
enabled, err := s.isShouldGCOrTraceStatelessTerminatingPodOnNode(ctx, currentPod)
if err != nil {
return nil, err
}

if !enabled {
return nil, nil
}
podEntry := &PodEntry{
PodName: currentPod.Name,
Namespace: currentPod.Namespace,
Expand Down
4 changes: 2 additions & 2 deletions pkg/gcmanager/scanAll_IPPool.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,12 @@ func (s *SpiderGC) isShouldGCOrTraceStatelessTerminatingPodOnNode(ctx context.Co

// disable for gc terminating pod with Node Ready
if nodemanager.IsNodeReady(node) && !s.gcConfig.EnableGCStatelessTerminatingPodOnReadyNode {
logger.Sugar().Debugf("IP GC already turn off 'EnableGCForTerminatingPodWithNodeReady' configuration, disacrd tracing pod '%s/%s'", pod.Namespace, pod.Name)
logger.Sugar().Debugf("IP GC already turn off 'EnableGCForTerminatingPodWithNodeReady' configuration, don't gc ipAddress or tracing pod '%s/%s'", pod.Namespace, pod.Name)
return false, nil
}
// disable for gc terminating pod with Node NotReady
if !nodemanager.IsNodeReady(node) && !s.gcConfig.EnableGCStatelessTerminatingPodOnNotReadyNode {
logger.Sugar().Debugf("IP GC already turn off 'EnableGCForTerminatingPodWithNodeNotReady' configuration, disacrd tracing pod '%s/%s'", pod.Namespace, pod.Name)
logger.Sugar().Debugf("IP GC already turn off 'EnableGCForTerminatingPodWithNodeNotReady' configuration, don't gc ipAddress or tracing pod '%s/%s'", pod.Namespace, pod.Name)
return false, nil
}

Expand Down
Loading