tao12345666333 commented on code in PR #1132:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/1132#discussion_r912873124


##########
pkg/ingress/utils/manifest.go:
##########
@@ -240,6 +244,53 @@ func SyncManifests(ctx context.Context, apisix 
apisix.APISIX, clusterName string
                                                zap.String("upstream_id", u.ID),
                                                zap.String("upstream_name", 
u.Name),
                                        )
+
+                                       // this could also happen when the 
route is synced(deleted) in another syncManifest call,
+                                       // but arrives later than this
+                                       // So log the deleted routes in this 
call to see if it's true
+                                       if len(deleted.Routes) == 0 {
+                                               log.Debugw("syncManifest 
deletes upstream but doesn't delete any routes")
+                                       } else {
+                                               found := false
+
+                                               for _, r := range 
deleted.Routes {
+                                                       if r.UpstreamId == u.ID 
{
+                                                               found = true
+                                                               log.Debugw("a 
deleted route is referencing upstream",
+                                                                       
zap.Any("route", r),
+                                                               )
+                                                       }
+                                               }
+                                               if !found {
+                                                       log.Debugw("no any 
deleted route is referencing this upstream",
+                                                               
zap.String("upstream_id", u.ID),
+                                                       )
+                                               }
+                                       }
+
+                                       // try to find which route is 
referencing the upstream
+                                       routes, err := 
apisix.Cluster(clusterName).Route().List(ctx)

Review Comment:
   I am concerned that this will create performance issues



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to