Skip to content

Commit

Permalink
Merge pull request #1970 from Tomy2e/panic-conversion-webhook
Browse files Browse the repository at this point in the history
馃悰 Conversion webhook should not panic when conversion request is nil
  • Loading branch information
k8s-ci-robot committed Sep 26, 2022
2 parents c83076e + 07ba0bc commit 78b203b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/webhook/conversion/conversion.go
Expand Up @@ -69,6 +69,12 @@ func (wh *Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}

if convertReview.Request == nil {
log.Error(nil, "conversion request is nil")
w.WriteHeader(http.StatusBadRequest)
return
}

// TODO(droot): may be move the conversion logic to a separate module to
// decouple it from the http layer ?
resp, err := wh.handleConvertRequest(convertReview.Request)
Expand Down

0 comments on commit 78b203b

Please sign in to comment.