This is an automated email from the ASF dual-hosted git repository. hefengen 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 55a3c6990f [type:bugfix] fix grpc ci error (#5616) 55a3c6990f is described below commit 55a3c6990f485ab734abe5d7a3546be13bca6312 Author: aias00 <rok...@163.com> AuthorDate: Wed Aug 21 22:37:38 2024 +0800 [type:bugfix] fix grpc ci error (#5616) * [type:bugfix] fix grpc ci error * [type:bugfix] fix grpc ci error * [type:bugfix] fix ingress sofa ci error * [type:bugfix] fix ingress sofa ci error * [type:bugfix] fix grpc e2e ci error * [type:bugfix] fix ingress sofa ci error * [type:bugfix] fix ingress sofa ci error * [type:bugfix] fix ingress sofa ci error * [type:bugfix] fix ingress sofa ci error * [type:bugfix] fix grpc e2e ci error * [type:bugfix] logger to LOG * [type:bugfix] logger to LOG * [type:bugfix] logger to LOG * [type:bugfix] fix grpc e2e ci error * [type:bugfix] grpc e2e ci error debug --------- Co-authored-by: moremind <hefen...@apache.org> --- .github/workflows/integrated-test-k8s-ingress.yml | 8 ++++++-- pom.xml | 2 +- .../shenyu/admin/listener/AbstractDataChangedListener.java | 1 + .../register/AbstractShenyuClientRegisterServiceImpl.java | 9 ++++----- .../register/ShenyuClientRegisterGrpcServiceImpl.java | 12 +++++++++++- .../shenyu-e2e-case-grpc/k8s/script/e2e-grpc-sync.sh | 7 ++++++- shenyu-examples/shenyu-examples-grpc/pom.xml | 2 +- .../script/build_k8s_cluster.sh | 5 +++++ .../grpc/handler/GrpcDiscoveryUpstreamDataHandler.java | 6 ++++++ shenyu-registry/shenyu-registry-etcd/pom.xml | 8 ++++++++ 10 files changed, 49 insertions(+), 11 deletions(-) diff --git a/.github/workflows/integrated-test-k8s-ingress.yml b/.github/workflows/integrated-test-k8s-ingress.yml index 6ce134d24d..1ea2edd812 100644 --- a/.github/workflows/integrated-test-k8s-ingress.yml +++ b/.github/workflows/integrated-test-k8s-ingress.yml @@ -127,9 +127,13 @@ jobs: - name: Cluster Test after Healthcheck if: steps.filter.outputs.changed == 'true' run: | - kubectl get all - kubectl get all -n shenyu-ingress + echo "----------kubectl get all -o wide----------" + kubectl get all -o wide + echo "----------kubectl get all -n shenyu-ingress -o wide----------" + kubectl get all -n shenyu-ingress -o wide + echo "----------kubectl get events --all-namespaces----------" kubectl get events --all-namespaces + echo "----------kubectl logs -l app=shenyu-ingress-controller -n shenyu-ingress --tail=-1----------" kubectl logs -l app=shenyu-ingress-controller -n shenyu-ingress --tail=-1 if [[ ${{steps.test.outcome}} == "failure" ]]; then echo "Test Failed" diff --git a/pom.xml b/pom.xml index 5cbaac0f8c..6bc2b419d9 100644 --- a/pom.xml +++ b/pom.xml @@ -175,7 +175,7 @@ <resilience.version>1.7.1</resilience.version> <sentinel.version>1.8.3</sentinel.version> <lettuce.version>6.1.2.RELEASE</lettuce.version> - <protobuf-java.version>3.21.12</protobuf-java.version> + <protobuf-java.version>3.25.1</protobuf-java.version> <aliyun-log-producer.version>0.3.10</aliyun-log-producer.version> <tencent-log-sdk.version>1.0.14</tencent-log-sdk.version> <jsonpath.version>2.4.0</jsonpath.version> diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/AbstractDataChangedListener.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/AbstractDataChangedListener.java index dc7cf9adef..2084a9086d 100644 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/AbstractDataChangedListener.java +++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/AbstractDataChangedListener.java @@ -283,6 +283,7 @@ public abstract class AbstractDataChangedListener implements DataChangedListener ConfigDataCache newVal = new ConfigDataCache(group.name(), json, DigestUtils.md5Hex(json), System.currentTimeMillis()); ConfigDataCache oldVal = CACHE.put(newVal.getGroup(), newVal); LOG.info("update config cache[{}], old: {}, updated: {}", group, oldVal, newVal); + LOG.info("update config json: {}", json); } /** diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/AbstractShenyuClientRegisterServiceImpl.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/AbstractShenyuClientRegisterServiceImpl.java index 01baa4aee2..b039163c87 100644 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/AbstractShenyuClientRegisterServiceImpl.java +++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/AbstractShenyuClientRegisterServiceImpl.java @@ -17,6 +17,7 @@ package org.apache.shenyu.admin.service.register; +import jakarta.annotation.Resource; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.shenyu.admin.listener.DataChangedEvent; @@ -24,12 +25,11 @@ import org.apache.shenyu.admin.model.dto.DiscoveryUpstreamDTO; import org.apache.shenyu.admin.model.dto.RuleConditionDTO; import org.apache.shenyu.admin.model.dto.RuleDTO; import org.apache.shenyu.admin.model.entity.SelectorDO; +import org.apache.shenyu.admin.service.DiscoveryService; +import org.apache.shenyu.admin.service.DiscoveryUpstreamService; import org.apache.shenyu.admin.service.MetaDataService; import org.apache.shenyu.admin.service.RuleService; import org.apache.shenyu.admin.service.SelectorService; -import org.apache.shenyu.admin.service.DiscoveryService; -import org.apache.shenyu.admin.service.DiscoveryUpstreamService; - import org.apache.shenyu.admin.service.impl.UpstreamCheckService; import org.apache.shenyu.admin.service.manager.RegisterApiDocService; import org.apache.shenyu.admin.utils.CommonUpstreamUtils; @@ -52,7 +52,6 @@ import org.apache.shenyu.register.common.dto.MetaDataRegisterDTO; import org.apache.shenyu.register.common.dto.URIRegisterDTO; import org.springframework.context.ApplicationEventPublisher; -import jakarta.annotation.Resource; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -64,7 +63,7 @@ import static org.apache.shenyu.common.constant.AdminConstants.SYS_DEFAULT_NAMES * Abstract strategy. */ public abstract class AbstractShenyuClientRegisterServiceImpl extends FallbackShenyuClientRegisterService implements ShenyuClientRegisterService { - + /** * The Event publisher. */ diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterGrpcServiceImpl.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterGrpcServiceImpl.java index eaf5f18513..43146e4c20 100644 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterGrpcServiceImpl.java +++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterGrpcServiceImpl.java @@ -17,6 +17,7 @@ package org.apache.shenyu.admin.service.register; +import jakarta.annotation.Resource; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.shenyu.admin.listener.DataChangedEvent; @@ -37,9 +38,10 @@ import org.apache.shenyu.common.utils.PluginNameAdapter; import org.apache.shenyu.register.common.dto.MetaDataRegisterDTO; import org.apache.shenyu.register.common.dto.URIRegisterDTO; import org.apache.shenyu.register.common.enums.EventType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; -import jakarta.annotation.Resource; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -53,6 +55,8 @@ import static org.apache.shenyu.common.constant.AdminConstants.SYS_DEFAULT_NAMES */ @Service public class ShenyuClientRegisterGrpcServiceImpl extends AbstractShenyuClientRegisterServiceImpl { + + private static final Logger LOG = LoggerFactory.getLogger(ShenyuClientRegisterGrpcServiceImpl.class); @Resource private GrpcSelectorHandleConverter grpcSelectorHandleConverter; @@ -75,6 +79,9 @@ public class ShenyuClientRegisterGrpcServiceImpl extends AbstractShenyuClientReg @Override protected void registerMetadata(final MetaDataRegisterDTO metaDataDTO) { MetaDataService metaDataService = getMetaDataService(); + if (LOG.isDebugEnabled()) { + LOG.debug("grpc register metadata:{}", GsonUtils.getInstance().toJson(metaDataDTO)); + } MetaDataDO exist = metaDataService.findByPath(metaDataDTO.getPath()); metaDataService.saveOrUpdateMetaData(exist, metaDataDTO); } @@ -140,6 +147,9 @@ public class ShenyuClientRegisterGrpcServiceImpl extends AbstractShenyuClientReg removeDiscoveryUpstream(selectorDO.getId(), grpcUpstream.getUpstreamUrl()); } DiscoverySyncData discoverySyncData = fetch(selectorDO.getId(), selectorDO.getName(), pluginName); + if (LOG.isDebugEnabled()) { + LOG.debug("grpc offline discoverySyncData:{}", GsonUtils.getInstance().toJson(discoverySyncData)); + } getEventPublisher().publishEvent(new DataChangedEvent(ConfigGroupEnum.DISCOVER_UPSTREAM, DataEventTypeEnum.UPDATE, Collections.singletonList(discoverySyncData))); } return Constants.SUCCESS; diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/k8s/script/e2e-grpc-sync.sh b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/k8s/script/e2e-grpc-sync.sh index 01b94751b9..c18d6d9341 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/k8s/script/e2e-grpc-sync.sh +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/k8s/script/e2e-grpc-sync.sh @@ -31,7 +31,7 @@ kubectl apply -f "${SHENYU_TESTCASE_DIR}"/k8s/sync/shenyu-cm.yml SYNC_ARRAY=("websocket" "http" "zookeeper" "etcd") #SYNC_ARRAY=("websocket" "nacos") MIDDLEWARE_SYNC_ARRAY=("zookeeper" "etcd" "nacos") -for sync in ${SYNC_ARRAY[@]}; do +for sync in "${SYNC_ARRAY[@]}"; do echo -e "------------------\n" kubectl apply -f "$SHENYU_TESTCASE_DIR"/k8s/shenyu-mysql.yml sleep 30s @@ -57,6 +57,11 @@ for sync in ${SYNC_ARRAY[@]}; do # shellcheck disable=SC2181 if (($?)); then echo "${sync}-sync-e2e-test failed" + echo "shenyu-${sync} log:" + echo "------------------" + kubectl logs "$(kubectl get pod -o wide | grep shenyu-"${sync}" | awk '{print $1}')" + echo "shenyu-examples-grpc log:" + echo "------------------" kubectl logs "$(kubectl get pod -o wide | grep shenyu-examples-grpc | awk '{print $1}')" echo "shenyu-admin log:" echo "------------------" diff --git a/shenyu-examples/shenyu-examples-grpc/pom.xml b/shenyu-examples/shenyu-examples-grpc/pom.xml index 0d9557a59c..da179d157a 100644 --- a/shenyu-examples/shenyu-examples-grpc/pom.xml +++ b/shenyu-examples/shenyu-examples-grpc/pom.xml @@ -29,7 +29,7 @@ <properties> <grpc.version>1.65.1</grpc.version> - <protobuf.version>3.21.12</protobuf.version> + <protobuf.version>3.25.1</protobuf.version> <os-maven-plugin.version>1.6.2</os-maven-plugin.version> </properties> diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/script/build_k8s_cluster.sh b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/script/build_k8s_cluster.sh index 6492b9ce07..6f572adb8b 100644 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/script/build_k8s_cluster.sh +++ b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/script/build_k8s_cluster.sh @@ -25,3 +25,8 @@ kubectl wait --for=condition=Ready pod -l app=shenyu-examples-sofa -n shenyu-ing kubectl apply -f ./shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/deploy/deploy-shenyu.yaml kubectl wait --for=condition=Ready pod -l app=shenyu-ingress-controller -n shenyu-ingress kubectl apply -f ./shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/k8s/ingress.yml + +kubectl get pod -o wide -n shenyu-ingress + +echo "Waiting for shenyu-examples-sofa-service to be ready" +kubectl logs "$(kubectl get pod -o wide -n shenyu-ingress| grep shenyu-examples-sofa-deployment | awk '{print $1}')" -n shenyu-ingress \ No newline at end of file diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-grpc/src/main/java/org/apache/shenyu/plugin/grpc/handler/GrpcDiscoveryUpstreamDataHandler.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-grpc/src/main/java/org/apache/shenyu/plugin/grpc/handler/GrpcDiscoveryUpstreamDataHandler.java index f9e7645d1a..c209e03675 100644 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-grpc/src/main/java/org/apache/shenyu/plugin/grpc/handler/GrpcDiscoveryUpstreamDataHandler.java +++ b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-grpc/src/main/java/org/apache/shenyu/plugin/grpc/handler/GrpcDiscoveryUpstreamDataHandler.java @@ -21,9 +21,12 @@ import org.apache.shenyu.common.dto.DiscoverySyncData; import org.apache.shenyu.common.dto.DiscoveryUpstreamData; import org.apache.shenyu.common.dto.convert.selector.GrpcUpstream; import org.apache.shenyu.common.enums.PluginEnum; +import org.apache.shenyu.common.utils.JsonUtils; import org.apache.shenyu.plugin.base.handler.DiscoveryUpstreamDataHandler; import org.apache.shenyu.plugin.grpc.cache.ApplicationConfigCache; import org.apache.shenyu.plugin.grpc.cache.GrpcClientCache; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.util.ObjectUtils; import java.sql.Timestamp; @@ -37,12 +40,15 @@ import java.util.stream.Collectors; * GrpcDiscoveryUpstreamDataHandler. */ public class GrpcDiscoveryUpstreamDataHandler implements DiscoveryUpstreamDataHandler { + + private static final Logger LOG = LoggerFactory.getLogger(GrpcDiscoveryUpstreamDataHandler.class); @Override public void handlerDiscoveryUpstreamData(final DiscoverySyncData discoverySyncData) { if (Objects.isNull(discoverySyncData) || Objects.isNull(discoverySyncData.getSelectorId())) { return; } + LOG.info("discovery grpc upstream data:{}", JsonUtils.toJson(discoverySyncData)); final String selectorId = discoverySyncData.getSelectorId(); ApplicationConfigCache.getInstance().handlerUpstream(selectorId, convertUpstreamList(discoverySyncData.getUpstreamDataList())); GrpcClientCache.initGrpcClient(selectorId); diff --git a/shenyu-registry/shenyu-registry-etcd/pom.xml b/shenyu-registry/shenyu-registry-etcd/pom.xml index a22d5531bb..8d44b6d206 100644 --- a/shenyu-registry/shenyu-registry-etcd/pom.xml +++ b/shenyu-registry/shenyu-registry-etcd/pom.xml @@ -52,6 +52,14 @@ <artifactId>grpc-netty</artifactId> <groupId>io.grpc</groupId> </exclusion> + <exclusion> + <artifactId>protobuf-java-util</artifactId> + <groupId>com.google.protobuf</groupId> + </exclusion> + <exclusion> + <artifactId>protobuf-java</artifactId> + <groupId>com.google.protobuf</groupId> + </exclusion> </exclusions> </dependency>