mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Merge pull request #20009 from janetkuo/kubectl-get-deployments
Auto commit by PR queue bot
This commit is contained in:
commit
311d8f8ab9
@ -110,7 +110,7 @@ Updated: 8/27/2015
|
||||
* However, affordances are made for simple parsing of `get` output
|
||||
* Only errors should be directed to stderr
|
||||
* `get` commands should output one row per resource, and one resource per row
|
||||
* Column titles and values should not contain spaces in order to facilitate commands that break lines into fields: cut, awk, etc.
|
||||
* Column titles and values should not contain spaces in order to facilitate commands that break lines into fields: cut, awk, etc. Instead, use `-` as the word separator.
|
||||
* By default, `get` output should fit within about 80 columns
|
||||
* Eventually we could perhaps auto-detect width
|
||||
* `-o wide` may be used to display additional columns
|
||||
|
@ -596,7 +596,7 @@ func ExamplePrintServiceWithNamespacesAndLabels() {
|
||||
fmt.Printf("Unexpected error: %v", err)
|
||||
}
|
||||
// Output:
|
||||
// |NAMESPACE NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE L1|
|
||||
// |NAMESPACE NAME CLUSTER-IP EXTERNAL-IP PORT(S) SELECTOR AGE L1|
|
||||
// |ns1 svc1 10.1.1.1 unknown 53/UDP,53/TCP s=magic 10y value|
|
||||
// |ns2 svc2 10.1.1.2 unknown 80/TCP,8080/TCP s=kazam 10y dolla-bill-yall|
|
||||
// ||
|
||||
|
@ -397,7 +397,7 @@ var podColumns = []string{"NAME", "READY", "STATUS", "RESTARTS", "AGE"}
|
||||
var podTemplateColumns = []string{"TEMPLATE", "CONTAINER(S)", "IMAGE(S)", "PODLABELS"}
|
||||
var replicationControllerColumns = []string{"CONTROLLER", "CONTAINER(S)", "IMAGE(S)", "SELECTOR", "REPLICAS", "AGE"}
|
||||
var jobColumns = []string{"JOB", "CONTAINER(S)", "IMAGE(S)", "SELECTOR", "SUCCESSFUL"}
|
||||
var serviceColumns = []string{"NAME", "CLUSTER_IP", "EXTERNAL_IP", "PORT(S)", "SELECTOR", "AGE"}
|
||||
var serviceColumns = []string{"NAME", "CLUSTER-IP", "EXTERNAL-IP", "PORT(S)", "SELECTOR", "AGE"}
|
||||
var ingressColumns = []string{"NAME", "RULE", "BACKEND", "ADDRESS"}
|
||||
var endpointColumns = []string{"NAME", "ENDPOINTS", "AGE"}
|
||||
var nodeColumns = []string{"NAME", "LABELS", "STATUS", "AGE"}
|
||||
@ -414,7 +414,7 @@ var componentStatusColumns = []string{"NAME", "STATUS", "MESSAGE", "ERROR"}
|
||||
var thirdPartyResourceColumns = []string{"NAME", "DESCRIPTION", "VERSION(S)"}
|
||||
var horizontalPodAutoscalerColumns = []string{"NAME", "REFERENCE", "TARGET", "CURRENT", "MINPODS", "MAXPODS", "AGE"}
|
||||
var withNamespacePrefixColumns = []string{"NAMESPACE"} // TODO(erictune): print cluster name too.
|
||||
var deploymentColumns = []string{"NAME", "UPDATEDREPLICAS", "AGE"}
|
||||
var deploymentColumns = []string{"NAME", "DESIRED", "CURRENT", "UP-TO-DATE", "AVAILABLE", "AGE"}
|
||||
var configMapColumns = []string{"NAME", "DATA", "AGE"}
|
||||
|
||||
// addDefaultHandlers adds print handlers for default Kubernetes types.
|
||||
@ -1383,9 +1383,12 @@ func printDeployment(deployment *extensions.Deployment, w io.Writer, options Pri
|
||||
}
|
||||
}
|
||||
|
||||
updatedReplicas := fmt.Sprintf("%d/%d", deployment.Status.UpdatedReplicas, deployment.Spec.Replicas)
|
||||
desiredReplicas := deployment.Spec.Replicas
|
||||
currentReplicas := deployment.Status.Replicas
|
||||
updatedReplicas := deployment.Status.UpdatedReplicas
|
||||
availableReplicas := deployment.Status.AvailableReplicas
|
||||
age := translateTimestamp(deployment.CreationTimestamp)
|
||||
if _, err := fmt.Fprintf(w, "%s\t%s\t%s", deployment.Name, updatedReplicas, age); err != nil {
|
||||
if _, err := fmt.Fprintf(w, "%s\t%d\t%d\t%d\t%d\t%s", deployment.Name, desiredReplicas, currentReplicas, updatedReplicas, availableReplicas, age); err != nil {
|
||||
return err
|
||||
}
|
||||
_, err := fmt.Fprint(w, appendLabels(deployment.Labels, options.ColumnLabels))
|
||||
|
@ -1249,11 +1249,13 @@ func TestPrintDeployment(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Status: extensions.DeploymentStatus{
|
||||
Replicas: 10,
|
||||
UpdatedReplicas: 2,
|
||||
Replicas: 10,
|
||||
UpdatedReplicas: 2,
|
||||
AvailableReplicas: 1,
|
||||
UnavailableReplicas: 4,
|
||||
},
|
||||
},
|
||||
"test1\t2/5\t0s\n",
|
||||
"test1\t5\t10\t2\t1\t0s\n",
|
||||
},
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user