Merge pull request #6026 from dchen1107/clean

kubectl describe nodes id reports related events
This commit is contained in:
Vish Kannan
2015-03-26 17:39:21 -07:00
3 changed files with 15 additions and 4 deletions

View File

@@ -25,7 +25,9 @@ import (
// ValidateEvent makes sure that the event makes sense. // ValidateEvent makes sure that the event makes sense.
func ValidateEvent(event *api.Event) errs.ValidationErrorList { func ValidateEvent(event *api.Event) errs.ValidationErrorList {
allErrs := 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")) allErrs = append(allErrs, errs.NewFieldInvalid("involvedObject.namespace", event.InvolvedObject.Namespace, "namespace does not match involvedObject"))
} }
if !util.IsDNS1123Subdomain(event.Namespace) { if !util.IsDNS1123Subdomain(event.Namespace) {

View File

@@ -27,6 +27,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client" "github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" "github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
"github.com/golang/glog" "github.com/golang/glog"
) )
@@ -366,7 +367,14 @@ func (d *NodeDescriber) Describe(namespace, name string) (string, error) {
pods = append(pods, pod) 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) return describeNode(node, pods, events)
} }

View File

@@ -1998,11 +1998,12 @@ func (kl *Kubelet) BirthCry() {
// Make an event that kubelet restarted. // Make an event that kubelet restarted.
// TODO: get the real minion object of ourself, // TODO: get the real minion object of ourself,
// and use the real minion name and UID. // and use the real minion name and UID.
// TODO: what is namespace for node?
ref := &api.ObjectReference{ ref := &api.ObjectReference{
Kind: "Minion", Kind: "Node",
Name: kl.hostname, Name: kl.hostname,
UID: types.UID(kl.hostname), UID: types.UID(kl.hostname),
Namespace: api.NamespaceDefault, Namespace: "",
} }
kl.recorder.Eventf(ref, "starting", "Starting kubelet.") kl.recorder.Eventf(ref, "starting", "Starting kubelet.")
} }