This is an automated email from the ASF dual-hosted git repository.
dengliming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new a50e41b79d fix(kubernetes-controller): skip generic context path when
plugin enabled (#7036)
a50e41b79d is described below
commit a50e41b79da74aec64b65d839a6b3bde02923187
Author: Daming <[email protected]>
AuthorDate: Thu Sep 17 11:05:29 2026 +0800
fix(kubernetes-controller): skip generic context path when plugin enabled
(#7036)
Co-authored-by: Luke Haochao Zhuang <[email protected]>
Co-authored-by: Liming Deng <[email protected]>
---
.../apache/shenyu/k8s/parser/IngressParser.java | 2 +-
.../org/apache/shenyu/k8s/DubboReconcilerTest.java | 32 ++++++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git
a/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/IngressParser.java
b/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/IngressParser.java
index a9ef809a5b..560e333293 100644
---
a/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/IngressParser.java
+++
b/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/IngressParser.java
@@ -72,7 +72,7 @@ public class IngressParser implements
K8sResourceListParser<V1Ingress> {
boolean grpcEnabled = getBooleanAnnotation(ingress,
IngressConstants.PLUGIN_GRPC_ENABLED);
boolean sofaEnabled = getBooleanAnnotation(ingress,
IngressConstants.PLUGIN_SOFA_ENABLED);
- if (!dubboEnabled || !sofaEnabled) {
+ if (!dubboEnabled && !webSocketEnabled && !brpcEnabled && !grpcEnabled
&& !sofaEnabled) {
contextPathParse(ingress, shenyuMemoryConfigList, coreV1Api);
}
if (dubboEnabled) {
diff --git
a/shenyu-kubernetes-controller/src/test/java/org/apache/shenyu/k8s/DubboReconcilerTest.java
b/shenyu-kubernetes-controller/src/test/java/org/apache/shenyu/k8s/DubboReconcilerTest.java
index a4cac65997..f033bb3477 100644
---
a/shenyu-kubernetes-controller/src/test/java/org/apache/shenyu/k8s/DubboReconcilerTest.java
+++
b/shenyu-kubernetes-controller/src/test/java/org/apache/shenyu/k8s/DubboReconcilerTest.java
@@ -150,4 +150,36 @@ public final class DubboReconcilerTest {
verify(shenyuCacheRepository).saveOrUpdateRuleData(any());
verify(shenyuCacheRepository).saveOrUpdateMetaData(any());
}
+
+ @Test
+ public void testParseSkipsContextPathWhenDubboEnabled() {
+ Map<String, String> annotations = new HashMap<>();
+ annotations.put("kubernetes.io/ingress.class", "shenyu");
+ annotations.put("shenyu.apache.org/plugin-dubbo-enabled", "true");
+ annotations.put("shenyu.apache.org/zookeeper-register-address",
"zookeeper://zookeeperService:2181");
+ annotations.put("shenyu.apache.org/upstreams-protocol",
"dubbo://,dubbo://");
+ Map<String, String> labels = new HashMap<>();
+ labels.put("shenyu.apache.org/metadata-labels-1",
"dubboFindIdService");
+
+ V1Ingress ingress = new V1IngressBuilder().withNewMetadata()
+ .withName("mockedIngress")
+ .withNamespace("mockedNamespace")
+ .withAnnotations(annotations)
+ .withLabels(labels)
+ .endMetadata()
+ .withNewSpec()
+ .withRules(new V1IngressRuleBuilder()
+ .withNewHttp()
+ .withPaths(new
V1HTTPIngressPathBuilder().withPath("/**")
+ .withNewBackend()
+
.withNewService().withName("testService").withNewPort().withNumber(20888).endPort().endService()
+ .endBackend().build())
+ .endHttp()
+ .build())
+ .endSpec()
+ .build();
+
+ IngressParser ingressParser = new IngressParser(serviceInformer,
endpointsInformer);
+ Assertions.assertEquals(1, ingressParser.parse(ingress,
mock(io.kubernetes.client.openapi.apis.CoreV1Api.class)).size());
+ }
}