Skip to content

Commit

Permalink
Fixes an error when mutating a pod. K8s was logging an error about an…
Browse files Browse the repository at this point in the history
… internal error because the kind was / instead of AdmissionReview (kubeflow#1421)

Changed where we set Response
  • Loading branch information
ssullivan authored Dec 3, 2021
1 parent ba16242 commit 2919f52
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,12 @@ func (wh *WebHook) serve(w http.ResponseWriter, r *http.Request) {
return
}

response := admissionv1.AdmissionReview{}
response := admissionv1.AdmissionReview{
TypeMeta: metav1.TypeMeta{APIVersion: "admission.k8s.io/v1", Kind: "AdmissionReview"},
Response: reviewResponse,
}

if reviewResponse != nil {
response.Response = reviewResponse
if review.Request != nil {
response.Response.UID = review.Request.UID
}
Expand Down

0 comments on commit 2919f52

Please sign in to comment.