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.
Description
In
reconcile(), line 134 fetchesv1Ingressfrom the ingress lister. When an ingress is deleted from k8s, the lister no longer has it, sov1Ingressis null. Line 136 (Map<String,String> annotations = v1Ingress.getMetadata().getAnnotations();) dereferencesv1Ingressbefore 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-161Impact
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 (
annotationsfetch +enablePluginsBasedOnAnnotations) to after theObjects.isNull(v1Ingress)check — they should only run whenv1Ingressis non-null (the create/update path).Related existing
Distinct from #6598 (http:// hardcode) and GOV-T6 (#6679, parser/reconciler zero-test). GOV-T6 notes
IngressReconcilerhas no tests; this NPE is the root defect those missing tests would have caught.