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

   ## Description
   In `reconcile()`, line 134 fetches `v1Ingress` from the ingress lister. When 
an ingress is deleted from k8s, the lister no longer has it, so `v1Ingress` is 
null. Line 136 (`Map<String,String> annotations = 
v1Ingress.getMetadata().getAnnotations();`) dereferences `v1Ingress` **before** 
the null check on line 138 (`if (Objects.isNull(v1Ingress))`). The NPE 
propagates up and the entire delete-cleanup block (lines 138–161: 
selector/rule/SSL cleanup, cache invalidation) is never reached.
   
   ## Location
   - 
`shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/reconciler/IngressReconciler.java:134-161`
   
   ## Impact
   Deleting a ShenYu ingress leaves orphaned selectors, rules, metadata, SSL 
config, and service-ingress cache entries in the gateway. The ingress appears 
gone from k8s but the gateway still routes to the old upstreams. The delete 
path is effectively dead code.
   
   ## Suggested fix
   Move line 136–137 (`annotations` fetch + `enablePluginsBasedOnAnnotations`) 
to after the `Objects.isNull(v1Ingress)` check — they should only run when 
`v1Ingress` is non-null (the create/update path).
   
   ## Related existing
   Distinct from #6598 (http:// hardcode) and GOV-T6 (#6679, parser/reconciler 
zero-test). GOV-T6 notes `IngressReconciler` has no tests; this NPE is the root 
defect those missing tests would have caught.
   


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