mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
Merge pull request #21351 from smarterclayton/optional_pod_status
Auto commit by PR queue bot
This commit is contained in:
commit
e34a23b289
@ -326,9 +326,9 @@ runTests() {
|
|||||||
kube::test::get_object_jsonpath_assert 'pod/valid-pod' "{$id_field}" 'valid-pod'
|
kube::test::get_object_jsonpath_assert 'pod/valid-pod' "{$id_field}" 'valid-pod'
|
||||||
kube::test::get_object_jsonpath_assert 'pods/valid-pod' "{$id_field}" 'valid-pod'
|
kube::test::get_object_jsonpath_assert 'pods/valid-pod' "{$id_field}" 'valid-pod'
|
||||||
# Describe command should print detailed information
|
# Describe command should print detailed information
|
||||||
kube::test::describe_object_assert pods 'valid-pod' "Name:" "Image(s):" "Node:" "Labels:" "Status:" "Controllers"
|
kube::test::describe_object_assert pods 'valid-pod' "Name:" "Image:" "Node:" "Labels:" "Status:" "Controllers"
|
||||||
# Describe command (resource only) should print detailed information
|
# Describe command (resource only) should print detailed information
|
||||||
kube::test::describe_resource_assert pods "Name:" "Image(s):" "Node:" "Labels:" "Status:" "Controllers"
|
kube::test::describe_resource_assert pods "Name:" "Image:" "Node:" "Labels:" "Status:" "Controllers"
|
||||||
|
|
||||||
### Validate Export ###
|
### Validate Export ###
|
||||||
kube::test::get_object_assert 'pods/valid-pod' "{{.metadata.namespace}} {{.metadata.name}}" '<no value> valid-pod' "--export=true"
|
kube::test::get_object_assert 'pods/valid-pod' "{{.metadata.namespace}} {{.metadata.name}}" '<no value> valid-pod' "--export=true"
|
||||||
|
@ -455,7 +455,6 @@ func describePod(pod *api.Pod, events *api.EventList) (string, error) {
|
|||||||
return tabbedString(func(out io.Writer) error {
|
return tabbedString(func(out io.Writer) error {
|
||||||
fmt.Fprintf(out, "Name:\t%s\n", pod.Name)
|
fmt.Fprintf(out, "Name:\t%s\n", pod.Name)
|
||||||
fmt.Fprintf(out, "Namespace:\t%s\n", pod.Namespace)
|
fmt.Fprintf(out, "Namespace:\t%s\n", pod.Namespace)
|
||||||
fmt.Fprintf(out, "Image(s):\t%s\n", makeImageList(&pod.Spec))
|
|
||||||
fmt.Fprintf(out, "Node:\t%s\n", pod.Spec.NodeName+"/"+pod.Status.HostIP)
|
fmt.Fprintf(out, "Node:\t%s\n", pod.Spec.NodeName+"/"+pod.Status.HostIP)
|
||||||
if pod.Status.StartTime != nil {
|
if pod.Status.StartTime != nil {
|
||||||
fmt.Fprintf(out, "Start Time:\t%s\n", pod.Status.StartTime.Time.Format(time.RFC1123Z))
|
fmt.Fprintf(out, "Start Time:\t%s\n", pod.Status.StartTime.Time.Format(time.RFC1123Z))
|
||||||
@ -467,8 +466,12 @@ func describePod(pod *api.Pod, events *api.EventList) (string, error) {
|
|||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(out, "Status:\t%s\n", string(pod.Status.Phase))
|
fmt.Fprintf(out, "Status:\t%s\n", string(pod.Status.Phase))
|
||||||
}
|
}
|
||||||
|
if len(pod.Status.Reason) > 0 {
|
||||||
fmt.Fprintf(out, "Reason:\t%s\n", pod.Status.Reason)
|
fmt.Fprintf(out, "Reason:\t%s\n", pod.Status.Reason)
|
||||||
|
}
|
||||||
|
if len(pod.Status.Message) > 0 {
|
||||||
fmt.Fprintf(out, "Message:\t%s\n", pod.Status.Message)
|
fmt.Fprintf(out, "Message:\t%s\n", pod.Status.Message)
|
||||||
|
}
|
||||||
fmt.Fprintf(out, "IP:\t%s\n", pod.Status.PodIP)
|
fmt.Fprintf(out, "IP:\t%s\n", pod.Status.PodIP)
|
||||||
fmt.Fprintf(out, "Controllers:\t%s\n", printControllers(pod.Annotations))
|
fmt.Fprintf(out, "Controllers:\t%s\n", printControllers(pod.Annotations))
|
||||||
fmt.Fprintf(out, "Containers:\n")
|
fmt.Fprintf(out, "Containers:\n")
|
||||||
|
@ -567,14 +567,15 @@ var _ = Describe("Kubectl client", func() {
|
|||||||
requiredStrings := [][]string{
|
requiredStrings := [][]string{
|
||||||
{"Name:", "redis-master-"},
|
{"Name:", "redis-master-"},
|
||||||
{"Namespace:", ns},
|
{"Namespace:", ns},
|
||||||
{"Image(s):", "redis"},
|
|
||||||
{"Node:"},
|
{"Node:"},
|
||||||
{"Labels:", "app=redis", "role=master"},
|
{"Labels:", "app=redis", "role=master"},
|
||||||
{"Status:", "Running"},
|
{"Status:", "Running"},
|
||||||
{"Reason:"},
|
|
||||||
{"Message:"},
|
|
||||||
{"IP:"},
|
{"IP:"},
|
||||||
{"Controllers:", "ReplicationController/redis-master"}}
|
{"Controllers:", "ReplicationController/redis-master"},
|
||||||
|
{"Image:", "redis"},
|
||||||
|
{"cpu:", "BestEffort"},
|
||||||
|
{"State:", "Running"},
|
||||||
|
}
|
||||||
checkOutput(output, requiredStrings)
|
checkOutput(output, requiredStrings)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user