mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-02 01:39:02 +00:00
Send correct headers for pod printing
This commit is contained in:
@@ -84,6 +84,7 @@ func AddHandlers(h printers.PrintHandler) {
|
||||
{Name: "Age", Type: "string", Description: metav1.ObjectMeta{}.SwaggerDoc()["creationTimestamp"]},
|
||||
{Name: "IP", Type: "string", Priority: 1, Description: apiv1.PodStatus{}.SwaggerDoc()["podIP"]},
|
||||
{Name: "Node", Type: "string", Priority: 1, Description: apiv1.PodSpec{}.SwaggerDoc()["nodeName"]},
|
||||
{Name: "Nominated Node", Type: "string", Priority: 1, Description: apiv1.PodStatus{}.SwaggerDoc()["nominatedNodeName"]},
|
||||
}
|
||||
h.TableHandler(podColumnDefinitions, printPodList)
|
||||
h.TableHandler(podColumnDefinitions, printPod)
|
||||
@@ -632,6 +633,7 @@ func printPod(pod *api.Pod, options printers.PrintOptions) ([]metav1beta1.TableR
|
||||
|
||||
if options.Wide {
|
||||
nodeName := pod.Spec.NodeName
|
||||
nominatedNodeName := pod.Status.NominatedNodeName
|
||||
podIP := pod.Status.PodIP
|
||||
if podIP == "" {
|
||||
podIP = "<none>"
|
||||
@@ -639,10 +641,10 @@ func printPod(pod *api.Pod, options printers.PrintOptions) ([]metav1beta1.TableR
|
||||
if nodeName == "" {
|
||||
nodeName = "<none>"
|
||||
}
|
||||
row.Cells = append(row.Cells, podIP, nodeName)
|
||||
if len(pod.Status.NominatedNodeName) > 0 {
|
||||
row.Cells = append(row.Cells, pod.Status.NominatedNodeName)
|
||||
if nominatedNodeName == "" {
|
||||
nominatedNodeName = "<none>"
|
||||
}
|
||||
row.Cells = append(row.Cells, podIP, nodeName, nominatedNodeName)
|
||||
}
|
||||
|
||||
return []metav1beta1.TableRow{row}, nil
|
||||
|
Reference in New Issue
Block a user