From 940276961b28a362989aa2f47229de5260bea25d Mon Sep 17 00:00:00 2001 From: Dave Protasowski Date: Wed, 24 Jun 2020 10:24:39 -0400 Subject: [PATCH 1/2] use webhook v1 APIs --- config/core/webhooks/configmap-validation.yaml | 5 ++--- config/core/webhooks/defaulting.yaml | 5 ++--- config/core/webhooks/resource-validation.yaml | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/config/core/webhooks/configmap-validation.yaml b/config/core/webhooks/configmap-validation.yaml index 18f9461f4c7f..f0b476dc217a 100644 --- a/config/core/webhooks/configmap-validation.yaml +++ b/config/core/webhooks/configmap-validation.yaml @@ -12,15 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: admissionregistration.k8s.io/v1beta1 +apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration metadata: name: config.webhook.serving.knative.dev labels: serving.knative.dev/release: devel webhooks: -- admissionReviewVersions: - - v1beta1 +- admissionReviewVersions: ["v1", "v1beta1"] clientConfig: service: name: webhook diff --git a/config/core/webhooks/defaulting.yaml b/config/core/webhooks/defaulting.yaml index 18b66f43f70e..6c59eea06db9 100644 --- a/config/core/webhooks/defaulting.yaml +++ b/config/core/webhooks/defaulting.yaml @@ -12,15 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: admissionregistration.k8s.io/v1beta1 +apiVersion: admissionregistration.k8s.io/v1 kind: MutatingWebhookConfiguration metadata: name: webhook.serving.knative.dev labels: serving.knative.dev/release: devel webhooks: -- admissionReviewVersions: - - v1beta1 +- admissionReviewVersions: ["v1", "v1beta1"] clientConfig: service: name: webhook diff --git a/config/core/webhooks/resource-validation.yaml b/config/core/webhooks/resource-validation.yaml index 2e7c9af8b303..d19d5b7ad40d 100644 --- a/config/core/webhooks/resource-validation.yaml +++ b/config/core/webhooks/resource-validation.yaml @@ -12,15 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: admissionregistration.k8s.io/v1beta1 +apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration metadata: name: validation.webhook.serving.knative.dev labels: serving.knative.dev/release: devel webhooks: -- admissionReviewVersions: - - v1beta1 +- admissionReviewVersions: ["v1", "v1beta1"] clientConfig: service: name: webhook From 78be137d7b860dcb69bdd6bab7b4a84c76805072 Mon Sep 17 00:00:00 2001 From: Dave Protasowski Date: Wed, 24 Jun 2020 11:57:50 -0400 Subject: [PATCH 2/2] bump knative.dev/pkg --- go.mod | 2 +- go.sum | 4 ++-- vendor/knative.dev/pkg/webhook/admission.go | 8 +++++++- vendor/modules.txt | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index ce6aed1a9a1a..6d16ac51bddf 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29 knative.dev/caching v0.0.0-20200606210318-787aec80f71c knative.dev/networking v0.0.0-20200623230227-53e376c3ec4c - knative.dev/pkg v0.0.0-20200623204627-e0a0d63a9e86 + knative.dev/pkg v0.0.0-20200624155427-5be32bbb99ab knative.dev/test-infra v0.0.0-20200623231727-6d5d6aeb457c ) diff --git a/go.sum b/go.sum index 80c8e353a9f1..b281055812cf 100644 --- a/go.sum +++ b/go.sum @@ -1393,8 +1393,8 @@ knative.dev/pkg v0.0.0-20200611204322-2ddcfef739a2/go.mod h1:rA+FklsrVahwF4a+D63 knative.dev/pkg v0.0.0-20200619020725-7df8fc5d7743/go.mod h1:DquzK0hsLDcg2q63Sn+CngAyRwv4cKMpt5F19YzBfb0= knative.dev/pkg v0.0.0-20200623024526-fb0320d9287e h1:fmsw4i/We4S9yyaZadL2z8DKDIz7XzcY/v4yPGUmUA4= knative.dev/pkg v0.0.0-20200623024526-fb0320d9287e/go.mod h1:DquzK0hsLDcg2q63Sn+CngAyRwv4cKMpt5F19YzBfb0= -knative.dev/pkg v0.0.0-20200623204627-e0a0d63a9e86 h1:Ihxd/dMGFtVxrURj7NknkQlA7QmgCh63o10eQ8BlO/4= -knative.dev/pkg v0.0.0-20200623204627-e0a0d63a9e86/go.mod h1:DquzK0hsLDcg2q63Sn+CngAyRwv4cKMpt5F19YzBfb0= +knative.dev/pkg v0.0.0-20200624155427-5be32bbb99ab h1:Alotvu0cJmIfbSitcmcCe39M2WZ430DO9GnsidpR7CM= +knative.dev/pkg v0.0.0-20200624155427-5be32bbb99ab/go.mod h1:DquzK0hsLDcg2q63Sn+CngAyRwv4cKMpt5F19YzBfb0= knative.dev/sample-controller v0.0.0-20200510050845-bf7c19498b7e/go.mod h1:D2ZDLrR9Dq9LiiVN7TatzI7WMcEPgk1MHbbhgBKE6W8= knative.dev/test-infra v0.0.0-20200407185800-1b88cb3b45a5/go.mod h1:xcdUkMJrLlBswIZqL5zCuBFOC22WIPMQoVX1L35i0vQ= knative.dev/test-infra v0.0.0-20200505052144-5ea2f705bb55/go.mod h1:WqF1Azka+FxPZ20keR2zCNtiQA1MP9ZB4BH4HuI+SIU= diff --git a/vendor/knative.dev/pkg/webhook/admission.go b/vendor/knative.dev/pkg/webhook/admission.go index 086f39dab147..46d4c08c4e90 100644 --- a/vendor/knative.dev/pkg/webhook/admission.go +++ b/vendor/knative.dev/pkg/webhook/admission.go @@ -88,7 +88,13 @@ func admissionHandler(rootLogger *zap.SugaredLogger, stats StatsReporter, c Admi ctx := logging.WithLogger(r.Context(), logger) - var response admissionv1.AdmissionReview + response := admissionv1.AdmissionReview{ + // Use the same type meta as the request - this is required by the K8s API + // note: v1beta1 & v1 AdmissionReview shapes are identical so even though + // we're using v1 types we still support v1beta1 admission requests + TypeMeta: review.TypeMeta, + } + reviewResponse := c.Admit(ctx, review.Request) var patchType string if reviewResponse.PatchType != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 890b498cb67b..005a633bc9aa 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1033,7 +1033,7 @@ knative.dev/networking/pkg/client/injection/informers/networking/v1alpha1/server knative.dev/networking/pkg/client/injection/reconciler/networking/v1alpha1/serverlessservice knative.dev/networking/pkg/client/istio/listers/networking/v1alpha3 knative.dev/networking/pkg/client/listers/networking/v1alpha1 -# knative.dev/pkg v0.0.0-20200623204627-e0a0d63a9e86 +# knative.dev/pkg v0.0.0-20200624155427-5be32bbb99ab ## explicit knative.dev/pkg/apiextensions/storageversion knative.dev/pkg/apiextensions/storageversion/cmd/migrate