You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by kv...@apache.org on 2021/05/25 11:16:50 UTC
[apisix-ingress-controller] branch master updated: fix:
ingress_class configuration invalid(#475) (#477)
This is an automated email from the ASF dual-hosted git repository.
kvn 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 6630aac fix: ingress_class configuration invalid(#475) (#477)
6630aac is described below
commit 6630aaced835265951bfb76453a7a812ad15e7aa
Author: Donghui0 <do...@gmail.com>
AuthorDate: Tue May 25 19:16:41 2021 +0800
fix: ingress_class configuration invalid(#475) (#477)
* fix: ingress_class configuration invalid(#475)
* fix: ingress test case
Co-authored-by: 董辉 <do...@luojilab.com>
---
pkg/ingress/ingress.go | 5 ++---
pkg/ingress/ingress_test.go | 7 ++++++-
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/pkg/ingress/ingress.go b/pkg/ingress/ingress.go
index 8183981..73077b7 100644
--- a/pkg/ingress/ingress.go
+++ b/pkg/ingress/ingress.go
@@ -24,7 +24,6 @@ import (
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"
- "github.com/apache/apisix-ingress-controller/pkg/config"
"github.com/apache/apisix-ingress-controller/pkg/kube"
"github.com/apache/apisix-ingress-controller/pkg/log"
"github.com/apache/apisix-ingress-controller/pkg/types"
@@ -318,10 +317,10 @@ func (c *ingressController) isIngressEffective(ing kube.Ingress) bool {
// kubernetes.io/ingress.class takes the precedence.
if ica != "" {
- return ica == config.IngressClass
+ return ica == c.controller.cfg.Kubernetes.IngressClass
}
if ic != nil {
- return *ic == config.IngressClass
+ return *ic == c.controller.cfg.Kubernetes.IngressClass
}
return false
}
diff --git a/pkg/ingress/ingress_test.go b/pkg/ingress/ingress_test.go
index 08396dc..21388d3 100644
--- a/pkg/ingress/ingress_test.go
+++ b/pkg/ingress/ingress_test.go
@@ -23,11 +23,16 @@ import (
networkingv1beta1 "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "github.com/apache/apisix-ingress-controller/pkg/config"
"github.com/apache/apisix-ingress-controller/pkg/kube"
)
func TestIsIngressEffective(t *testing.T) {
- c := &ingressController{}
+ c := &ingressController{
+ controller: &Controller{
+ cfg: config.NewDefaultConfig(),
+ },
+ }
cn := "ingress"
ingV1 := &networkingv1.Ingress{
TypeMeta: metav1.TypeMeta{