mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-11 14:11:14 +00:00
Make fieldPath part of getting a reference rather than part of making an event.
This commit is contained in:
@@ -62,6 +62,16 @@ func GetReference(obj runtime.Object) (*ObjectReference, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
// GetPartialReference is exactly like GetReference, but allows you to set the FieldPath.
|
||||
func GetPartialReference(obj runtime.Object, fieldPath string) (*ObjectReference, error) {
|
||||
ref, err := GetReference(obj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ref.FieldPath = fieldPath
|
||||
return ref, 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