mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-07 00:17:13 +00:00
* Added k8s version check for mutating and validating' * version check adde * middelware added * formate * Added timeout flag value to webhook server timeout middelware and refactore kubernetes version check * Fixed test cases * Removed log * Update kubernetes version check * Added check for mutate and validate * Skip Validation in handleValidateAdmissionRequest if kubernetes version is below 1.14 * Update return object AdmissionResponse * fixed condition for skiping mutation * Handle condition for skip feature in case of kubernetes version 1.14.2
15 lines
337 B
Go
15 lines
337 B
Go
package webhooks
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
func timeoutHandler(h http.Handler, timeout time.Duration) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
var timeoutHandler http.Handler
|
|
msg := "ok"
|
|
timeoutHandler = http.TimeoutHandler(h, timeout*time.Second, msg)
|
|
timeoutHandler.ServeHTTP(w, r)
|
|
}
|
|
}
|