You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "AlinsRan (via GitHub)" <gi...@apache.org> on 2023/04/14 06:50:25 UTC

[GitHub] [apisix-ingress-controller] AlinsRan commented on a diff in pull request #1780: fix: secret reference update Ingress

AlinsRan commented on code in PR #1780:
URL: https://github.com/apache/apisix-ingress-controller/pull/1780#discussion_r1166357757


##########
pkg/providers/ingress/ingress.go:
##########
@@ -152,6 +152,36 @@ func (c *ingressController) sync(ctx context.Context, ev *types.Event) error {
 		}
 		ing = ev.Tombstone.(kube.Ingress)
 	}
+	if ing == nil {

Review Comment:
   Same reason as above.
   ```golang
   return nil
   ```



##########
pkg/providers/ingress/ingress.go:
##########
@@ -131,7 +130,7 @@ func (c *ingressController) sync(ctx context.Context, ev *types.Event) error {
 	}
 
 	if err != nil {
-		if !k8serrors.IsNotFound(err) {
+		if !k8serrors.IsNotFound(err) || (k8serrors.IsNotFound(err) && ev.Type != types.EventDelete) {

Review Comment:
   There are two questions here
   1. Events are not always up-to-date. We always retrieve the latest object, which may have been deleted. This logic can lead to infinite retries.
   2. Redundant logic, same as line 138.
   
   ![image](https://user-images.githubusercontent.com/79972061/231963858-9486017a-acec-4b9c-afc5-06b3ee747a1e.png)
   
   ```go
   if !k8serrors.IsNotFound(err) || (k8serrors.IsNotFound(err) && ev.Type != types.EventDelete) { return }
   if ev.Type != types.EventDelete { return } # Redundant 
   
   <==>
   
   if !k8serrors.IsNotFound(err) { return }
   if ev.Type != types.EventDelete { return }
   
   ```



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org