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
29b73cc4
Commit
29b73cc4
authored
Nov 14, 2014
by
Daniel Smith
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2389 from satnam6502/kubectl
Make the output of kubectl.sh narrower
parents
eb14ba93
fa0cb9a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
5 deletions
+24
-5
kubectl.go
pkg/kubectl/kubectl.go
+6
-2
resource_printer.go
pkg/kubectl/resource_printer.go
+18
-3
No files found.
pkg/kubectl/kubectl.go
View file @
29b73cc4
...
...
@@ -127,12 +127,16 @@ func formatLabels(labelMap map[string]string) string {
return
l
}
func
makeImageList
(
spec
*
api
.
PodSpec
)
string
{
func
listOfImages
(
spec
*
api
.
PodSpec
)
[]
string
{
var
images
[]
string
for
_
,
container
:=
range
spec
.
Containers
{
images
=
append
(
images
,
container
.
Image
)
}
return
strings
.
Join
(
images
,
","
)
return
images
}
func
makeImageList
(
spec
*
api
.
PodSpec
)
string
{
return
strings
.
Join
(
listOfImages
(
spec
),
","
)
}
// ExpandResourceShortcut will return the expanded version of resource
...
...
pkg/kubectl/resource_printer.go
View file @
29b73cc4
...
...
@@ -260,12 +260,27 @@ func printPod(pod *api.Pod, w io.Writer) error {
if
err
:=
api
.
Scheme
.
Convert
(
&
pod
.
DesiredState
.
Manifest
,
spec
);
err
!=
nil
{
glog
.
Errorf
(
"Unable to convert pod manifest: %v"
,
err
)
}
il
:=
listOfImages
(
spec
)
// Be paranoid about the case where there is no image.
var
firstImage
string
if
len
(
il
)
>
0
{
firstImage
,
il
=
il
[
0
],
il
[
1
:
]
}
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%s
\t
%s
\t
%s
\t
%s
\n
"
,
pod
.
Name
,
makeImageList
(
spec
)
,
pod
.
Name
,
firstImage
,
podHostString
(
pod
.
CurrentState
.
Host
,
pod
.
CurrentState
.
HostIP
),
labels
.
Set
(
pod
.
Labels
),
pod
.
CurrentState
.
Status
)
return
err
if
err
!=
nil
{
return
err
}
// Lay out all the other images on separate lines.
for
_
,
image
:=
range
il
{
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%s
\t
%s
\t
%s
\t
%s
\n
"
,
""
,
image
,
""
,
""
,
""
)
if
err
!=
nil
{
return
err
}
}
return
nil
}
func
printPodList
(
podList
*
api
.
PodList
,
w
io
.
Writer
)
error
{
...
...
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