Skip to content

Commit cf82fd7

Browse files
dimsMatthew Wong
andcommitted
Treat error decoding a mutating webhook patch as error calling the webhook
Co-Authored-By: Matthew Wong <[email protected]> Signed-off-by: Davanum Srinivas <[email protected]>
1 parent 288b044 commit cf82fd7

File tree

1 file changed

+1
-1
lines changed
  • staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating

1 file changed

+1
-1
lines changed

staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/dispatcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ func (a *mutatingDispatcher) callAttrMutatingHook(ctx context.Context, h *admiss
335335
}
336336
patchObj, err := jsonpatch.DecodePatch(result.Patch)
337337
if err != nil {
338-
return false, apierrors.NewInternalError(err)
338+
return false, &webhookutil.ErrCallingWebhook{WebhookName: h.Name, Reason: fmt.Errorf("received undecodable patch in webhook response: %w", err), Status: apierrors.NewServiceUnavailable("error decoding patch in webhook response")}
339339
}
340340

341341
if len(patchObj) == 0 {

0 commit comments

Comments
 (0)