[BUG] Kubernetes gRPC/Sofa context-path parsing reads annotations from the wrong resource
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
### Current Behavior
For Prefix-type gRPC/Sofa ingresses, context-path parsing reads context-path annotations from the ingress metadata, while the repository examples put those annotations on the Service metadata.
`IngressParser.contextPathParse()` creates `ContextPathParser` for Prefix paths using the ingress object. `ContextPathParser.createContextMappingRuleHandle()` then reads:
```java
ruleHandle.setContextPath(annotations.get(IngressConstants.PLUGIN_CONTEXT_PATH_PATH));
```
The gRPC and Sofa Kubernetes examples place `shenyu.apache.org/plugin-context-path-path` on the Service, next to the RPC metadata annotations, not on the Ingress. With that shape, context-path parsing can generate a rule with `contextPath == null` and a path condition like `null/**`.
### Expected Behavior
Context-path parsing should read the annotation from the same resource where the RPC parser expects the service metadata, or the examples and parser contract should be aligned so valid examples do not generate invalid context-path rules.
### Impact
The documented/example gRPC and Sofa ingress setup can produce broken context-path rules for Prefix paths.
### Code Location
- `shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/IngressParser.java`
- `shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/ContextPathParser.java`
- `shenyu-examples/shenyu-examples-grpc/k8s/ingress.yml`
- `shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/k8s/ingress.yml`
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with IngressParser.java and ContextPathParser.java, then compare their annotation lookup with the gRPC and Sofa ingress.yml examples. Trace how Prefix paths build context mappings and align the parser with the resource holding the documented annotations. Done means valid examples no longer produce a null contextPath or a null/** path condition.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kubernetes
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100