GC: Add check for nil interface
This commit is contained in:
@@ -17,6 +17,8 @@ limitations under the License.
|
||||
package rbac
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
@@ -25,6 +27,10 @@ import (
|
||||
// IsOnlyMutatingGCFields checks finalizers and ownerrefs which GC manipulates
|
||||
// and indicates that only those fields are changing
|
||||
func IsOnlyMutatingGCFields(obj, old runtime.Object, equalities conversion.Equalities) bool {
|
||||
if old == nil || reflect.ValueOf(old).IsNil() {
|
||||
return false
|
||||
}
|
||||
|
||||
// make a copy of the newObj so that we can stomp for comparison
|
||||
copied := obj.DeepCopyObject()
|
||||
copiedMeta, err := meta.Accessor(copied)
|
||||
|
Reference in New Issue
Block a user