Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
b67aa39c
Commit
b67aa39c
authored
Sep 11, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13626 from feihujiang/getTerminatedPodByName
Auto commit by PR queue bot
parents
6f012001
008a26f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
resource_printer.go
pkg/kubectl/resource_printer.go
+6
-2
No files found.
pkg/kubectl/resource_printer.go
View file @
b67aa39c
...
@@ -519,6 +519,10 @@ func translateTimestamp(timestamp util.Time) string {
...
@@ -519,6 +519,10 @@ func translateTimestamp(timestamp util.Time) string {
}
}
func
printPod
(
pod
*
api
.
Pod
,
w
io
.
Writer
,
withNamespace
bool
,
wide
bool
,
showAll
bool
,
columnLabels
[]
string
)
error
{
func
printPod
(
pod
*
api
.
Pod
,
w
io
.
Writer
,
withNamespace
bool
,
wide
bool
,
showAll
bool
,
columnLabels
[]
string
)
error
{
return
printPodBase
(
pod
,
w
,
withNamespace
,
wide
,
showAll
,
true
,
columnLabels
)
}
func
printPodBase
(
pod
*
api
.
Pod
,
w
io
.
Writer
,
withNamespace
bool
,
wide
bool
,
showAll
bool
,
showIfTerminating
bool
,
columnLabels
[]
string
)
error
{
name
:=
pod
.
Name
name
:=
pod
.
Name
namespace
:=
pod
.
Namespace
namespace
:=
pod
.
Namespace
...
@@ -528,7 +532,7 @@ func printPod(pod *api.Pod, w io.Writer, withNamespace bool, wide bool, showAll
...
@@ -528,7 +532,7 @@ func printPod(pod *api.Pod, w io.Writer, withNamespace bool, wide bool, showAll
reason
:=
string
(
pod
.
Status
.
Phase
)
reason
:=
string
(
pod
.
Status
.
Phase
)
// if not printing all pods, skip terminated pods (default)
// if not printing all pods, skip terminated pods (default)
if
!
showAll
&&
(
reason
==
string
(
api
.
PodSucceeded
)
||
reason
==
string
(
api
.
PodFailed
))
{
if
!
show
IfTerminating
&&
!
show
All
&&
(
reason
==
string
(
api
.
PodSucceeded
)
||
reason
==
string
(
api
.
PodFailed
))
{
return
nil
return
nil
}
}
if
pod
.
Status
.
Reason
!=
""
{
if
pod
.
Status
.
Reason
!=
""
{
...
@@ -588,7 +592,7 @@ func printPod(pod *api.Pod, w io.Writer, withNamespace bool, wide bool, showAll
...
@@ -588,7 +592,7 @@ func printPod(pod *api.Pod, w io.Writer, withNamespace bool, wide bool, showAll
func
printPodList
(
podList
*
api
.
PodList
,
w
io
.
Writer
,
withNamespace
bool
,
wide
bool
,
showAll
bool
,
columnLabels
[]
string
)
error
{
func
printPodList
(
podList
*
api
.
PodList
,
w
io
.
Writer
,
withNamespace
bool
,
wide
bool
,
showAll
bool
,
columnLabels
[]
string
)
error
{
for
_
,
pod
:=
range
podList
.
Items
{
for
_
,
pod
:=
range
podList
.
Items
{
if
err
:=
printPod
(
&
pod
,
w
,
withNamespace
,
wide
,
showAll
,
columnLabels
);
err
!=
nil
{
if
err
:=
printPod
Base
(
&
pod
,
w
,
withNamespace
,
wide
,
showAll
,
false
,
columnLabels
);
err
!=
nil
{
return
err
return
err
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment