Skip to content

Commit

Permalink
[type:fix] ShenYu Admin Cluster, cluster e2e (#5592)
Browse files Browse the repository at this point in the history
* ShenYu Admin Cluster, cluster e2e

* ShenYu Admin Cluster, cluster e2e

* ShenYu Admin Cluster, cluster e2e

* ShenYu Admin Cluster, cluster e2e

* ShenYu Admin Cluster, cluster e2e websocket

* ShenYu Admin Cluster, cluster e2e websocket

* ShenYu Admin Cluster, cluster e2e websocket

* ShenYu Admin Cluster, cluster zookeeper e2e debug

* ShenYu Admin Cluster, fix cluster e2e failure

* ShenYu Admin Cluster, add more cluster forward uris

* ShenYu Admin Cluster, cluster websocket

* ShenYu Admin Cluster, cluster websocket
  • Loading branch information
Aias00 committed Jul 7, 2024
1 parent 86af483 commit e3c51f5
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 20 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/e2e-k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,18 +196,18 @@ jobs:
strategy:
matrix:
include:
# - case: shenyu-e2e-case-http
# script: e2e-http-sync
# - case: shenyu-e2e-case-spring-cloud
# script: e2e-springcloud-sync
# - case: shenyu-e2e-case-apache-dubbo
# script: e2e-apache-dubbo-sync
# - case: shenyu-e2e-case-sofa
# script: e2e-sofa-sync
# - case: shenyu-e2e-case-grpc
# script: e2e-grpc-sync
# - case: shenyu-e2e-case-websocket
# script: e2e-websocket-sync
- case: shenyu-e2e-case-http
script: e2e-http-sync
- case: shenyu-e2e-case-spring-cloud
script: e2e-springcloud-sync
- case: shenyu-e2e-case-apache-dubbo
script: e2e-apache-dubbo-sync
- case: shenyu-e2e-case-sofa
script: e2e-sofa-sync
- case: shenyu-e2e-case-grpc
script: e2e-grpc-sync
- case: shenyu-e2e-case-websocket
script: e2e-websocket-sync
- case: shenyu-e2e-case-cluster
script: e2e-cluster-jdbc
- case: shenyu-e2e-case-cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private void forwardRequest(final HttpServletRequest request,
final HttpServletResponse response) throws IOException {
String targetUrl = getForwardingUrl(request);

LOG.info("forwarding current uri: {} request to target url: {}", request.getRequestURI(), targetUrl);
LOG.info("forwarding current uri: {} method: {} request to target url: {}", request.getRequestURI(), request.getMethod(), targetUrl);
// Create request entity
HttpHeaders headers = new HttpHeaders();
// Copy request headers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import org.apache.shenyu.common.dto.SelectorData;
import org.apache.shenyu.common.enums.ConfigGroupEnum;
import org.apache.shenyu.common.enums.DataEventTypeEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;

Expand All @@ -46,6 +48,8 @@
*/
@Service
public class SyncDataServiceImpl implements SyncDataService {

private static final Logger LOG = LoggerFactory.getLogger(SyncDataServiceImpl.class);

private final AppAuthService appAuthService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.Objects;

/**
* custom Stateless AccessControlFilter.
Expand Down Expand Up @@ -100,6 +101,9 @@ private String getTokenValue(final HttpServletRequest httpServletRequest) {
return tokenValue;
}
Cookie[] cookies = httpServletRequest.getCookies();
if (Objects.isNull(cookies)) {
return "";
}
return Arrays.stream(cookies)
.filter(cookie -> StringUtils.equals(tokenName, cookie.getName()))
.findAny()
Expand Down
37 changes: 37 additions & 0 deletions shenyu-admin/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,46 @@ shenyu:
- /configs/**
- /selector/batchEnabled
- /selector/batch
- /selector
- /selector/**
- /rule/batchEnabled
- /rule/batch
- /rule
- /rule/**
- /plugin
- /plugin/**
- /plugin/createPluginResource/**
- /plugin/batch
- /plugin/enabled
- /plugin/syncPluginAll
- /plugin/syncPluginData/**
- /proxy-selector/binding
- /proxy-selector/**
- /proxy-selector/batch
- /proxy-selector/addProxySelector
- /proxy-selector/fetch/**
- /api
- /api/**
- /api/batch
- /appAuth/apply
- /appAuth/updateDetail
- /appAuth/updateDetailPath
- /appAuth/batchDelete
- /appAuth/batchEnabled
- /appAuth/batchOpened
- /appAuth/syncData
- /discovery/insertOrUpdate
- /discovery/**
- /discovery-upstream
- /discovery-upstream/batch
- /discovery-upstream/**
- /meta-data/createOrUpdate
- /meta-data/batchDeleted
- /meta-data/batchEnabled
- /meta-data/syncData
- /plugin-handle
- /plugin-handle/**
- /plugin-handle/batch
zookeeper:
url: localhost:2181
sessionTimeout: 5000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ kubectl logs "$(kubectl get pod -o wide | grep shenyu-admin-master | awk '{print

kubectl logs "$(kubectl get pod -o wide | grep shenyu-admin-slave | awk '{print $1}')"

kubectl describe pod shenyu-admin-master

kubectl describe pod shenyu-admin-slave

kubectl logs "$(kubectl get pod -o wide | grep shenyu-bootstrap | awk '{print $1}')"

## run e2e-test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ sleep 30s
chmod +x "${curPath}"/healthcheck.sh
sh "${curPath}"/healthcheck.sh cluster http://localhost:31095/actuator/health http://localhost:31096/actuator/health http://localhost:31195/actuator/health

kubectl logs "$(kubectl get pod -o wide | grep shenyu-zookeeper | awk '{print $1}')"
#kubectl logs "$(kubectl get pod -o wide | grep shenyu-zookeeper | awk '{print $1}')"

echo "----------shenyu-admin-master log ----------"

Expand All @@ -44,14 +44,15 @@ echo "----------shenyu-admin-slave log ----------"

kubectl logs "$(kubectl get pod -o wide | grep shenyu-admin-slave | awk '{print $1}')"

kubectl describe pod shenyu-admin-master
#kubectl describe pod shenyu-admin-master

kubectl describe pod shenyu-admin-slave
#kubectl describe pod shenyu-admin-slave

kubectl logs "$(kubectl get pod -o wide | grep shenyu-bootstrap | awk '{print $1}')"

## run e2e-test
sleep 60s
echo "----------shenyu-bootstrap pluginData ----------"
curl -S "http://localhost:31195/actuator/pluginData"

./mvnw -B -f ./shenyu-e2e/pom.xml -pl shenyu-e2e-case/shenyu-e2e-case-cluster -am test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ spec:
value: "9095"
- name: shenyu.cluster.enabled
value: "true"
- name: shenyu.sync.websocket.allowOrigins
value: ws://localhost:9095;ws://localhost:9195;
- name: spring.datasource.username
value: root
- name: spring.datasource.password
Expand Down Expand Up @@ -112,6 +114,8 @@ spec:
value: "9096"
- name: shenyu.cluster.enabled
value: "true"
- name: shenyu.sync.websocket.allowOrigins
value: ws://localhost:9096;ws://localhost:9195;
- name: spring.datasource.username
value: root
- name: spring.datasource.password
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ spec:
value: "9095"
- name: shenyu.cluster.enabled
value: "true"
- name: shenyu.sync.websocket.allowOrigins
value: ws://localhost:9095;ws://localhost:9195;
- name: shenyu.cluster.type
value: "zookeeper"
- name: shenyu.cluster.zookeeper.url
Expand Down Expand Up @@ -115,6 +117,8 @@ spec:
value: "9096"
- name: shenyu.cluster.enabled
value: "true"
- name: shenyu.sync.websocket.allowOrigins
value: ws://localhost:9096;ws://localhost:9195;
- name: shenyu.cluster.type
value: "zookeeper"
- name: shenyu.cluster.zookeeper.url
Expand Down

0 comments on commit e3c51f5

Please sign in to comment.