Skip to content

Commit

Permalink
Merge pull request #48821 from janetkuo/automated-cherry-pick-of-#487…
Browse files Browse the repository at this point in the history
…86-upstream-release-1.7

Automatic merge from submit-queue

Automated cherry pick of #48786 upstream release 1.7

Cherrypick #48786 to fix a regression in 1.7
  • Loading branch information
Kubernetes Submit Queue committed Jul 18, 2017
2 parents 4ba75f9 + 6ab1c45 commit e896537
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions pkg/kubectl/resource_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,18 @@ func NewResourceFilter() Filters {
}

// filterPods returns true if a pod should be skipped.
// defaults to true for terminated pods
// If show-all is true, the pod will be never be skipped (return false);
// otherwise, skip terminated pod.
func filterPods(obj runtime.Object, options printers.PrintOptions) bool {
if options.ShowAll {
return false
}

switch p := obj.(type) {
case *v1.Pod:
reason := string(p.Status.Phase)
if p.Status.Reason != "" {
reason = p.Status.Reason
}
return !options.ShowAll && (reason == string(v1.PodSucceeded) || reason == string(v1.PodFailed))
return p.Status.Phase == v1.PodSucceeded || p.Status.Phase == v1.PodFailed
case *api.Pod:
reason := string(p.Status.Phase)
if p.Status.Reason != "" {
reason = p.Status.Reason
}
return !options.ShowAll && (reason == string(api.PodSucceeded) || reason == string(api.PodFailed))
return p.Status.Phase == api.PodSucceeded || p.Status.Phase == api.PodFailed
}
return false
}
Expand Down

0 comments on commit e896537

Please sign in to comment.