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
99af2da6
Commit
99af2da6
authored
Jan 10, 2016
by
Prashanth Balasubramanian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix kubectl describe ingress
parent
37b57267
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
26 deletions
+31
-26
describe.go
pkg/kubectl/describe.go
+31
-26
No files found.
pkg/kubectl/describe.go
View file @
99af2da6
...
...
@@ -1028,55 +1028,60 @@ func (i *IngressDescriber) Describe(namespace, name string) (string, error) {
if
err
!=
nil
{
return
""
,
err
}
events
,
_
:=
i
.
Events
(
namespace
)
.
Search
(
ing
)
endpoints
,
_
:=
i
.
Endpoints
(
namespace
)
.
Get
(
ing
.
Spec
.
Backend
.
ServiceName
)
service
,
_
:=
i
.
Services
(
namespace
)
.
Get
(
ing
.
Spec
.
Backend
.
ServiceName
)
return
describeIngress
(
ing
,
endpoints
,
service
,
events
)
return
i
.
describeIngress
(
ing
)
}
func
describeIngressEndpoints
(
out
io
.
Writer
,
ing
*
extensions
.
Ingress
,
endpoints
*
api
.
Endpoints
,
service
*
api
.
Service
)
{
func
(
i
*
IngressDescriber
)
describeBackend
(
ns
string
,
backend
*
extensions
.
IngressBackend
)
string
{
endpoints
,
_
:=
i
.
Endpoints
(
ns
)
.
Get
(
backend
.
ServiceName
)
service
,
_
:=
i
.
Services
(
ns
)
.
Get
(
backend
.
ServiceName
)
spName
:=
""
for
i
:=
range
service
.
Spec
.
Ports
{
sp
:=
&
service
.
Spec
.
Ports
[
i
]
switch
ing
.
Spec
.
B
ackend
.
ServicePort
.
Type
{
switch
b
ackend
.
ServicePort
.
Type
{
case
intstr
.
String
:
if
ing
.
Spec
.
B
ackend
.
ServicePort
.
StrVal
==
sp
.
Name
{
if
b
ackend
.
ServicePort
.
StrVal
==
sp
.
Name
{
spName
=
sp
.
Name
}
case
intstr
.
Int
:
if
int
(
ing
.
Spec
.
B
ackend
.
ServicePort
.
IntVal
)
==
sp
.
Port
{
if
int
(
b
ackend
.
ServicePort
.
IntVal
)
==
sp
.
Port
{
spName
=
sp
.
Name
}
}
}
fmt
.
Fprintf
(
out
,
"Endpoints:
\t
%s
\n
"
,
formatEndpoints
(
endpoints
,
sets
.
NewString
(
spName
)))
return
formatEndpoints
(
endpoints
,
sets
.
NewString
(
spName
))
}
func
describeIngress
(
ing
*
extensions
.
Ingress
,
endpoints
*
api
.
Endpoints
,
service
*
api
.
Service
,
events
*
api
.
EventList
)
(
string
,
error
)
{
func
(
i
*
IngressDescriber
)
describeIngress
(
ing
*
extensions
.
Ingress
)
(
string
,
error
)
{
return
tabbedString
(
func
(
out
io
.
Writer
)
error
{
fmt
.
Fprintf
(
out
,
"Name:
\t
%s
\n
"
,
ing
.
Name
)
fmt
.
Fprintf
(
out
,
"Namespace:
\t
%s
\n
"
,
ing
.
Namespace
)
fmt
.
Fprintf
(
out
,
"Labels:
\t
%s
\n
"
,
labels
.
FormatLabels
(
ing
.
Labels
))
fmt
.
Fprintf
(
out
,
"Rules:
\n
"
)
fmt
.
Fprintf
(
out
,
"Name:
\t
%v
\n
"
,
ing
.
Name
)
fmt
.
Fprintf
(
out
,
"Namespace:
\t
%v
\n
"
,
ing
.
Namespace
)
fmt
.
Fprintf
(
out
,
"Address:
\t
%v
\n
"
,
loadBalancerStatusStringer
(
ing
.
Status
.
LoadBalancer
))
def
:=
ing
.
Spec
.
Backend
ns
:=
ing
.
Namespace
if
def
==
nil
{
// Ingresses that don't specify a default backend inherit the
// default backend in the kube-system namespace.
def
=
&
extensions
.
IngressBackend
{
ServiceName
:
"default-http-backend"
,
ServicePort
:
intstr
.
IntOrString
{
Type
:
intstr
.
Int
,
IntVal
:
80
},
}
ns
=
api
.
NamespaceSystem
}
fmt
.
Fprintf
(
out
,
"Default backend:
\t
%s (%s)
\n
"
,
backendStringer
(
def
),
i
.
describeBackend
(
ns
,
def
))
fmt
.
Fprint
(
out
,
"Rules:
\n
Host
\t
Path
\t
Backends
\n
"
)
fmt
.
Fprint
(
out
,
" ----
\t
----
\t
--------
\n
"
)
for
_
,
rules
:=
range
ing
.
Spec
.
Rules
{
if
rules
.
HTTP
==
nil
{
continue
}
fmt
.
Fprintf
(
out
,
" Host
\t
Path
\t
Backend
\n
"
)
fmt
.
Fprintf
(
out
,
" ----
\t
----
\t
--------
\n
"
)
fmt
.
Fprintf
(
out
,
" %s
\t\n
"
,
rules
.
Host
)
for
_
,
path
:=
range
rules
.
HTTP
.
Paths
{
fmt
.
Fprintf
(
out
,
"
%s
\t
%s
\t
%s
\n
"
,
rules
.
Host
,
path
.
Path
,
backendStringer
(
&
path
.
Backend
))
fmt
.
Fprintf
(
out
,
"
\t
%s
\t
%s (%s)
\n
"
,
path
.
Path
,
backendStringer
(
&
path
.
Backend
),
i
.
describeBackend
(
ing
.
Namespace
,
&
path
.
Backend
))
}
}
fmt
.
Fprintf
(
out
,
"Backend:
\t
%v
\t
%v
\n
"
,
backendStringer
(
ing
.
Spec
.
Backend
),
loadBalancerStatusStringer
(
ing
.
Status
.
LoadBalancer
))
describeIngressEndpoints
(
out
,
ing
,
endpoints
,
service
)
describeIngressAnnotations
(
out
,
ing
.
Annotations
)
events
,
_
:=
i
.
Events
(
ing
.
Namespace
)
.
Search
(
ing
)
if
events
!=
nil
{
DescribeEvents
(
events
,
out
)
}
...
...
@@ -1093,7 +1098,7 @@ func describeIngressAnnotations(out io.Writer, annotations map[string]string) {
}
parts
:=
strings
.
Split
(
k
,
"/"
)
name
:=
parts
[
len
(
parts
)
-
1
]
fmt
.
Fprintf
(
out
,
"%v:
\t
%s
\n
"
,
name
,
v
)
fmt
.
Fprintf
(
out
,
"
%v:
\t
%s
\n
"
,
name
,
v
)
}
return
}
...
...
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