Commit ecebe958 authored by Daniel Smith's avatar Daniel Smith

Allow ObjectReferences to be passed to Eventf

... in place of the object they reference.
parent f4cffdc7
......@@ -36,6 +36,10 @@ func GetReference(obj runtime.Object) (*ObjectReference, error) {
if obj == nil {
return nil, ErrNilObject
}
if ref, ok := obj.(*ObjectReference); ok {
// Don't make a reference to a reference.
return ref, nil
}
meta, err := meta.Accessor(obj)
if err != nil {
return nil, err
......@@ -57,3 +61,7 @@ func GetReference(obj runtime.Object) (*ObjectReference, error) {
ResourceVersion: meta.ResourceVersion(),
}, nil
}
// Allow clients to preemptively get a reference to an API object and pass it to places that
// intend only to get a reference to that object. This simplifies the event recording interface.
func (*ObjectReference) IsAnAPIObject() {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment