mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Allow ObjectReferences to be passed to Eventf
... in place of the object they reference.
This commit is contained in:
		@@ -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() {}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user