mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #30858 from kargakis/status-column-for-rs
Automatic merge from submit-queue kubectl: display ready replicas in 'get {rs,rc}' Fixes https://github.com/kubernetes/kubernetes/issues/7483 @kubernetes/kubectl @janetkuo @bgrant0607
This commit is contained in:
commit
d84dcaf3fb
@ -421,6 +421,7 @@ 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() {
|
|||||||
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 10y
|
||||||
}
|
}
|
||||||
|
|
||||||
func Example_printMultiContainersReplicationControllerWithWide() {
|
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() {
|
|||||||
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() {
|
||||||
|
@ -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
|
|||||||
|
|
||||||
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
|
|||||||
|
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user