You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by zh...@apache.org on 2021/10/09 03:17:53 UTC

[apisix-ingress-controller] branch master updated: Make webhook cover ApisixRoute v2beta2 (#705)

This is an automated email from the ASF dual-hosted git repository.

zhangjintao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
     new 6f46ac2  Make webhook cover ApisixRoute v2beta2 (#705)
6f46ac2 is described below

commit 6f46ac29a1bf3e51987169153a10be223fcf414f
Author: Hoshea Jiang <fg...@gmail.com>
AuthorDate: Sat Oct 9 11:17:46 2021 +0800

    Make webhook cover ApisixRoute v2beta2 (#705)
---
 pkg/api/validation/apisix_route.go | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/pkg/api/validation/apisix_route.go b/pkg/api/validation/apisix_route.go
index b3860b0..e74b1a6 100644
--- a/pkg/api/validation/apisix_route.go
+++ b/pkg/api/validation/apisix_route.go
@@ -31,6 +31,7 @@ import (
 	v1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v1"
 	"github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2alpha1"
 	"github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2beta1"
+	"github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2beta2"
 	"github.com/apache/apisix-ingress-controller/pkg/log"
 )
 
@@ -53,7 +54,7 @@ var ApisixRouteValidator = kwhvalidating.ValidatorFunc(
 		var spec interface{}
 
 		switch ar := object.(type) {
-		case *v2beta1.ApisixRoute:
+		case *v2beta2.ApisixRoute:
 			spec = ar.Spec
 
 			// validate plugins
@@ -67,6 +68,18 @@ var ApisixRouteValidator = kwhvalidating.ValidatorFunc(
 					}
 				}
 			}
+		case *v2beta1.ApisixRoute:
+			spec = ar.Spec
+
+			for _, h := range ar.Spec.HTTP {
+				for _, p := range h.Plugins {
+					if p.Enable {
+						plugins = append(plugins, apisixRoutePlugin{
+							p.Name, p.Config,
+						})
+					}
+				}
+			}
 		case *v2alpha1.ApisixRoute:
 			spec = ar.Spec