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
b4ca15df
Commit
b4ca15df
authored
Sep 25, 2015
by
Eric Tune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print namespace when asked for job.
Also print multiple containers if there happen to be multiple.
parent
7c5b8f6a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
+27
-2
resource_printer.go
pkg/kubectl/resource_printer.go
+27
-2
No files found.
pkg/kubectl/resource_printer.go
View file @
b4ca15df
...
...
@@ -724,13 +724,20 @@ func printReplicationControllerList(list *api.ReplicationControllerList, w io.Wr
}
func
printJob
(
job
*
experimental
.
Job
,
w
io
.
Writer
,
withNamespace
bool
,
wide
bool
,
showAll
bool
,
columnLabels
[]
string
)
error
{
name
:=
job
.
Name
namespace
:=
job
.
Namespace
containers
:=
job
.
Spec
.
Template
.
Spec
.
Containers
var
firstContainer
api
.
Container
if
len
(
containers
)
>
0
{
firstContainer
=
containers
[
0
]
firstContainer
,
containers
=
containers
[
0
],
containers
[
1
:
]
}
if
withNamespace
{
if
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
"
,
namespace
);
err
!=
nil
{
return
err
}
}
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%s
\t
%s
\t
%s
\t
%d
\n
"
,
job
.
N
ame
,
n
ame
,
firstContainer
.
Name
,
firstContainer
.
Image
,
labels
.
FormatLabels
(
job
.
Spec
.
Selector
),
...
...
@@ -738,6 +745,24 @@ func printJob(job *experimental.Job, w io.Writer, withNamespace bool, wide bool,
if
err
!=
nil
{
return
err
}
if
_
,
err
:=
fmt
.
Fprint
(
w
,
appendLabels
(
job
.
Labels
,
columnLabels
));
err
!=
nil
{
return
err
}
// Lay out all the other containers on separate lines.
extraLinePrefix
:=
"
\t
"
if
withNamespace
{
extraLinePrefix
=
"
\t\t
"
}
for
_
,
container
:=
range
containers
{
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s%s
\t
%s
\t
%s
\t
%s"
,
extraLinePrefix
,
container
.
Name
,
container
.
Image
,
""
,
""
)
if
err
!=
nil
{
return
err
}
if
_
,
err
:=
fmt
.
Fprint
(
w
,
appendLabelTabs
(
columnLabels
));
err
!=
nil
{
return
err
}
}
return
nil
}
...
...
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