Treat error decoding a mutating webhook patch as error calling the webhook

Co-Authored-By: Matthew Wong <mattwon@amazon.com>
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: cf82fd7e9ceac60b7a336c90958835865c4f2f0a
This commit is contained in:
Davanum Srinivas 2024-10-23 15:52:41 -07:00 committed by Kubernetes Publisher
parent 23913f0bf4
commit 0f91510ab0
1 changed files with 1 additions and 1 deletions

View File

@ -335,7 +335,7 @@ func (a *mutatingDispatcher) callAttrMutatingHook(ctx context.Context, h *admiss
}
patchObj, err := jsonpatch.DecodePatch(result.Patch)
if err != nil {
return false, apierrors.NewInternalError(err)
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")}
}
if len(patchObj) == 0 {