Red Hat Bugzilla – Bug 1605229
MutatingAdmissionWebhook hardcoded to return as ERROR
Last modified: 2018-10-08 06:44:45 EDT
Description of problem: Using MutatingAdmissionWebhook the message is reflected in the response but the status code/reason suggests to the end user that there is an error rather than being a valid informational message. Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
Which message exactly? This needs more detail.
Regardless of the status code returned by an admission webhook, a 500 error code is returned to the client. Only the 'message' is retained. Eg. When trying to create a project (namespace) the below json is returned from the webhook. { "kind": "AdmissionReview", "apiVersion": "admission.k8s.io/v1beta1", "response": { "uid": "<request uid>", "allowed": false, "status": { "status": "Failure", "message": "Not a valid project name", "reason": "Invalid", "details": { "name": "test" }, "code": 422 } } } But the below json is returned to the client. [{ "metadata": {}, "status": "Failure", "message": "Internal error occurred: admission webhook \"validator.example.com\" denied the request: Not a valid project name", "reason": "InternalError", "details": { "causes": [ { "message": "admission webhook \"validator.example.com\" denied the request: Not a valid project name" } ] }, "code": 500 }]
Worked on upstream: https://github.com/kubernetes/kubernetes/pull/69520