Add AGE column
This commit is contained in:
@@ -4,10 +4,12 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/duration"
|
||||
"k8s.io/cli-runtime/pkg/genericclioptions"
|
||||
"k8s.io/cli-runtime/pkg/printers"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
@@ -75,6 +77,7 @@ func print(pods []corev1.Pod) error {
|
||||
{Name: "Name"},
|
||||
{Name: "Ready"},
|
||||
{Name: "Status"},
|
||||
{Name: "Age"},
|
||||
},
|
||||
}
|
||||
for _, pod := range pods {
|
||||
@@ -84,6 +87,7 @@ func print(pods []corev1.Pod) error {
|
||||
pod.Name,
|
||||
containerStatuses(pod),
|
||||
pod.Status.Phase,
|
||||
duration.HumanDuration(time.Since(pod.CreationTimestamp.Time)),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user