Merge pull request #2161 from CharlesQQ/callwebhook-fix

fix: fix applyPatch when patch and patchType is nil
This commit is contained in:
karmada-bot 2022-07-12 11:15:35 +08:00 committed by GitHub
commit eff20f2a2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -251,6 +251,10 @@ func (e *CustomizedInterpreter) callHook(ctx context.Context, hook configmanager
// applyPatch uses patchType mode to patch object.
func applyPatch(object *unstructured.Unstructured, patch []byte, patchType configv1alpha1.PatchType) (*unstructured.Unstructured, error) {
if len(patch) == 0 && len(patchType) == 0 {
klog.Infof("Skip apply patch for object(%s: %s) as patch and patchType is nil", object.GroupVersionKind().String(), object.GetName())
return object, nil
}
switch patchType {
case configv1alpha1.PatchTypeJSONPatch:
if len(patch) == 0 {