diff --git a/pkg/kube/translation/apisix_route.go b/pkg/kube/translation/apisix_route.go index a8bcae35d8f..0a16310d4e0 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 {