refactor util functions for event recording
refactor util functions for event recording

Kubernetes-commit: 7296288928d347dfb1dcb990d779cdfce96ead1b

kubernetes/apiextensions-apiserver,kubernetes/apiextensions-apiserver