Exemple #1
0
			}
			event, ok := watchEvent.Object.(*api.Event)
			if !ok {
				// This is all local, so there's no reason this should
				// ever happen.
				continue
			}
			f(event)
		}
	}()
	return w
}

const queueLen = 1000

var events = watch.NewMux(queueLen)

// Event constructs an event from the given information and puts it in the queue for sending.
// 'object' is the object this event is about. Event will make a reference-- or you may also
// pass a reference to the object directly.
// 'status' is the new status of the object. 'reason' is the reason it now has this status.
// Both 'status' and 'reason' should be short and unique; they will be used to automate
// handling of events, so imagine people writing switch statements to handle them. You want to
// make that easy.
// 'message' is intended to be human readable.
//
// The resulting event will be created in the same namespace as the reference object.
func Event(object runtime.Object, status, reason, message string) {
	ref, err := api.GetReference(object)
	if err != nil {
		glog.Errorf("Could not construct reference to: '%#v' due to: '%v'. Will not report event: '%v' '%v' '%v'", object, err, status, reason, message)
Exemple #2
0
func NewPodRegistry(pods *api.PodList) *PodRegistry {
	return &PodRegistry{
		Pods: pods,
		mux:  watch.NewMux(0),
	}
}
Exemple #3
0
func NewGeneric(list runtime.Object) *GenericRegistry {
	return &GenericRegistry{
		ObjectList: list,
		Mux:        watch.NewMux(0),
	}
}