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

tokers 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 43e4d11  fix: correctly translate ingress in extensions/v1beta1 group 
version (#380)
43e4d11 is described below

commit 43e4d11dfafb900c74b7e38a675371d052614177
Author: Vincent <vincent...@tencent.com>
AuthorDate: Thu Apr 15 21:32:57 2021 +0800

    fix: correctly translate ingress in extensions/v1beta1 group version (#380)
    
    fix #365
---
 pkg/kube/translation/translator.go | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/pkg/kube/translation/translator.go 
b/pkg/kube/translation/translator.go
index 4a6765a..f134050 100644
--- a/pkg/kube/translation/translator.go
+++ b/pkg/kube/translation/translator.go
@@ -192,8 +192,14 @@ func (t *translator) TranslateUpstreamNodes(endpoints 
*corev1.Endpoints, port in
 }
 
 func (t *translator) TranslateIngress(ing kube.Ingress) ([]*apisixv1.Route, 
[]*apisixv1.Upstream, error) {
-       if ing.GroupVersion() == kube.IngressV1 {
+       switch ing.GroupVersion() {
+       case kube.IngressV1:
                return t.translateIngressV1(ing.V1())
+       case kube.IngressV1beta1:
+               return t.translateIngressV1beta1(ing.V1beta1())
+       case kube.IngressExtensionsV1beta1:
+               return 
t.translateIngressExtensionsV1beta1(ing.ExtensionsV1beta1())
+       default:
+               return nil, nil, fmt.Errorf("translator: source group version 
not supported: %s", ing.GroupVersion())
        }
-       return t.translateIngressV1beta1(ing.V1beta1())
 }

Reply via email to