From 60a8f7bc55bc67f74bdbbe4ab90d246d90abec83 Mon Sep 17 00:00:00 2001 From: shivdudhani Date: Tue, 21 May 2019 20:53:29 -0700 Subject: [PATCH] remove the checks on resouce kinds as we support everything --- client/client.go | 9 --------- pkg/webhooks/server.go | 12 +++++------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/client/client.go b/client/client.go index 91483f0dd9..bb9efd61e4 100644 --- a/client/client.go +++ b/client/client.go @@ -4,7 +4,6 @@ import ( "fmt" "log" "os" - "strings" "time" types "github.com/nirmata/kyverno/pkg/apis/policy/v1alpha1" @@ -307,11 +306,3 @@ func (c *Client) waitUntilNamespaceIsCreated(name string) error { } return lastError } - -// KindIsSupported checks if the kind is a registerd GVK -func (c *Client) KindIsSupported(kind string) bool { - kind = strings.ToLower(kind) + "s" - buildGVKMapper(c.clientConfig, false) - _, ok := getValue(kind) - return ok -} diff --git a/pkg/webhooks/server.go b/pkg/webhooks/server.go index c588216ddf..fc21a0b9aa 100644 --- a/pkg/webhooks/server.go +++ b/pkg/webhooks/server.go @@ -87,13 +87,11 @@ func (ws *WebhookServer) serve(w http.ResponseWriter, r *http.Request) { admissionReview.Response = &v1beta1.AdmissionResponse{ Allowed: true, } - if ws.client.KindIsSupported(admissionReview.Request.Kind.Kind) { - switch r.URL.Path { - case config.MutatingWebhookServicePath: - admissionReview.Response = ws.HandleMutation(admissionReview.Request) - case config.ValidatingWebhookServicePath: - admissionReview.Response = ws.HandleValidation(admissionReview.Request) - } + switch r.URL.Path { + case config.MutatingWebhookServicePath: + admissionReview.Response = ws.HandleMutation(admissionReview.Request) + case config.ValidatingWebhookServicePath: + admissionReview.Response = ws.HandleValidation(admissionReview.Request) } admissionReview.Response.UID = admissionReview.Request.UID