Skip to content

Commit

Permalink
Set Forbidden as the response status reason
Browse files Browse the repository at this point in the history
  • Loading branch information
regadas committed Nov 25, 2021
1 parent f93a538 commit 7a15dd5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/webhook/policy.go
Expand Up @@ -189,14 +189,14 @@ func (h *validationHandler) Handle(ctx context.Context, req admission.Request) a
denyMsgs, warnMsgs := h.getValidationMessages(res, &req)

if len(denyMsgs) > 0 {
vResp := admission.Denied(strings.Join(denyMsgs, "\n"))
vResp := admission.Denied(string(metav1.StatusReasonForbidden))
if vResp.Result == nil {
vResp.Result = &metav1.Status{}
}
if len(warnMsgs) > 0 {
vResp.Warnings = warnMsgs
}
vResp.Result.Code = http.StatusForbidden
vResp.Result.Message = strings.Join(denyMsgs, "\n")
requestResponse = denyResponse
return vResp
}
Expand Down

0 comments on commit 7a15dd5

Please sign in to comment.