From 85fe2519914b09decd943f0cd98badf6608a0083 Mon Sep 17 00:00:00 2001 From: Gallardot Date: Wed, 7 Dec 2022 11:56:57 +0800 Subject: [PATCH] create canary apisix object only with the related http route Signed-off-by: Gallardot --- pkg/router/apisix.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/router/apisix.go b/pkg/router/apisix.go index 6974c2a8..1fb60bb6 100644 --- a/pkg/router/apisix.go +++ b/pkg/router/apisix.go @@ -60,7 +60,7 @@ func (ar *ApisixRouter) Reconcile(canary *flaggerv1.Canary) error { } apexName, primaryName, canaryName := canary.GetServiceNames() - targetHttpRoute, targetIndex, err := ar.getTargetHttpRoute(canary, apisixRouteClone, apexName) + targetHttpRoute, _, err := ar.getTargetHttpRoute(canary, apisixRouteClone, apexName) if err != nil { return err } @@ -87,7 +87,7 @@ func (ar *ApisixRouter) Reconcile(canary *flaggerv1.Canary) error { } targetHttpRoute.Backends = append(targetHttpRoute.Backends, canaryBackend) - apisixRouteClone.Spec.HTTP[targetIndex] = *targetHttpRoute + apisixRouteClone.Spec.HTTP = []a6v2.ApisixRouteHTTP{*targetHttpRoute} canaryApisixRouteName := fmt.Sprintf("%s-%s-canary", canary.Spec.RouteRef.Name, apexName) canaryApisixRoute, err := ar.apisixClient.ApisixV2().ApisixRoutes(canary.Namespace).Get(context.TODO(), canaryApisixRouteName, metav1.GetOptions{})