diff --git a/main.go b/main.go index 372bdcb..35ee029 100644 --- a/main.go +++ b/main.go @@ -59,6 +59,7 @@ func main() { func imagineHandler(imageName string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { + log.Printf("Received request: %s %s", r.Method, r.URL.Path) if r.Method != http.MethodPost { if r.Method == http.MethodGet { w.WriteHeader(http.StatusOK) @@ -78,6 +79,12 @@ func imagineHandler(imageName string) http.HandlerFunc { return } + if admissionReview.Request == nil { + log.Printf("AdmissionReview.Request is nil") + http.Error(w, "invalid admission review request", http.StatusBadRequest) + return + } + var pod corev1.Pod if err := json.Unmarshal(admissionReview.Request.Object.Raw, &pod); err != nil { log.Printf("Failed to decode pod spec: %v", err)