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
467d5924
Commit
467d5924
authored
Apr 29, 2015
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7502 from piosz/kubectl
Updated kubectl cluster-info to show v1beta3 addresses
parents
7dcce2ee
9272fe2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
14 deletions
+4
-14
clusterinfo.go
pkg/kubectl/cmd/clusterinfo.go
+4
-14
No files found.
pkg/kubectl/cmd/clusterinfo.go
View file @
467d5924
...
...
@@ -20,7 +20,6 @@ import (
"fmt"
"io"
"os"
"strings"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
cmdutil
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd/util"
...
...
@@ -54,7 +53,7 @@ func RunClusterInfo(factory *cmdutil.Factory, out io.Writer, cmd *cobra.Command)
if
err
!=
nil
{
return
err
}
printService
(
out
,
"Kubernetes master"
,
client
.
Host
,
false
)
printService
(
out
,
"Kubernetes master"
,
client
.
Host
)
mapper
,
typer
:=
factory
.
Object
()
cmdNamespace
,
err
:=
factory
.
DefaultNamespace
()
...
...
@@ -71,13 +70,8 @@ func RunClusterInfo(factory *cmdutil.Factory, out io.Writer, cmd *cobra.Command)
b
.
Do
()
.
Visit
(
func
(
r
*
resource
.
Info
)
error
{
services
:=
r
.
Object
.
(
*
api
.
ServiceList
)
.
Items
for
_
,
service
:=
range
services
{
splittedLink
:=
strings
.
Split
(
strings
.
Split
(
service
.
ObjectMeta
.
SelfLink
,
"?"
)[
0
],
"/"
)
// insert "proxy" into the link
splittedLink
=
append
(
splittedLink
,
""
)
copy
(
splittedLink
[
4
:
],
splittedLink
[
3
:
])
splittedLink
[
3
]
=
"proxy"
link
:=
client
.
Host
+
strings
.
Join
(
splittedLink
,
"/"
)
+
"/"
printService
(
out
,
service
.
ObjectMeta
.
Labels
[
"name"
],
link
,
true
)
link
:=
client
.
Host
+
"/api/v1beta3/proxy/namespaces/"
+
service
.
ObjectMeta
.
Namespace
+
"/services/"
+
service
.
ObjectMeta
.
Name
printService
(
out
,
service
.
ObjectMeta
.
Labels
[
"name"
],
link
)
}
return
nil
})
...
...
@@ -86,7 +80,7 @@ func RunClusterInfo(factory *cmdutil.Factory, out io.Writer, cmd *cobra.Command)
// TODO consider printing more information about cluster
}
func
printService
(
out
io
.
Writer
,
name
,
link
string
,
warn
bool
)
{
func
printService
(
out
io
.
Writer
,
name
,
link
string
)
{
ct
.
ChangeColor
(
ct
.
Green
,
false
,
ct
.
None
,
false
)
fmt
.
Fprint
(
out
,
name
)
ct
.
ResetColor
()
...
...
@@ -94,9 +88,5 @@ func printService(out io.Writer, name, link string, warn bool) {
ct
.
ChangeColor
(
ct
.
Yellow
,
false
,
ct
.
None
,
false
)
fmt
.
Fprint
(
out
,
link
)
ct
.
ResetColor
()
// TODO remove this warn once trailing slash is no longer required
if
warn
{
fmt
.
Fprint
(
out
,
" (note the trailing slash)"
)
}
fmt
.
Fprintln
(
out
,
""
)
}
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