Skip to content

Commit

Permalink
xDS router and lb integration test: action
Browse files Browse the repository at this point in the history
Signed-off-by: daizhenyu <1449308021@qq.com>
  • Loading branch information
daizhenyu committed Oct 16, 2024
1 parent 8c7fe58 commit b5ce698
Show file tree
Hide file tree
Showing 21 changed files with 364 additions and 77 deletions.
2 changes: 2 additions & 0 deletions .github/actions/common/plugin-change-check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ runs:
paths: sermant-agentcore/sermant-agentcore-implement/src/main/java/io/sermant/implement/service/xds
sermant-agentcore/sermant-agentcore-core
sermant-integration-tests/xds-service-test
sermant-plugins/sermant-router/router-common/**
sermant-plugins/sermant-router/spring-router-plugin/**
./.github/workflows/agentcore_service_test.yml
./.github/actions/common/xds-service
./.github/actions/scenarios/xds-service
Expand Down
8 changes: 2 additions & 6 deletions .github/actions/common/xds-service/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ runs:
with:
path: sermant-agent-*/
key: ${{ runner.os }}-agent-${{ github.run_id }}
- name: remove xds service product
shell: bash
run: |
rm -rf sermant-integration-tests/xds-service-test/product
- name: get cached xds service package
uses: actions/cache@v3
with:
path: sermant-integration-tests/xds-service-test/product/
key: ${{ runner.os }}-xds-service-product-${{ github.run_id }}
path: sermant-integration-tests/xds-service-test/product/sermant-agent-*/
key: ${{ runner.os }}-xds-service-product-agent-${{ github.run_id }}
115 changes: 115 additions & 0 deletions .github/actions/scenarios/xds-service/xds-router-lb/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: "xDS router an lb Test"
description: "Auto test for xds router and lb with router plugin"
runs:
using: composite
steps:
- name: prepare image
shell: bash
run: |
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-client/
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-cloud-client/
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-server/
mvn package -Dspringboot.version=${{ matrix.springBootVersion }} -Dsnakeyaml.version=${{ matrix.snakeyamlVersion }} -Dspringcloud.version=${{ matrix.springCloudVersion }} -Dhttpclient.version=${{ matrix.httpClientVersion }} -Dokhttp2.version=${{ matrix.okHttp2Version }} -Dhttpclient.async.version=${{ matrix.httpAsyncClientVersion }} -Dokhttp3.version=${{ matrix.okHttp3Version }} -DskipTests -pl spring-client,spring-cloud-client,spring-server -Pxds-router-lb --file \
sermant-integration-tests/xds-service-test/pom.xml
- name: build docker image
shell: bash
run: |
cd sermant-integration-tests/xds-service-test/product/spring-server/
minikube image build -t spring-server:1.0.0 .
cd ../spring-client/
minikube image build -t spring-client:1.0.0 .
cd ../spring-cloud-client/
minikube image build -t spring-cloud-client:1.0.0 .
eval $(minikube docker-env)
docker images
- name: start zookeeper
shell: bash
run: |
kubectl apply -f sermant-integration-tests/xds-service-test/script/zookeeper.yaml
kubectl wait --for=condition=ready pod -l app=zookeeper --timeout=10s
sleep 15s
- name: start spring-client
shell: bash
run: |
kubectl apply -f sermant-integration-tests/xds-service-test/script/router/deployment/spring-client-sermant-xds-router.yaml
kubectl wait --for=condition=ready pod -l app=spring-client --timeout=10s
sleep 15s
nohup kubectl port-forward svc/spring-client 8080:8080 &
sleep 2s
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:8080/checkStatus 150
- name: start spring-cloud-client
shell: bash
run: |
kubectl apply -f sermant-integration-tests/xds-service-test/script/router/deployment/spring-cloud-client-sermant-xds-router.yaml
kubectl wait --for=condition=ready pod -l app=spring-cloud-client --timeout=10s
sleep 15s
nohup kubectl port-forward svc/spring-cloud-client 8082:8082 &
sleep 2s
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:8082/router/checkStatus 150
- name: start spring-server
shell: bash
run: |
kubectl apply -f sermant-integration-tests/xds-service-test/script/router/deployment/spring-server.yaml
kubectl wait --for=condition=ready pod -l app=spring-server --timeout=10s
sleep 15s
nohup kubectl port-forward svc/spring-server 8081:8081 &
sleep 2s
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:8081/hello 150
pkill -f "kubectl port-forward svc/spring-server"
- name: delivering routing and round-robin lb policy
shell: bash
run: |
kubectl apply -f sermant-integration-tests/xds-service-test/script/router/router-rule/spring-server-destination-robin.yaml
kubectl apply -f sermant-integration-tests/xds-service-test/script/router/router-rule/spring-server-virtureservice.yaml
sleep 10s
- name: test xds router with header and path
shell: bash
run: |
mvn test -Dxds.service.integration.test.type=ROUTER_HEADER_PATH --file \
sermant-integration-tests/xds-service-test/xds-service-integration-test/pom.xml
- name: test xds router with round-robin lb policy
shell: bash
run: |
mvn test -Dxds.service.integration.test.type=LB_ROUND_ROBIN --file \
sermant-integration-tests/xds-service-test/xds-service-integration-test/pom.xml
- name: test xds router with weighted cluster
shell: bash
run: |
mvn test -Dxds.service.integration.test.type=ROUTER_WEIGHT --file \
sermant-integration-tests/xds-service-test/xds-service-integration-test/pom.xml
- name: update lb policy with randmo
shell: bash
run: |
kubectl delete -f sermant-integration-tests/xds-service-test/script/router/router-rule/spring-server-destination-robin.yaml
kubectl apply -f sermant-integration-tests/xds-service-test/script/router/router-rule/spring-server-destination-random.yaml
sleep 10s
- name: test xds router with random lb policy
shell: bash
run: |
mvn test -Dxds.service.integration.test.type=LB_RANDOM --file \
sermant-integration-tests/xds-service-test/xds-service-integration-test/pom.xml
- name: restart spring-server with envoy
shell: bash
run: |
kubectl delete -f sermant-integration-tests/xds-service-test/script/router/deployment/spring-server.yaml
sleep 10s
kubectl label namespace default istio-injection=enabled
kubectl apply -f sermant-integration-tests/xds-service-test/script/router/deployment/spring-server.yaml
kubectl wait --for=condition=ready pod -l app=spring-server --timeout=10s
sleep 15s
nohup kubectl port-forward svc/spring-server 8081:8081 &
sleep 2s
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:8081/hello 150
pkill -f "kubectl port-forward svc/spring-server"
kubectl label namespace default istio-injection-
- name: test xds router with envoy
shell: bash
run: |
mvn test -Dxds.service.integration.test.type=ROUTER_HEADER_PATH --file \
sermant-integration-tests/xds-service-test/xds-service-integration-test/pom.xml
- name: close all service
shell: bash
run: |
kubectl delete -f sermant-integration-tests/xds-service-test/script/router/deployment/spring-client-sermant-xds-router.yaml
kubectl delete -f sermant-integration-tests/xds-service-test/script/router/deployment/spring-cloud-client-sermant-xds-router.yaml
kubectl delete -f sermant-integration-tests/xds-service-test/script/router/deployment/spring-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ description: "Auto test for xds service discovery with Client Using Envoy"
runs:
using: composite
steps:
- name: prepare image
shell: bash
run: |
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-client/
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-server/
mvn package -DskipTests -pl spring-client,spring-server -Pxds-discovery --file \
sermant-integration-tests/xds-service-test/pom.xml
- name: build docker image
shell: bash
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ description: "Auto test for xds service discovery"
runs:
using: composite
steps:
- name: prepare image
shell: bash
run: |
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-client/
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-server/
mvn package -DskipTests -pl spring-client,spring-server -Pxds-discovery --file \
sermant-integration-tests/xds-service-test/pom.xml
- name: build docker image
shell: bash
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ description: "Auto test for xds service discovery with server using envoy"
runs:
using: composite
steps:
- name: prepare image
shell: bash
run: |
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-client/
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-server/
mvn package -DskipTests -pl spring-client,spring-server -Pxds-discovery --file \
sermant-integration-tests/xds-service-test/pom.xml
- name: build docker image
shell: bash
run: |
Expand Down
76 changes: 73 additions & 3 deletions .github/workflows/agentcore_service_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ on:
- '.github/actions/common/plugin-change-check/action.yml'
- '.github/actions/common/entry/action.yml'
- '.github/actions/common/exit/action.yml'
- 'sermant-plugins/sermant-router/router-common/**'
- 'sermant-plugins/sermant-router/spring-router-plugin/**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.head_ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -103,14 +105,13 @@ jobs:
- name: cache xds service package
uses: actions/cache@v3
with:
path: sermant-integration-tests/xds-service-test/product/
key: ${{ runner.os }}-xds-service-product-${{ github.run_id }}
path: sermant-integration-tests/xds-service-test/product/sermant-agent-*/
key: ${{ runner.os }}-xds-service-product-agent-${{ github.run_id }}
- name: package agent
run: |
sed -i '/sermant-backend/d' pom.xml
sed -i '/sermant-injector/d' pom.xml
mvn package -DskipTests -Ptest --file pom.xml
cp -r sermant-integration-tests/xds-service-test/product/spring-client/agent sermant-integration-tests/xds-service-test/product/spring-server/
mkdir -p sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/agentcore-test-plugin/plugin
mkdir -p sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/dynamic-test-first-plugin/plugin
mkdir -p sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/dynamic-test-second-plugin/plugin
Expand Down Expand Up @@ -194,3 +195,72 @@ jobs:
uses: ./.github/actions/common/xds-service
- name: xds service discovery
uses: ./.github/actions/scenarios/xds-service/xds-service-discovery/client-envoy
test-for-xds-router-lb:
name: Test for xds router and lb with router plugin
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableXdsServicAction == 'true'
needs: [set-execution-conditions, build-agent-and-cache]
strategy:
matrix:
include:
- springBootVersion: "2.0.2.RELEASE"
snakeyamlVersion: "1.19"
springCloudVersion: "Finchley.RELEASE"
httpClientVersion: "4.4"
okHttp2Version: "2.2.0"
okHttp3Version: "3.5.0"
httpAsyncClientVersion: "4.0.1"
- springBootVersion: "2.1.0.RELEASE"
snakeyamlVersion: "1.23"
springCloudVersion: "Greenwich.RELEASE"
httpClientVersion: "4.4.1"
okHttp2Version: "2.3.0"
okHttp3Version: "3.9.1"
httpAsyncClientVersion: "4.0.2"
- springBootVersion: "2.2.0.RELEASE"
snakeyamlVersion: "1.25"
springCloudVersion: "Hoxton.RELEASE"
httpClientVersion: "4.5"
okHttp2Version: "2.4.0"
okHttp3Version: "3.12.13"
httpAsyncClientVersion: "4.1"
- springBootVersion: "2.3.0.RELEASE"
snakeyamlVersion: "1.26"
springCloudVersion: "Hoxton.RELEASE"
httpClientVersion: "4.5.3"
okHttp2Version: "2.5.0"
okHttp3Version: "3.14.9"
httpAsyncClientVersion: "4.1.1"
- springBootVersion: "2.4.0"
snakeyamlVersion: "1.27"
springCloudVersion: "2020.0.0"
httpClientVersion: "4.5.7"
okHttp2Version: "2.6.0"
okHttp3Version: "4.2.2"
httpAsyncClientVersion: "4.1.2"
- springBootVersion: "2.6.2"
snakeyamlVersion: "1.29"
springCloudVersion: "2021.0.0"
httpClientVersion: "4.5.10"
okHttp2Version: "2.7.3"
okHttp3Version: "4.7.2"
httpAsyncClientVersion: "4.1.3"
- springBootVersion: "2.7.17"
snakeyamlVersion: "1.30"
springCloudVersion: "2021.0.3"
httpClientVersion: "4.5.13"
okHttp2Version: "2.7.5"
okHttp3Version: "4.12.0"
httpAsyncClientVersion: "4.1.5"
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 100
- name: set java version to environment
run: |
echo "javaVersion=8" >> $GITHUB_ENV
- name: xds common operation
uses: ./.github/actions/common/xds-service
- name: xds router and lb test
uses: ./.github/actions/scenarios/xds-service/xds-router-lb
43 changes: 39 additions & 4 deletions sermant-integration-tests/xds-service-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,32 @@
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<spring.version>2.7.17</spring.version>
<springboot.version>2.7.17</springboot.version>
<springcloud.version>2021.0.3</springcloud.version>
<httpclient.version>4.5.13</httpclient.version>
<okhttp2.version>2.7.5</okhttp2.version>
<httpclient.async.version>4.1.5</httpclient.async.version>
<okhttp3.version>4.9.3</okhttp3.version>
<snakeyaml.version>1.29</snakeyaml.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${springboot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>${springboot.version}</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>${snakeyaml.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
Expand All @@ -32,9 +52,24 @@
</dependencyManagement>

<modules>
<module>spring-client</module>
<module>spring-server</module>
<module>xds-service-discovery</module>
<module>spring-cloud-client</module>
</modules>

<profiles>
<profile>
<id>xds-discovery</id>
<modules>
<module>spring-client</module>
<module>spring-server</module>
</modules>
</profile>
<profile>
<id>xds-router-lb</id>
<modules>
<module>spring-client</module>
<module>spring-server</module>
<module>spring-cloud-client</module>
</modules>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
value: "false"
- name: agent_service_xds_service_enable
value: "true"
- name: router_plugin_enabled-xds-route
- name: router_plugin_enabled_xds_route
value: "true"
- name: ZOOKEEPER_IP
value: "zookeeper.default.svc.cluster.local"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
version:
exact: base
uri:
exact: /router
prefix: /
ignoreUriCase: false
route:
- destination:
Expand Down
35 changes: 35 additions & 0 deletions sermant-integration-tests/xds-service-test/script/zookeeper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: zookeeper
labels:
app: zookeeper
spec:
replicas: 1
selector:
matchLabels:
app: zookeeper
template:
metadata:
labels:
app: zookeeper
spec:
containers:
- name: zookeeper
image: zookeeper:3.7.1
ports:
- containerPort: 2181
---
apiVersion: v1
kind: Service
metadata:
name: zookeeper
spec:
type: ClusterIP
ports:
- name: zk
port: 2181
targetPort: 2181
protocol: TCP
selector:
app: zookeeper
Loading

0 comments on commit b5ce698

Please sign in to comment.