Skip to content

Commit

Permalink
Merge pull request kubernetes#6026 from dchen1107/clean
Browse files Browse the repository at this point in the history
kubectl describe nodes id reports related events
  • Loading branch information
vishh committed Mar 27, 2015
2 parents 414973f + 688363a commit f2c7dda
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pkg/api/validation/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import (
// ValidateEvent makes sure that the event makes sense.
func ValidateEvent(event *api.Event) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
if event.Namespace != event.InvolvedObject.Namespace {
// TODO: There is no namespace required for minion
if event.InvolvedObject.Kind != "Node" &&
event.Namespace != event.InvolvedObject.Namespace {
allErrs = append(allErrs, errs.NewFieldInvalid("involvedObject.namespace", event.InvolvedObject.Namespace, "namespace does not match involvedObject"))
}
if !util.IsDNS1123Subdomain(event.Namespace) {
Expand Down
10 changes: 9 additions & 1 deletion pkg/kubectl/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
"github.com/golang/glog"
)

Expand Down Expand Up @@ -366,7 +367,14 @@ func (d *NodeDescriber) Describe(namespace, name string) (string, error) {
pods = append(pods, pod)
}

events, _ := d.Events(namespace).Search(node)
var events *api.EventList
if ref, err := api.GetReference(node); err != nil {
glog.Errorf("Unable to construct reference to '%#v': %v", node, err)
} else {
// TODO: We haven't decided the namespace for Node object yet.
ref.UID = types.UID(ref.Name)
events, _ = d.Events("").Search(ref)
}

return describeNode(node, pods, events)
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -1998,11 +1998,12 @@ func (kl *Kubelet) BirthCry() {
// Make an event that kubelet restarted.
// TODO: get the real minion object of ourself,
// and use the real minion name and UID.
// TODO: what is namespace for node?
ref := &api.ObjectReference{
Kind: "Minion",
Kind: "Node",
Name: kl.hostname,
UID: types.UID(kl.hostname),
Namespace: api.NamespaceDefault,
Namespace: "",
}
kl.recorder.Eventf(ref, "starting", "Starting kubelet.")
}
Expand Down

0 comments on commit f2c7dda

Please sign in to comment.