Change:
Forked from ... The event generated from kubelet for BoundPod and displayed by kubectl should have Container(s) column ; otherwise, the user might think the entire pod is at the running state, but actually only one or some containers are running. When there are missing event(s) for failed containers, the thing gets worse. For example, in case, only net container is running. $ get events | grep testpd Running: cluster/../cluster/gce/../../_output/dockerized/bin/linux/amd64/kubectl get events Mon, 29 Dec 2014 20:58:38 +0000 testpd BoundPod waiting created Created with docker id eb3f53865a8825a3db3b64f6f319b64bfecbcbabc7115a73c2358c8c73793004 Mon, 29 Dec 2014 20:58:38 +0000 testpd Pod Pending scheduled Successfully assigned testpd to kubernetes-minion- Mon, 29 Dec 2014 20:58:38 +0000 testpd BoundPod waiting pulled Successfully pulled image kubernetes/pause:latest Mon, 29 Dec 2014 20:58:39 +0000 testpd BoundPod running started Started with docker id eb3f53865a8825a3db3b64f6f319b64bfecbcbabc7115a73c2358c8c73793004

Discussion:
ResourceVersion string `json:"resourceVersion,omitempty"` // Optional. If referring to a piece of an object instead of an entire object, this string <del> // should contain a valid field access statement. For example, // if the object reference is to a container within a pod, this would take on a value like: // "desiredState.manifest.containers[2]". Such statements are valid language constructs in // both go and JavaScript. This is syntax is chosen only to have some well-defined way of </del> <ins> // should contain information to identify the sub-object. For example, if the object // reference is to a container within a pod, this would take on a value like: // "spec.containers{name}" (where "name" refers to the name of the container that triggered // the event) or if no container name is specified "spec.containers[2]" (container with // index 2 in this pod). This syntax is chosen only to have some well-defined way of </ins> // referencing a part of an object. // TODO: this design is not final and this field is subject to change in the future. FieldPath string `json:"fieldPath,omitempty"`

ResourceVersion string `json:"resourceVersion,omitempty" description:"specific resourceVersion to which this reference is made, if any"` // Optional. If referring to a piece of an object instead of an entire object, this string <del> // should contain a valid field access statement. For example, // if the object reference is to a container within a pod, this would take on a value like: // "desiredState.manifest.containers[2]". Such statements are valid language constructs in // both go and JavaScript. This is syntax is chosen only to have some well-defined way of </del> <ins> // should contain information to identify the sub-object. For example, if the object // reference is to a container within a pod, this would take on a value like: // "spec.containers{name}" (where "name" refers to the name of the container that triggered // the event) or if no container name is specified "spec.containers[2]" (container with // index 2 in this pod). This syntax is chosen only to have some well-defined way of </ins> // referencing a part of an object. // TODO: this design is not final and this field is subject to change in the future. FieldPath string `json:"fieldPath,omitempty" description:"if referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]"`

ResourceVersion string `json:"resourceVersion,omitempty"` // Optional. If referring to a piece of an object instead of an entire object, this string <del> // should contain a valid field access statement. For example, // if the object reference is to a container within a pod, this would take on a value like: // "spec.containers[2]". Such statements are valid language constructs in // both go and JavaScript. This is syntax is chosen only to have some well-defined way of </del> <ins> // should contain information to identify the sub-object. For example, if the object // reference is to a container within a pod, this would take on a value like: // "spec.containers{name}" (where "name" refers to the name of the container that triggered // the event) or if no container name is specified "spec.containers[2]" (container with // index 2 in this pod). This syntax is chosen only to have some well-defined way of </ins> // referencing a part of an object. // TODO: this design is not final and this field is subject to change in the future. FieldPath string `json:"fieldPath,omitempty"`

var serviceColumns = []string{"NAME", "LABELS", "SELECTOR", "IP", "PORT"} var minionColumns = []string{"NAME", "LABELS"} var statusColumns = []string{"STATUS"} <del> var eventColumns = []string{"TIME", "NAME", "KIND", "CONDITION", "REASON", "MESSAGE"} </del> <ins> var eventColumns = []string{"TIME", "NAME", "KIND", "SUBOBJECT", "CONDITION", "REASON", "MESSAGE"} </ins> // addDefaultHandlers adds print handlers for default Kubernetes types. func (h *HumanReadablePrinter) addDefaultHandlers() {

func printEvent(event *api.Event, w io.Writer) error { _, err := fmt.Fprintf( <del> w, "%st%st%st%st%st%sn", </del> <ins> w, "%st%st%st%st%st%st%sn", </ins> event.Timestamp.Time.Format(time.RFC1123Z), event.InvolvedObject.Name, event.InvolvedObject.Kind, <ins> event.InvolvedObject.FieldPath, </ins> event.Condition, event.Reason, event.Message,

for i := range pod.Spec.Containers { here := &pod.Spec.Containers[i] if here.Name == container.Name { <del> return fmt.Sprintf("spec.containers[%d]", i), nil </del> <ins> if here.Name == "" { return fmt.Sprintf("spec.containers[%d]", i), nil } else { return fmt.Sprintf("spec.containers{%s}", here.Name), nil } </ins> } } return "", fmt.Errorf("container %#v not found in pod %#v", container, pod)

pod := &api.BoundPod{Spec: api.PodSpec{Containers: []api.Container{ {Name: "foo"}, {Name: "bar"}, <ins> {Name: ""}, </ins> {Name: "baz"}, }}} table := map[string]struct {

path      string success   bool }{ <del> "basic":            {pod, &api.Container{Name: "foo"}, "spec.containers[0]", true}, "basic2":           {pod, &api.Container{Name: "baz"}, "spec.containers[2]", true}, "basicSamePointer": {pod, &pod.Spec.Containers[0], "spec.containers[0]", true}, </del> <ins> "basic":            {pod, &api.Container{Name: "foo"}, "spec.containers{foo}", true}, "basic2":           {pod, &api.Container{Name: "baz"}, "spec.containers{baz}", true}, "emptyName":        {pod, &api.Container{Name: ""}, "spec.containers[2]", true}, "basicSamePointer": {pod, &pod.Spec.Containers[0], "spec.containers{foo}", true}, </ins> "missing":          {pod, &api.Container{Name: "qux"}, "", false}, }