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
4c0c04f2
Commit
4c0c04f2
authored
Apr 28, 2015
by
Alex Robinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7424 from thockin/print-named-endpt-ports
Print named ports in 'describe service'
parents
4045dedc
eea949b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
describe.go
pkg/kubectl/describe.go
+2
-1
resource_printer.go
pkg/kubectl/resource_printer.go
+4
-3
No files found.
pkg/kubectl/describe.go
View file @
4c0c04f2
...
@@ -29,6 +29,7 @@ import (
...
@@ -29,6 +29,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/golang/glog"
"github.com/golang/glog"
)
)
...
@@ -457,8 +458,8 @@ func describeService(service *api.Service, endpoints *api.Endpoints, events *api
...
@@ -457,8 +458,8 @@ func describeService(service *api.Service, endpoints *api.Endpoints, events *api
name
=
"<unnamed>"
name
=
"<unnamed>"
}
}
fmt
.
Fprintf
(
out
,
"Port:
\t
%s
\t
%d/%s
\n
"
,
name
,
sp
.
Port
,
sp
.
Protocol
)
fmt
.
Fprintf
(
out
,
"Port:
\t
%s
\t
%d/%s
\n
"
,
name
,
sp
.
Port
,
sp
.
Protocol
)
fmt
.
Fprintf
(
out
,
"Endpoints:
\t
%s
\t
%s
\n
"
,
name
,
formatEndpoints
(
endpoints
,
util
.
NewStringSet
(
sp
.
Name
)))
}
}
fmt
.
Fprintf
(
out
,
"Endpoints:
\t
%s
\n
"
,
formatEndpoints
(
endpoints
))
fmt
.
Fprintf
(
out
,
"Session Affinity:
\t
%s
\n
"
,
service
.
Spec
.
SessionAffinity
)
fmt
.
Fprintf
(
out
,
"Session Affinity:
\t
%s
\n
"
,
service
.
Spec
.
SessionAffinity
)
if
events
!=
nil
{
if
events
!=
nil
{
DescribeEvents
(
events
,
out
)
DescribeEvents
(
events
,
out
)
...
...
pkg/kubectl/resource_printer.go
View file @
4c0c04f2
...
@@ -305,7 +305,8 @@ func (h *HumanReadablePrinter) printHeader(columnNames []string, w io.Writer) er
...
@@ -305,7 +305,8 @@ func (h *HumanReadablePrinter) printHeader(columnNames []string, w io.Writer) er
return
nil
return
nil
}
}
func
formatEndpoints
(
endpoints
*
api
.
Endpoints
)
string
{
// Pass ports=nil for all ports.
func
formatEndpoints
(
endpoints
*
api
.
Endpoints
,
ports
util
.
StringSet
)
string
{
if
len
(
endpoints
.
Subsets
)
==
0
{
if
len
(
endpoints
.
Subsets
)
==
0
{
return
"<none>"
return
"<none>"
}
}
...
@@ -317,7 +318,7 @@ Loop:
...
@@ -317,7 +318,7 @@ Loop:
ss
:=
&
endpoints
.
Subsets
[
i
]
ss
:=
&
endpoints
.
Subsets
[
i
]
for
i
:=
range
ss
.
Ports
{
for
i
:=
range
ss
.
Ports
{
port
:=
&
ss
.
Ports
[
i
]
port
:=
&
ss
.
Ports
[
i
]
if
port
.
Name
==
""
{
// TODO: add multi-port support.
if
port
s
==
nil
||
ports
.
Has
(
port
.
Name
)
{
for
i
:=
range
ss
.
Addresses
{
for
i
:=
range
ss
.
Addresses
{
if
len
(
list
)
==
max
{
if
len
(
list
)
==
max
{
more
=
true
more
=
true
...
@@ -555,7 +556,7 @@ func printServiceList(list *api.ServiceList, w io.Writer) error {
...
@@ -555,7 +556,7 @@ func printServiceList(list *api.ServiceList, w io.Writer) error {
}
}
func
printEndpoints
(
endpoints
*
api
.
Endpoints
,
w
io
.
Writer
)
error
{
func
printEndpoints
(
endpoints
*
api
.
Endpoints
,
w
io
.
Writer
)
error
{
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%s
\n
"
,
endpoints
.
Name
,
formatEndpoints
(
endpoints
))
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%s
\n
"
,
endpoints
.
Name
,
formatEndpoints
(
endpoints
,
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