Skip to content

Commit

Permalink
Reorder pod terminating check
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano committed Apr 8, 2021
1 parent 43cf27f commit 8674201
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions libbeat/autodiscover/providers/kubernetes/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,17 +426,16 @@ func (p *pod) emit(pod *kubernetes.Pod, flag string) {

// podTerminating returns true if a pod is marked for deletion or is in a phase beyond running.
func podTerminating(pod *kubernetes.Pod) bool {
if pod.GetObjectMeta().GetDeletionTimestamp() != nil {
return true
switch pod.Status.Phase {
case kubernetes.PodPending, kubernetes.PodRunning:
return false
}

switch pod.Status.Phase {
case kubernetes.PodRunning, kubernetes.PodPending:
default:
return true
if pod.GetObjectMeta().GetDeletionTimestamp() == nil {
return false
}

return false
return true
}

// podAnnotations returns the annotations in a pod
Expand Down

0 comments on commit 8674201

Please sign in to comment.