Aias00 commented on code in PR #7285:
URL: https://github.com/apache/shenyu/pull/7285#discussion_r4109926023
##########
shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/IngressParser.java:
##########
@@ -95,7 +97,8 @@ public List<ShenyuMemoryConfig> parse(final V1Ingress
ingress, final CoreV1Api c
}
private boolean getBooleanAnnotation(final V1Ingress ingress, final String
annotationKey) {
- String annotationValue =
ingress.getMetadata().getAnnotations().get(annotationKey);
+ Map<String, String> annotations =
Objects.isNull(ingress.getMetadata()) ? null :
ingress.getMetadata().getAnnotations();
+ String annotationValue =
MapUtils.emptyIfNull(annotations).get(annotationKey);
Review Comment:
Heads-up (non-blocking, but please coordinate with #7286): this keeps
`getBooleanAnnotation` safe, but an annotation-free ingress with a `"Prefix"`
path still crashes one level down. `parse()` runs `contextPathParse` before the
plugin branches, and for Prefix paths it builds a `ContextPathParser` whose
`parse()` still passes `ingress.getMetadata().getAnnotations()` into
`parseIngressRule`, where it is dereferenced (in
`createContextMappingRuleHandle` and `getRuleConditionList`). #7286 resolves
those annotations null-safely, so the two patches belong together: with this PR
alone the fix depends on the path type of the ingress.
--
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]