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 703c6b2  fix: ApisixRoute backendPoint duplicate (#732) (#734)
703c6b2 is described below

commit 703c6b2fdbac5c748d2b3c1e54ac62f94d7de41f
Author: zhang lun hai <[email protected]>
AuthorDate: Wed Nov 24 20:28:04 2021 +0800

    fix: ApisixRoute backendPoint duplicate (#732) (#734)
---
 pkg/kube/translation/apisix_route.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkg/kube/translation/apisix_route.go 
b/pkg/kube/translation/apisix_route.go
index a8bcae3..0a16310 100644
--- a/pkg/kube/translation/apisix_route.go
+++ b/pkg/kube/translation/apisix_route.go
@@ -254,8 +254,8 @@ func (t *translator) translateHTTPRouteV2beta1(ctx 
*TranslateContext, ar *config
                                weight = *backend.Weight
                        }
                        backendPoints := 
make([]*configv2alpha1.ApisixRouteHTTPBackend, 0)
-                       for _, b := range backends {
-                               backendPoints = append(backendPoints, &b)
+                       for i := range backends {
+                               backendPoints = append(backendPoints, 
&backends[i])
                        }
                        plugin, err := t.translateTrafficSplitPlugin(ctx, 
ar.Namespace, weight, backendPoints)
                        if err != nil {
@@ -395,8 +395,8 @@ func (t *translator) translateHTTPRouteV2beta2(ctx 
*TranslateContext, ar *config
                                weight = *backend.Weight
                        }
                        backendPoints := 
make([]*configv2alpha1.ApisixRouteHTTPBackend, 0)
-                       for _, b := range backends {
-                               backendPoints = append(backendPoints, &b)
+                       for i := range backends {
+                               backendPoints = append(backendPoints, 
&backends[i])
                        }
                        plugin, err := t.translateTrafficSplitPlugin(ctx, 
ar.Namespace, weight, backendPoints)
                        if err != nil {

Reply via email to