slok/kubewebhook

apiversion and kind not provide in response

cocotyty opened this issue · 4 comments

error msg:
expected webhook response of admission.k8s.io/v1, Kind=AdmissionReview, got /, Kind=;

response:
{"response":{"uid":"a7aa4dca-6f37-4e74-9041-c7de0a120c23","allowed":true,"patch":"W3sib3AiOiJhZGQiLCJwYXRoIjoiL21ldGFkYXRhL2Fubm90YXRpb25zL211dGF0ZWQiLCJ2YWx1ZSI6InRydWUifSx7Im9wIjoiYWRkIiwicGF0aCI6Ii9tZXRhZGF0YS9hbm5vdGF0aW9ucy9tdXRhdG9yIiwidmFsdWUiOiJwb2QtYW5ub3RhdGUifV0=","patchType":"JSONPatch"}}

my k8s version:
v1.17.2

slok commented

Hi @cocotyty !

Could you explain better the problem? e.g

  • Why and where do you need that?
  • What is not working for you?
  • When does this happen?
    ...

Thanks!

I use this library to modify specific pods. I deployed the webhook program and applied MutatingWebhookConfiguration. When I tried to create a deployment, I found that this error occurred, causing the pod to fail to create.

The response in the above description is what I try to print the actual content returned by the webhook program.

This looks different from the response format described in the official documentation.

https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#response

Thank you for your awesome library and your kindly answers.

slok commented

Hi @cocotyty Sorry for the delay, I missed the issue and forgot to respond earlier.

What is the webhook configuration manifest you are using?

I ask this because Kubewebhook only supports v1beta1 and maybe you are expecting v1...
There is a setting on the manifest to specify:

admissionReviewVersions:
  - v1
  - v1beta1

Check this issue, it happened to others: kubernetes/kubernetes#85681

slok commented

Hey @cocotyty!

I'm closing this, if you continue with the error after checking the latest comment I let you some days ago, please reopen the issue :)