Copilot commented on code in PR #7031:
URL: https://github.com/apache/shenyu/pull/7031#discussion_r4037442288


##########
shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/ContextPathParser.java:
##########
@@ -112,11 +112,14 @@ private List<IngressConfiguration> parseIngressRule(final 
V1IngressRule ingressR
                     }
                     conditionList.add(pathCondition);
                     SelectorData selectorData = createSelectorData(pathPath, 
conditionList);
-                    ContextMappingRuleHandle contextMappingRuleHandle = 
createContextMappingRuleHandle(annotations);
+                    String contextPath = 
annotations.get(IngressConstants.PLUGIN_CONTEXT_PATH_PATH);
                     List<RuleData> ruleDataList = new ArrayList<>();
-                    List<ConditionData> ruleConditionList = 
getRuleConditionList(annotations);
-                    RuleData ruleData = createRuleData(annotations, 
contextMappingRuleHandle, ruleConditionList);
-                    ruleDataList.add(ruleData);
+                    if (Objects.nonNull(contextPath)) {

Review Comment:
   This guard suppresses the rule but still adds an `IngressConfiguration` 
containing `selectorData`. `IngressReconciler.processSelectorData` persists 
every non-null selector before checking whether its rule list is empty 
(`IngressReconciler.java:447-477`), so an ingress without this optional 
annotation still creates a phantom ContextPath selector. Skip the entire route 
configuration when `contextPath` is null, and update the regression test to 
expect no ContextPath route configs.



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