mirror of https://github.com/k3s-io/k3s
Merge pull request #4886 from brendandburns/kubecfg
Add a "Created" column to the pod view.pull/6/head
commit
537d8cf26f
|
@ -33,6 +33,7 @@ import (
|
|||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
||||
"github.com/docker/docker/pkg/units"
|
||||
"github.com/ghodss/yaml"
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
@ -217,7 +218,7 @@ func (h *HumanReadablePrinter) validatePrintHandlerFunc(printFunc reflect.Value)
|
|||
return nil
|
||||
}
|
||||
|
||||
var podColumns = []string{"POD", "IP", "CONTAINER(S)", "IMAGE(S)", "HOST", "LABELS", "STATUS"}
|
||||
var podColumns = []string{"POD", "IP", "CONTAINER(S)", "IMAGE(S)", "HOST", "LABELS", "STATUS", "CREATED"}
|
||||
var replicationControllerColumns = []string{"CONTROLLER", "CONTAINER(S)", "IMAGE(S)", "SELECTOR", "REPLICAS"}
|
||||
var serviceColumns = []string{"NAME", "LABELS", "SELECTOR", "IP", "PORT"}
|
||||
var endpointColumns = []string{"NAME", "ENDPOINTS"}
|
||||
|
@ -296,20 +297,21 @@ func printPod(pod *api.Pod, w io.Writer) error {
|
|||
if len(containers) > 0 {
|
||||
firstContainer, containers = containers[0], containers[1:]
|
||||
}
|
||||
_, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s\n",
|
||||
_, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",
|
||||
pod.Name,
|
||||
pod.Status.PodIP,
|
||||
firstContainer.Name,
|
||||
firstContainer.Image,
|
||||
podHostString(pod.Status.Host, pod.Status.HostIP),
|
||||
formatLabels(pod.Labels),
|
||||
pod.Status.Phase)
|
||||
pod.Status.Phase,
|
||||
units.HumanDuration(time.Now().Sub(pod.CreationTimestamp.Time)))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Lay out all the other containers on separate lines.
|
||||
for _, container := range containers {
|
||||
_, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "", "", container.Name, container.Image, "", "", "")
|
||||
_, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "", "", container.Name, container.Image, "", "", "", "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue