mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
commit
8329b7d624
@ -532,6 +532,7 @@ func Example_printPodWithWideFormat() {
|
|||||||
{Ready: true, RestartCount: 3, State: api.ContainerState{Running: &api.ContainerStateRunning{}}},
|
{Ready: true, RestartCount: 3, State: api.ContainerState{Running: &api.ContainerStateRunning{}}},
|
||||||
{RestartCount: 3},
|
{RestartCount: 3},
|
||||||
},
|
},
|
||||||
|
PodIP: "10.1.1.3",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
mapper, _ := f.Object(false)
|
mapper, _ := f.Object(false)
|
||||||
@ -540,8 +541,8 @@ func Example_printPodWithWideFormat() {
|
|||||||
fmt.Printf("Unexpected error: %v", err)
|
fmt.Printf("Unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
// Output:
|
// Output:
|
||||||
// NAME READY STATUS RESTARTS AGE NODE
|
// NAME READY STATUS RESTARTS AGE IP NODE
|
||||||
// test1 1/2 podPhase 6 10y kubernetes-minion-abcd
|
// test1 1/2 podPhase 6 10y 10.1.1.3 kubernetes-minion-abcd
|
||||||
}
|
}
|
||||||
|
|
||||||
func Example_printPodWithShowLabels() {
|
func Example_printPodWithShowLabels() {
|
||||||
|
@ -634,7 +634,12 @@ func printPodBase(pod *api.Pod, w io.Writer, options PrintOptions) error {
|
|||||||
|
|
||||||
if options.Wide {
|
if options.Wide {
|
||||||
nodeName := pod.Spec.NodeName
|
nodeName := pod.Spec.NodeName
|
||||||
if _, err := fmt.Fprintf(w, "\t%s",
|
podIP := pod.Status.PodIP
|
||||||
|
if podIP == "" {
|
||||||
|
podIP = "<none>"
|
||||||
|
}
|
||||||
|
if _, err := fmt.Fprintf(w, "\t%s\t%s",
|
||||||
|
podIP,
|
||||||
nodeName,
|
nodeName,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1780,7 +1785,7 @@ func formatLabelHeaders(columnLabels []string) []string {
|
|||||||
func formatWideHeaders(wide bool, t reflect.Type) []string {
|
func formatWideHeaders(wide bool, t reflect.Type) []string {
|
||||||
if wide {
|
if wide {
|
||||||
if t.String() == "*api.Pod" || t.String() == "*api.PodList" {
|
if t.String() == "*api.Pod" || t.String() == "*api.PodList" {
|
||||||
return []string{"NODE"}
|
return []string{"IP", "NODE"}
|
||||||
}
|
}
|
||||||
if t.String() == "*api.ReplicationController" || t.String() == "*api.ReplicationControllerList" {
|
if t.String() == "*api.ReplicationController" || t.String() == "*api.ReplicationControllerList" {
|
||||||
return []string{"CONTAINER(S)", "IMAGE(S)", "SELECTOR"}
|
return []string{"CONTAINER(S)", "IMAGE(S)", "SELECTOR"}
|
||||||
|
Loading…
Reference in New Issue
Block a user