[BUG] gRPC ingress parsing throws NPE when endpoints are missing
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
### Current Behavior
`GrpcParser` can throw `NullPointerException` when an ingress backend references a service whose `Endpoints` object is not available yet.
Both default backend parsing and rule backend parsing dereference the endpoints object immediately:
```java
V1Endpoints v1Endpoints = endpointsLister.namespace(namespace).get(serviceName);
List subsets = v1Endpoints.getSubsets();
```
During rollout, scale-up, or informer ordering, the service can exist while the matching endpoints object is temporarily absent.
### Expected Behavior
gRPC ingress parsing should tolerate missing endpoints and return an empty upstream list, allowing a later reconcile to add upstreams when endpoints become available.
### Steps to Reproduce
1. Create a gRPC ingress referencing a service before endpoints are present.
2. Let the Kubernetes controller reconcile the ingress.
3. `GrpcParser` can throw while reading `v1Endpoints.getSubsets()`.
### Code Location
- `shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/GrpcParser.java`
- `parseDefaultService()` and `parseUpstream()` dereference `v1Endpoints` without a null check.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/GrpcParser.java and inspect parseDefaultService() and parseUpstream(), focusing on the endpoints lookup and immediate dereference. Reproduce or trace reconciliation when the matching V1Endpoints object is absent, then verify both parsing paths return an empty upstream list and can reconcile successfully once endpoints become available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc, java, kubernetes
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100