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
51a894e6
Commit
51a894e6
authored
Aug 18, 2016
by
Michail Kargakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubectl: display ready replicas in 'get {rs,rc}'
parent
878e06a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
cmd_test.go
pkg/kubectl/cmd/cmd_test.go
+8
-7
resource_printer.go
pkg/kubectl/resource_printer.go
+8
-4
No files found.
pkg/kubectl/cmd/cmd_test.go
View file @
51a894e6
...
@@ -420,7 +420,8 @@ func Example_printReplicationControllerWithNamespace() {
...
@@ -420,7 +420,8 @@ func Example_printReplicationControllerWithNamespace() {
},
},
},
},
Status
:
api
.
ReplicationControllerStatus
{
Status
:
api
.
ReplicationControllerStatus
{
Replicas
:
1
,
Replicas
:
1
,
ReadyReplicas
:
1
,
},
},
}
}
mapper
,
_
:=
f
.
Object
(
false
)
mapper
,
_
:=
f
.
Object
(
false
)
...
@@ -429,8 +430,8 @@ func Example_printReplicationControllerWithNamespace() {
...
@@ -429,8 +430,8 @@ func Example_printReplicationControllerWithNamespace() {
fmt
.
Printf
(
"Unexpected error: %v"
,
err
)
fmt
.
Printf
(
"Unexpected error: %v"
,
err
)
}
}
// Output:
// Output:
// NAMESPACE NAME DESIRED CURRENT AGE
// NAMESPACE NAME DESIRED CURRENT
READY
AGE
// beep foo 1 1 10y
// beep foo 1 1 1
1
0y
}
}
func
Example_printMultiContainersReplicationControllerWithWide
()
{
func
Example_printMultiContainersReplicationControllerWithWide
()
{
...
@@ -481,8 +482,8 @@ func Example_printMultiContainersReplicationControllerWithWide() {
...
@@ -481,8 +482,8 @@ func Example_printMultiContainersReplicationControllerWithWide() {
fmt
.
Printf
(
"Unexpected error: %v"
,
err
)
fmt
.
Printf
(
"Unexpected error: %v"
,
err
)
}
}
// Output:
// Output:
// NAME DESIRED CURRENT AGE CONTAINER(S) IMAGE(S) SELECTOR
// NAME DESIRED CURRENT
READY
AGE CONTAINER(S) IMAGE(S) SELECTOR
// foo 1 1 10y foo,foo2 someimage,someimage2 foo=bar
// foo 1 1
0
10y foo,foo2 someimage,someimage2 foo=bar
}
}
func
Example_printReplicationController
()
{
func
Example_printReplicationController
()
{
...
@@ -532,8 +533,8 @@ func Example_printReplicationController() {
...
@@ -532,8 +533,8 @@ func Example_printReplicationController() {
fmt
.
Printf
(
"Unexpected error: %v"
,
err
)
fmt
.
Printf
(
"Unexpected error: %v"
,
err
)
}
}
// Output:
// Output:
// NAME DESIRED CURRENT AGE
// NAME DESIRED CURRENT
READY
AGE
// foo 1 1 10y
// foo 1 1
0
10y
}
}
func
Example_printPodWithWideFormat
()
{
func
Example_printPodWithWideFormat
()
{
...
...
pkg/kubectl/resource_printer.go
View file @
51a894e6
...
@@ -458,8 +458,8 @@ func (h *HumanReadablePrinter) FinishPrint(output io.Writer, res string) error {
...
@@ -458,8 +458,8 @@ func (h *HumanReadablePrinter) FinishPrint(output io.Writer, res string) error {
// pkg/kubectl/cmd/get.go to reflect the new resource type.
// pkg/kubectl/cmd/get.go to reflect the new resource type.
var
podColumns
=
[]
string
{
"NAME"
,
"READY"
,
"STATUS"
,
"RESTARTS"
,
"AGE"
}
var
podColumns
=
[]
string
{
"NAME"
,
"READY"
,
"STATUS"
,
"RESTARTS"
,
"AGE"
}
var
podTemplateColumns
=
[]
string
{
"TEMPLATE"
,
"CONTAINER(S)"
,
"IMAGE(S)"
,
"PODLABELS"
}
var
podTemplateColumns
=
[]
string
{
"TEMPLATE"
,
"CONTAINER(S)"
,
"IMAGE(S)"
,
"PODLABELS"
}
var
replicationControllerColumns
=
[]
string
{
"NAME"
,
"DESIRED"
,
"CURRENT"
,
"AGE"
}
var
replicationControllerColumns
=
[]
string
{
"NAME"
,
"DESIRED"
,
"CURRENT"
,
"
READY"
,
"
AGE"
}
var
replicaSetColumns
=
[]
string
{
"NAME"
,
"DESIRED"
,
"CURRENT"
,
"AGE"
}
var
replicaSetColumns
=
[]
string
{
"NAME"
,
"DESIRED"
,
"CURRENT"
,
"
READY"
,
"
AGE"
}
var
jobColumns
=
[]
string
{
"NAME"
,
"DESIRED"
,
"SUCCESSFUL"
,
"AGE"
}
var
jobColumns
=
[]
string
{
"NAME"
,
"DESIRED"
,
"SUCCESSFUL"
,
"AGE"
}
var
scheduledJobColumns
=
[]
string
{
"NAME"
,
"SCHEDULE"
,
"SUSPEND"
,
"ACTIVE"
,
"LAST-SCHEDULE"
}
var
scheduledJobColumns
=
[]
string
{
"NAME"
,
"SCHEDULE"
,
"SUSPEND"
,
"ACTIVE"
,
"LAST-SCHEDULE"
}
var
serviceColumns
=
[]
string
{
"NAME"
,
"CLUSTER-IP"
,
"EXTERNAL-IP"
,
"PORT(S)"
,
"AGE"
}
var
serviceColumns
=
[]
string
{
"NAME"
,
"CLUSTER-IP"
,
"EXTERNAL-IP"
,
"PORT(S)"
,
"AGE"
}
...
@@ -834,10 +834,12 @@ func printReplicationController(controller *api.ReplicationController, w io.Writ
...
@@ -834,10 +834,12 @@ func printReplicationController(controller *api.ReplicationController, w io.Writ
desiredReplicas
:=
controller
.
Spec
.
Replicas
desiredReplicas
:=
controller
.
Spec
.
Replicas
currentReplicas
:=
controller
.
Status
.
Replicas
currentReplicas
:=
controller
.
Status
.
Replicas
if
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%d
\t
%d
\t
%s"
,
readyReplicas
:=
controller
.
Status
.
ReadyReplicas
if
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%d
\t
%d
\t
%d
\t
%s"
,
name
,
name
,
desiredReplicas
,
desiredReplicas
,
currentReplicas
,
currentReplicas
,
readyReplicas
,
translateTimestamp
(
controller
.
CreationTimestamp
),
translateTimestamp
(
controller
.
CreationTimestamp
),
);
err
!=
nil
{
);
err
!=
nil
{
return
err
return
err
...
@@ -884,10 +886,12 @@ func printReplicaSet(rs *extensions.ReplicaSet, w io.Writer, options PrintOption
...
@@ -884,10 +886,12 @@ func printReplicaSet(rs *extensions.ReplicaSet, w io.Writer, options PrintOption
desiredReplicas
:=
rs
.
Spec
.
Replicas
desiredReplicas
:=
rs
.
Spec
.
Replicas
currentReplicas
:=
rs
.
Status
.
Replicas
currentReplicas
:=
rs
.
Status
.
Replicas
if
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%d
\t
%d
\t
%s"
,
readyReplicas
:=
rs
.
Status
.
ReadyReplicas
if
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%d
\t
%d
\t
%d
\t
%s"
,
name
,
name
,
desiredReplicas
,
desiredReplicas
,
currentReplicas
,
currentReplicas
,
readyReplicas
,
translateTimestamp
(
rs
.
CreationTimestamp
),
translateTimestamp
(
rs
.
CreationTimestamp
),
);
err
!=
nil
{
);
err
!=
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