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
bd1bf111
Commit
bd1bf111
authored
Apr 20, 2015
by
Eric Paris
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6886 from aveshagarwal/kubectl-get-nodes-issue
This commit fixes "kubectl get nodes" output and makes it more sane. It also fixes related test case resource_printer_test.
parents
eb1ea269
a2ac72c4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
8 deletions
+37
-8
resource_printer.go
pkg/kubectl/resource_printer.go
+4
-7
resource_printer_test.go
pkg/kubectl/resource_printer_test.go
+33
-1
No files found.
pkg/kubectl/resource_printer.go
View file @
bd1bf111
...
...
@@ -503,12 +503,6 @@ func printNode(node *api.Node, w io.Writer) error {
cond
:=
node
.
Status
.
Conditions
[
i
]
conditionMap
[
cond
.
Type
]
=
&
cond
}
var
schedulable
string
if
node
.
Spec
.
Unschedulable
{
schedulable
=
"Unschedulable"
}
else
{
schedulable
=
"Schedulable"
}
var
status
[]
string
for
_
,
validCondition
:=
range
NodeAllConditions
{
if
condition
,
ok
:=
conditionMap
[
validCondition
];
ok
{
...
...
@@ -522,7 +516,10 @@ func printNode(node *api.Node, w io.Writer) error {
if
len
(
status
)
==
0
{
status
=
append
(
status
,
"Unknown"
)
}
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%s
\t
%s
\t
%s
\n
"
,
node
.
Name
,
schedulable
,
formatLabels
(
node
.
Labels
),
strings
.
Join
(
status
,
","
))
if
node
.
Spec
.
Unschedulable
{
status
=
append
(
status
,
"SchedulingDisabled"
)
}
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%s
\t
%s
\n
"
,
node
.
Name
,
formatLabels
(
node
.
Labels
),
strings
.
Join
(
status
,
","
))
return
err
}
...
...
pkg/kubectl/resource_printer_test.go
View file @
bd1bf111
...
...
@@ -557,6 +557,14 @@ func TestPrintMinionStatus(t *testing.T) {
},
{
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo2"
},
Spec
:
api
.
NodeSpec
{
Unschedulable
:
true
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionTrue
}}},
},
status
:
"Ready,SchedulingDisabled"
,
},
{
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo3"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionTrue
},
...
...
@@ -574,17 +582,41 @@ func TestPrintMinionStatus(t *testing.T) {
{
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo5"
},
Spec
:
api
.
NodeSpec
{
Unschedulable
:
true
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFalse
}}},
},
status
:
"NotReady,SchedulingDisabled"
,
},
{
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo6"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
"InvalidValue"
,
Status
:
api
.
ConditionTrue
}}},
},
status
:
"Unknown"
,
},
{
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo
6
"
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo
7
"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{}}},
},
status
:
"Unknown"
,
},
{
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo8"
},
Spec
:
api
.
NodeSpec
{
Unschedulable
:
true
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
"InvalidValue"
,
Status
:
api
.
ConditionTrue
}}},
},
status
:
"Unknown,SchedulingDisabled"
,
},
{
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo9"
},
Spec
:
api
.
NodeSpec
{
Unschedulable
:
true
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{}}},
},
status
:
"Unknown,SchedulingDisabled"
,
},
}
for
_
,
test
:=
range
table
{
...
...
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