func (r *Registry) ValidateUpdate(req *admissionv1.AdmissionRequest, oldObj, obj runtime.Object, requestVersion schema.GroupVersionKind) (field.ErrorList, []string) {
	versioned, internal := r.lookupValidateUpdateFuncs(requestVersion)
	if versioned == nil && internal == nil {
		return nil, nil
	}
	targetOldObj, internalOldObj, err := r.convert(oldObj, requestVersion)
	if err != nil {
		return internalError(err), nil
	}
	targetObj, internalObj, err := r.convert(obj, requestVersion)
	if err != nil {
		return internalError(err), nil
	}
	el := field.ErrorList{}
	warnings := WarningList{}
	if versioned != nil {
		e, w := versioned(req, targetOldObj, targetObj)
		el, warnings = append(el, e...), append(warnings, w...)
	}
	if internal != nil {
		e, w := internal(req, internalOldObj, internalObj)
		el, warnings = append(el, e...), append(warnings, w...)
	}
	return el, warnings
}
ValidateUpdate will run all update validation functions registered for the
given object.
If the passed objects are *not* of the same version as the provided
requestVersion, the registry will attempt to convert the objects before
calling the validation functions.
Any validation functions registered for the objects internal API version
will be run against the object regardless of version.
package validation
import (
	admissionv1 "k8s.io/api/admission/v1"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/apimachinery/pkg/util/validation/field"
)
type Registry struct {
	scheme                 *runtime.Scheme
	validateRegister       map[schema.GroupVersionKind]ValidateFunc
	validateUpdateRegister map[schema.GroupVersionKind]ValidateUpdateFunc
}
type ValidateFunc func(req *admissionv1.AdmissionRequest, obj runtime.Object) (field.ErrorList, WarningList)
type ValidateUpdateFunc func(req *admissionv1.AdmissionRequest, oldObj, obj runtime.Object) (field.ErrorList, WarningList)
func NewRegistry(scheme *runtime.Scheme) *Registry {
	return &Registry{
		scheme:                 scheme,
		validateRegister:       make(map[schema.GroupVersionKind]ValidateFunc),
		validateUpdateRegister: make(map[schema.GroupVersionKind]ValidateUpdateFunc),
	}
}
func (r *Registry) AddValidateFunc(obj runtime.Object, fn ValidateFunc) error {
	gvks, _, err := r.scheme.ObjectKinds(obj)
	if err != nil {
		return err
	}
	for _, gvk := range gvks {
		r.appendValidate(gvk, fn)
	}
	return nil
}
func (r *Registry) AddValidateUpdateFunc(obj runtime.Object, fn ValidateUpdateFunc) error {
	gvks, _, err := r.scheme.ObjectKinds(obj)
	if err != nil {
		return err
	}
	for _, gvk := range gvks {
		r.appendValidateUpdate(gvk, fn)
	}
	return nil
}
func (r *Registry) Validate(req *admissionv1.AdmissionRequest, obj runtime.Object, requestVersion schema.GroupVersionKind) (field.ErrorList, WarningList) {
	versioned, internal := r.lookupValidateFuncs(requestVersion)
	if versioned == nil && internal == nil {
		return nil, nil
	}
	targetObj, internalObj, err := r.convert(obj, requestVersion)
	if err != nil {
		return internalError(err), nil
	}
	el := field.ErrorList{}
	warnings := WarningList{}
	if versioned != nil {
		e, w := versioned(req, targetObj)
		el, warnings = append(el, e...), append(warnings, w...)
	}
	if internal != nil {
		e, w := internal(req, internalObj)
		el, warnings = append(el, e...), append(warnings, w...)
	}
	return el, warnings
}