Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[type:fix] fix cluster e2e failure #5590

Merged
merged 6 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 16 additions & 100 deletions .github/workflows/e2e-k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,92 +103,6 @@ jobs:
name: shenyu-images
path: /tmp/apache-shenyu-*.tar
retention-days: 1

e2e-cluster:
runs-on: ubuntu-latest
needs:
- changes
- build-docker-images
if: (github.repository == 'apache/shenyu' && ${{ needs.changes.outputs.e2e == 'true' }})
strategy:
matrix:
include:
- case: shenyu-e2e-case-cluster
script: e2e-cluster-jdbc
- case: shenyu-e2e-case-cluster
script: e2e-cluster-zookeeper
steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Free disk space
run: |
df --human-readable
sudo apt clean
docker rmi $(docker image ls --all --quiet)
rm --recursive --force "$AGENT_TOOLSDIRECTORY"
df --human-readable
rm -rf /tmp/shenyu
mkdir -p /tmp/shenyu

- uses: dorny/paths-filter@v2
id: filter
with:
filters: '.github/filters.yml'
list-files: json

- name: Install k8s
if: steps.filter.outputs.changed == 'true'
run: |
curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE=777 sh -
cat /etc/rancher/k3s/k3s.yaml
mkdir -p ~/.kube
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config

- name: Set up JDK 17 for Building ShenYu
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Restore ShenYu Maven Repos
if: steps.filter.outputs.changed == 'true'
uses: actions/cache/restore@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- uses: actions/download-artifact@v3
with:
name: shenyu-images
path: /tmp/shenyu/

- name: Build k8s Cluster
if: steps.filter.outputs.changed == 'true'
run: |
sudo k3s ctr images import /tmp/shenyu/apache-shenyu-admin.tar
sudo k3s ctr images import /tmp/shenyu/apache-shenyu-bootstrap.tar

# - name: Setup Debug Session
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 15
# with:
# detached: true

- name: Run E2E Tests
if: steps.filter.outputs.changed == 'true'
run: |
bash ./shenyu-e2e/shenyu-e2e-case/${{ matrix.case }}/k8s/script/${{ matrix.script }}.sh

- name: Cluster Test after Healthcheck
if: steps.filter.outputs.changed == 'true'
run: |
kubectl get all
kubectl get events --all-namespaces
kubectl logs -l app=shenyu-admin-mysql

e2e-storage:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -282,18 +196,22 @@ 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
script: e2e-cluster-zookeeper

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -383,13 +301,11 @@ jobs:
if: ${{ needs.changes.outputs.e2e == 'true' }}
needs:
- changes
- e2e-cluster
- e2e-storage
- e2e-case
runs-on: ubuntu-latest
steps:
- name: checking job status
run: |
[[ "${{ needs.e2e-cluster.result }}" == "success" ]] || exit -1
[[ "${{ needs.e2e-storage.result }}" == "success" ]] || exit -1
[[ "${{ needs.e2e-case.result }}" == "success" ]] || exit -1
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class WebsocketCollector {
*/
@OnOpen
public void onOpen(final Session session) {
LOG.info("websocket on client[{}] open successful,maxTextMessageBufferSize:{}",
LOG.info("websocket on client[{}] open successful, maxTextMessageBufferSize: {}",
getClientIp(session), session.getMaxTextMessageBufferSize());
SESSION_SET.add(session);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ 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-mysql | awk '{print $1}')"
kubectl logs "$(kubectl get pod -o wide | grep shenyu-zookeeper | awk '{print $1}')"

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

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

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ public class WebsocketSyncDataService implements SyncDataService {
*/
private static final String ORIGIN_HEADER_NAME = "Origin";

private ShenyuWebsocketClient client;

private final WebsocketConfig websocketConfig;

private final PluginDataSubscriber pluginDataSubscriber;
Expand Down Expand Up @@ -101,7 +99,7 @@ public WebsocketSyncDataService(final WebsocketConfig websocketConfig,
this.authDataSubscribers = authDataSubscribers;
this.proxySelectorDataSubscribers = proxySelectorDataSubscribers;
this.discoveryUpstreamDataSubscribers = discoveryUpstreamDataSubscribers;

LOG.info("start init connecting...");
List<String> urls = websocketConfig.getUrls();
for (String url : urls) {
if (StringUtils.isNotEmpty(websocketConfig.getAllowOrigin())) {
Expand All @@ -113,8 +111,8 @@ public WebsocketSyncDataService(final WebsocketConfig websocketConfig,
metaDataSubscribers, authDataSubscribers, proxySelectorDataSubscribers, discoveryUpstreamDataSubscribers));
}
}

this.timer.add(timerTask = new AbstractRoundTask(null, TimeUnit.SECONDS.toMillis(30)) {
LOG.info("start check task...");
this.timer.add(timerTask = new AbstractRoundTask(null, TimeUnit.SECONDS.toMillis(60)) {
@Override
public void doRun(final String key, final TimerTask timerTask) {
masterCheck();
Expand Down Expand Up @@ -162,8 +160,12 @@ private void masterCheck() {

@Override
public void close() {
if (Objects.nonNull(client)) {
client.nowClose();
if (CollectionUtils.isNotEmpty(clients)) {
for (ShenyuWebsocketClient client : clients) {
if (Objects.nonNull(client)) {
client.close();
}
}
}
if (Objects.nonNull(timerTask)) {
timerTask.cancel();
Expand Down
Loading