Aias00 opened a new issue, #6491:
URL: https://github.com/apache/shenyu/issues/6491

   ### Current Behavior
   
   `IngressReconciler.reconcile()` dereferences the current ingress and its 
annotations before checking whether the ingress still exists.
   
   ```java
   final V1Ingress v1Ingress = 
this.ingressLister.namespace(request.getNamespace()).get(request.getName());
   final V1Ingress oldIngress = 
IngressCache.getInstance().get(request.getNamespace(), request.getName());
   Map<String, String> annotations = v1Ingress.getMetadata().getAnnotations();
   enablePluginsBasedOnAnnotations(annotations, request);
   if (Objects.isNull(v1Ingress)) {
       ... delete cleanup ...
   }
   ```
   
   If a delete event is reconciled after the lister no longer has the ingress, 
`v1Ingress` is `null` and the delete cleanup branch is never reached. If the 
ingress exists but has no metadata annotations, 
`enablePluginsBasedOnAnnotations(...)` can also receive `null` before 
`checkIngressClass()` has a chance to accept a valid 
`spec.ingressClassName`-based ingress.
   
   ### Expected Behavior
   
   The reconciler should check for a missing ingress before reading metadata, 
and should tolerate absent annotations for valid `networking.k8s.io/v1` 
ingresses that use `spec.ingressClassName`.
   
   ### Impact
   
   Delete reconciliation can fail before removing cached selectors/rules/TLS 
state. Valid ingresses that specify only `spec.ingressClassName: shenyu` can 
fail reconciliation if annotations are absent.
   
   ### Code Location
   
   - 
`shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/reconciler/IngressReconciler.java`
     - `reconcile()` dereferences `v1Ingress` before the null check.
     - `checkIngressClass()` supports `spec.ingressClassName`, but the earlier 
annotation access can fail first.
   


-- 
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