This is an automated email from the ASF dual-hosted git repository.
xiaoyu 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 504ac8eb4 [ISSUE #4581] add integrated test for k8s ingress controller
(#4820)
504ac8eb4 is described below
commit 504ac8eb494e09afe0dd49095ebfb2dabd9943ab
Author: Kunshuai Zhu <[email protected]>
AuthorDate: Thu Jul 13 19:47:28 2023 +0800
[ISSUE #4581] add integrated test for k8s ingress controller (#4820)
* [ISSUE #4581] add integrated test for k8s ingress controller
* fix typo
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix log
* add serviceAccountName
* add log
* desable traefik
* use kind instead of k3s
* use kind instead of k3s
* use kind instead of k3s
* fix style
* add license
* set ns for role
* fix
* use ClusterRole
* use ClusterRole
* expose port
* add namespace for svc
* Update integrated-test-k8s-ingress.yml
* Update ingress.yml
* Update application.yml
* fix typo
---------
Co-authored-by: xiaoyu <[email protected]>
---
...es-http.yml => integrated-test-k8s-ingress.yml} | 89 +++---
.github/workflows/k8s-examples-http.yml | 4 +-
...henyu-examples-http-service.yml => ingress.yml} | 60 +---
...ttp-deployment.yml => shenyu-examples-http.yml} | 44 +--
...mples-http-service.yml => shenyu-zookeeper.yml} | 44 ++-
shenyu-integrated-test/pom.xml | 1 +
.../integratedtest/common/helper/HttpHelper.java | 44 ++-
.../script/healthcheck.sh | 2 +-
.../http/combination/SignPluginVersionTwoTest.java | 17 +-
.../shenyu-integrated-test-k8s-ingress/Dockerfile | 29 ++
.../deploy/deploy-shenyu.yaml | 110 +++++++
.../deploy/kind-config.yaml | 36 +++
.../shenyu-integrated-test-k8s-ingress/pom.xml | 144 +++++++++
.../script/healthcheck.sh | 2 +-
.../script/services.list | 17 ++
.../k8s/ingress/IngressControllerBootstrap.java | 37 +++
.../src/main/resources/application.yml | 329 +++++++++++++++++++++
.../test/k8s/ingress/DividePluginTest.java | 45 +++
18 files changed, 909 insertions(+), 145 deletions(-)
diff --git a/.github/workflows/k8s-examples-http.yml
b/.github/workflows/integrated-test-k8s-ingress.yml
similarity index 50%
copy from .github/workflows/k8s-examples-http.yml
copy to .github/workflows/integrated-test-k8s-ingress.yml
index cf3961aa3..8a0180852 100644
--- a/.github/workflows/k8s-examples-http.yml
+++ b/.github/workflows/integrated-test-k8s-ingress.yml
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-name: k8s-examples-http
+name: it-k8s
on:
pull_request:
@@ -22,30 +22,33 @@ on:
- master
jobs:
- k8s-examples-http:
+ ingress-controller:
runs-on: ubuntu-latest
if: (github.repository == 'apache/shenyu')
steps:
- -
- uses: actions/checkout@v2
+ - uses: actions/checkout@v2
with:
submodules: true
- -
- uses: dorny/paths-filter@v2
+
+ - uses: dorny/paths-filter@v2
id: filter
with:
filters: '.github/filters.yml'
list-files: json
- -
- name: Install k8s
+
+ - name: Install Go
+ uses: actions/setup-go@v3
+ with:
+ go-version: 1.17.x
+
+ - 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: Cache Maven Repos
+ go install sigs.k8s.io/[email protected]
+ curl -LO
https://storage.googleapis.com/kubernetes-release/release/v1.24.14/bin/linux/amd64/kubectl
&& sudo install kubectl /usr/local/bin/kubectl
+ kind create cluster --image=kindest/node:v1.21.1
--config=./shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/deploy/kind-config.yaml
+
+ - name: Cache Maven Repos
if: steps.filter.outputs.changed == 'true'
uses: actions/cache@v2
with:
@@ -53,37 +56,55 @@ jobs:
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- -
- uses: actions/setup-java@v1
+
+ - uses: actions/setup-java@v1
if: steps.filter.outputs.changed == 'true'
with:
java-version: 8
- -
- name: Build with Maven
+
+ - name: Build with Maven
if: steps.filter.outputs.changed == 'true'
- run: ./mvnw -B clean install -Prelease,docker
-Dmaven.javadoc.skip=true -Dmaven.test.skip=true
- -
- name: Build examples
+ run: ./mvnw -B clean install -Dmaven.javadoc.skip=true
-Dmaven.test.skip=true
+
+ - name: Build integrated tests
+ if: steps.filter.outputs.changed == 'true'
+ run: ./mvnw -B clean install -Pit -DskipTests -f
./shenyu-integrated-test/pom.xml
+
+ - name: Build examples
if: steps.filter.outputs.changed == 'true'
run: ./mvnw -B clean install -Pexample -Dmaven.javadoc.skip=true
-Dmaven.test.skip=true -f ./shenyu-examples/pom.xml
- -
- name: Build k8s Cluster
+
+ - name: Build k8s Cluster
if: steps.filter.outputs.changed == 'true'
run: |
- docker save apache/shenyu-admin:latest
apache/shenyu-bootstrap:latest shenyu-examples-http:latest | sudo k3s ctr
images import -
- kubectl apply -f
./shenyu-examples/shenyu-examples-http/k8s/shenyu-deployment.yml
- kubectl apply -f
./shenyu-examples/shenyu-examples-http/k8s/shenyu-service.yml
- kubectl apply -f
./shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http-deployment.yml
- kubectl apply -f
./shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http-service.yml
- -
- name: Wait for k8s Cluster Start up
+ kind load docker-image "shenyu-examples-http:latest"
+ kind load docker-image
"apache/shenyu-integrated-test-k8s-ingress:latest"
+ kubectl apply -f
./shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http.yml
+ kubectl apply -f
./shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/deploy/deploy-shenyu.yaml
+ kubectl apply -f
./shenyu-examples/shenyu-examples-http/k8s/ingress.yml
+
+ - name: Wait for k8s Cluster Start up
if: steps.filter.outputs.changed == 'true'
run: |
- bash ./shenyu-examples/shenyu-examples-http/k8s/script/healthcheck.sh
- -
- name: Cluster Test after Healthcheck
+ bash
./shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/script/healthcheck.sh
+
+ - name: Run test
+ id: test
+ if: steps.filter.outputs.changed == 'true'
+ run: ./mvnw test -Pit -f
./shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/pom.xml
+ continue-on-error: true
+
+ - name: Cluster Test after Healthcheck
if: steps.filter.outputs.changed == 'true'
run: |
kubectl get all
+ kubectl get all -n shenyu-ingress
kubectl get events --all-namespaces
- kubectl logs -l all=shenyu-examples-http
+ kubectl logs -l app=shenyu-ingress-controller -n shenyu-ingress
--tail=-1
+ if [[ ${{steps.test.outcome}} == "failure" ]]; then
+ echo "Test Failed"
+ exit 1
+ else
+ echo "Test Successful"
+ exit 0
+ fi
diff --git a/.github/workflows/k8s-examples-http.yml
b/.github/workflows/k8s-examples-http.yml
index cf3961aa3..fa0ff46e9 100644
--- a/.github/workflows/k8s-examples-http.yml
+++ b/.github/workflows/k8s-examples-http.yml
@@ -73,8 +73,8 @@ jobs:
docker save apache/shenyu-admin:latest
apache/shenyu-bootstrap:latest shenyu-examples-http:latest | sudo k3s ctr
images import -
kubectl apply -f
./shenyu-examples/shenyu-examples-http/k8s/shenyu-deployment.yml
kubectl apply -f
./shenyu-examples/shenyu-examples-http/k8s/shenyu-service.yml
- kubectl apply -f
./shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http-deployment.yml
- kubectl apply -f
./shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http-service.yml
+ kubectl apply -f
./shenyu-examples/shenyu-examples-http/k8s/shenyu-zookeeper.yml
+ kubectl apply -f
./shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http.yml
-
name: Wait for k8s Cluster Start up
if: steps.filter.outputs.changed == 'true'
diff --git
a/shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http-service.yml
b/shenyu-examples/shenyu-examples-http/k8s/ingress.yml
similarity index 50%
copy from
shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http-service.yml
copy to shenyu-examples/shenyu-examples-http/k8s/ingress.yml
index a0dca62e4..8e7f7b99e 100644
--- a/shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http-service.yml
+++ b/shenyu-examples/shenyu-examples-http/k8s/ingress.yml
@@ -14,49 +14,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-apiVersion: v1
-kind: Service
+apiVersion: networking.k8s.io/v1
+kind: Ingress
metadata:
- name: shenyu-examples-http-service
- labels:
- app: shenyu-examples-http
- all: shenyu-examples-http
+ annotations:
+ kubernetes.io/ingress.class: shenyu
+ shenyu.apache.org/loadbalancer: p2c
+ name: demo-ingress
spec:
- selector:
- app: shenyu-examples-http
- all: shenyu-examples-http
- type: NodePort
- ports:
- - name: "8189"
- port: 8189
- targetPort: 8189
- nodePort: 31189
-status:
- loadBalancer: {}
-
----
-apiVersion: v1
-kind: Service
-metadata:
- name: shenyu-zk
- labels:
- app: shenyu-zk
- all: shenyu-examples-http
-spec:
- type: NodePort
- selector:
- app: shenyu-zk
- all: shenyu-examples-http
- ports:
- - name: "client"
- port: 2181
- targetPort: 2181
- - name: "server"
- port: 2888
- targetPort: 2888
- - name: "election"
- port: 3888
- targetPort: 3888
- - name: "website"
- port: 8080
- targetPort: 8080
+ rules:
+ - http:
+ paths:
+ - backend:
+ service:
+ name: shenyu-examples-http-service
+ port:
+ number: 8189
+ path: /**
+ pathType: ImplementationSpecific
diff --git
a/shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http-deployment.yml
b/shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http.yml
similarity index 72%
rename from
shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http-deployment.yml
rename to shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http.yml
index a22cee252..1ae524415 100644
---
a/shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http-deployment.yml
+++ b/shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http.yml
@@ -54,38 +54,22 @@ spec:
status: {}
---
-apiVersion: apps/v1
-kind: Deployment
+apiVersion: v1
+kind: Service
metadata:
+ name: shenyu-examples-http-service
labels:
- app: shenyu-zk
+ app: shenyu-examples-http
all: shenyu-examples-http
- name: shenyu-zk
spec:
- replicas: 1
selector:
- matchLabels:
- app: shenyu-zk
- all: shenyu-examples-http
- strategy: {}
- template:
- metadata:
- labels:
- app: shenyu-zk
- all: shenyu-examples-http
- spec:
- containers:
- - image: zookeeper:3.5
- name: shenyu-zk
- resources: {}
- ports:
- - containerPort: 2181
- name: client
- - containerPort: 2888
- name: server
- - containerPort: 3888
- name: leader-election
- - containerPort: 8080
- name: website
- restartPolicy: Always
-status: {}
+ app: shenyu-examples-http
+ all: shenyu-examples-http
+ type: NodePort
+ ports:
+ - name: "8189"
+ port: 8189
+ targetPort: 8189
+ nodePort: 31189
+status:
+ loadBalancer: {}
diff --git
a/shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http-service.yml
b/shenyu-examples/shenyu-examples-http/k8s/shenyu-zookeeper.yml
similarity index 65%
rename from
shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http-service.yml
rename to shenyu-examples/shenyu-examples-http/k8s/shenyu-zookeeper.yml
index a0dca62e4..044eac822 100644
--- a/shenyu-examples/shenyu-examples-http/k8s/shenyu-examples-http-service.yml
+++ b/shenyu-examples/shenyu-examples-http/k8s/shenyu-zookeeper.yml
@@ -14,25 +14,41 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-apiVersion: v1
-kind: Service
+apiVersion: apps/v1
+kind: Deployment
metadata:
- name: shenyu-examples-http-service
labels:
- app: shenyu-examples-http
+ app: shenyu-zk
all: shenyu-examples-http
+ name: shenyu-zk
spec:
+ replicas: 1
selector:
- app: shenyu-examples-http
- all: shenyu-examples-http
- type: NodePort
- ports:
- - name: "8189"
- port: 8189
- targetPort: 8189
- nodePort: 31189
-status:
- loadBalancer: {}
+ matchLabels:
+ app: shenyu-zk
+ all: shenyu-examples-http
+ strategy: {}
+ template:
+ metadata:
+ labels:
+ app: shenyu-zk
+ all: shenyu-examples-http
+ spec:
+ containers:
+ - image: zookeeper:3.5
+ name: shenyu-zk
+ resources: {}
+ ports:
+ - containerPort: 2181
+ name: client
+ - containerPort: 2888
+ name: server
+ - containerPort: 3888
+ name: leader-election
+ - containerPort: 8080
+ name: website
+ restartPolicy: Always
+status: {}
---
apiVersion: v1
diff --git a/shenyu-integrated-test/pom.xml b/shenyu-integrated-test/pom.xml
index b48392334..2dad1baf2 100644
--- a/shenyu-integrated-test/pom.xml
+++ b/shenyu-integrated-test/pom.xml
@@ -45,6 +45,7 @@
<module>shenyu-integrated-test-sdk-alibaba-dubbo</module>
<module>shenyu-integrated-test-sdk-http</module>
<module>shenyu-integrated-test-upload-plugin</module>
+ <module>shenyu-integrated-test-k8s-ingress</module>
</modules>
<properties>
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-common/src/main/java/org/apache/shenyu/integratedtest/common/helper/HttpHelper.java
b/shenyu-integrated-test/shenyu-integrated-test-common/src/main/java/org/apache/shenyu/integratedtest/common/helper/HttpHelper.java
index 4021c589c..d556ff672 100644
---
a/shenyu-integrated-test/shenyu-integrated-test-common/src/main/java/org/apache/shenyu/integratedtest/common/helper/HttpHelper.java
+++
b/shenyu-integrated-test/shenyu-integrated-test-common/src/main/java/org/apache/shenyu/integratedtest/common/helper/HttpHelper.java
@@ -37,7 +37,7 @@ import java.util.concurrent.TimeUnit;
/**
* The type Http helper.
*/
-public class HttpHelper {
+public final class HttpHelper {
/**
* The constant INSTANCE.
@@ -45,14 +45,14 @@ public class HttpHelper {
public static final HttpHelper INSTANCE = new HttpHelper();
/**
- * The constant GATEWAY_END_POINT.
+ * The constant JSON.
*/
- public static final String GATEWAY_END_POINT = "http://localhost:9195";
+ public static final MediaType JSON = MediaType.parse("application/json");
/**
- * The constant JSON.
+ * The constant GATEWAY_END_POINT.
*/
- public static final MediaType JSON = MediaType.parse("application/json");
+ private static final String DEFAULT_GATEWAY_END_POINT =
"http://localhost:9195";
private static final Logger LOG =
LoggerFactory.getLogger(HttpHelper.class);
@@ -66,6 +66,30 @@ public class HttpHelper {
private final String localKey = "123456";
+ private String gatewayEndpoint;
+
+ private HttpHelper() {
+ gatewayEndpoint = DEFAULT_GATEWAY_END_POINT;
+ }
+
+ /**
+ * Set gatewayEndpoint.
+ *
+ * @param gatewayEndpoint gatewayEndpoint
+ */
+ public void setGatewayEndpoint(final String gatewayEndpoint) {
+ this.gatewayEndpoint = gatewayEndpoint;
+ }
+
+ /**
+ * Get gatewayEndpoint.
+ *
+ * @return gatewayEndpoint
+ */
+ public String getGatewayEndpoint() {
+ return gatewayEndpoint;
+ }
+
/**
* Send a post http request to shenyu gateway.
*
@@ -165,7 +189,7 @@ public class HttpHelper {
* @throws IOException IO exception
*/
public <S> S postGateway(final String path, final RequestBody requestBody,
final Class<S> respType) throws IOException {
- Request.Builder requestBuilder = new
Request.Builder().post(requestBody).url(GATEWAY_END_POINT +
path).addHeader(Constants.LOCAL_KEY, localKey);
+ Request.Builder requestBuilder = new
Request.Builder().post(requestBody).url(gatewayEndpoint +
path).addHeader(Constants.LOCAL_KEY, localKey);
Response response = client.newCall(requestBuilder.build()).execute();
String respBody = Objects.requireNonNull(response.body()).string();
try {
@@ -176,7 +200,7 @@ public class HttpHelper {
}
private <Q> String post(final String path, final Map<String, Object>
headers, final Q req) throws IOException {
- Request.Builder requestBuilder = new
Request.Builder().post(RequestBody.create(GSON.toJson(req),
JSON)).url(GATEWAY_END_POINT + path).addHeader(Constants.LOCAL_KEY, localKey);
+ Request.Builder requestBuilder = new
Request.Builder().post(RequestBody.create(GSON.toJson(req),
JSON)).url(gatewayEndpoint + path).addHeader(Constants.LOCAL_KEY, localKey);
if (!CollectionUtils.isEmpty(headers)) {
headers.forEach((key, value) -> requestBuilder.addHeader(key,
String.valueOf(value)));
}
@@ -196,7 +220,7 @@ public class HttpHelper {
* @throws IOException IO exception
*/
public <S, Q> S putGateway(final String path, final Q req, final Class<S>
respType) throws IOException {
- Request request = new
Request.Builder().put(RequestBody.create(GSON.toJson(req),
JSON)).url(GATEWAY_END_POINT + path).addHeader(Constants.LOCAL_KEY,
localKey).build();
+ Request request = new
Request.Builder().put(RequestBody.create(GSON.toJson(req),
JSON)).url(gatewayEndpoint + path).addHeader(Constants.LOCAL_KEY,
localKey).build();
Response response = client.newCall(request).execute();
String respBody = Objects.requireNonNull(response.body()).string();
LOG.info("postGateway({}) resp({})", path, respBody);
@@ -231,7 +255,7 @@ public class HttpHelper {
* @throws IOException IO exception
*/
public <S> S getFromGateway(final String path, final Map<String, Object>
headers, final Type type) throws IOException {
- Response response = getHttpService(GATEWAY_END_POINT + path, headers);
+ Response response = getHttpService(gatewayEndpoint + path, headers);
String respBody = Objects.requireNonNull(response.body()).string();
LOG.info("getFromGateway({}) resp({})", path, respBody);
try {
@@ -250,7 +274,7 @@ public class HttpHelper {
* @throws IOException IO exception
*/
public Response getResponseFromGateway(final String path, final
Map<String, Object> headers) throws IOException {
- return getHttpService(GATEWAY_END_POINT + path, headers);
+ return getHttpService(gatewayEndpoint + path, headers);
}
/**
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-http/script/healthcheck.sh
b/shenyu-integrated-test/shenyu-integrated-test-http/script/healthcheck.sh
index 22a76034a..015ad1cd7 100644
--- a/shenyu-integrated-test/shenyu-integrated-test-http/script/healthcheck.sh
+++ b/shenyu-integrated-test/shenyu-integrated-test-http/script/healthcheck.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+ s#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/combination/SignPluginVersionTwoTest.java
b/shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/combination/SignPluginVersionTwoTest.java
index 00bcaa1c5..c4a135308 100644
---
a/shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/combination/SignPluginVersionTwoTest.java
+++
b/shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/combination/SignPluginVersionTwoTest.java
@@ -50,7 +50,6 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-import static
org.apache.shenyu.integratedtest.common.helper.HttpHelper.GATEWAY_END_POINT;
import static
org.apache.shenyu.plugin.sign.extractor.DefaultExtractor.VERSION_2;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -79,7 +78,7 @@ public final class SignPluginVersionTwoTest extends
AbstractPluginDataInit {
@Test
public void testSign() throws Exception {
String now = String.valueOf(System.currentTimeMillis());
- Map<String, Object> normalHeaders = buildHeadersMap(GATEWAY_END_POINT
+ GET_URL, now, APP_KEY, APP_SECRET, null);
+ Map<String, Object> normalHeaders =
buildHeadersMap(HttpHelper.INSTANCE.getGatewayEndpoint() + GET_URL, now,
APP_KEY, APP_SECRET, null);
UserDTO result = HttpHelper.INSTANCE
.getFromGateway(GET_URL, normalHeaders, UserDTO.class);
assertEquals("Lee", result.getUserName());
@@ -88,7 +87,7 @@ public final class SignPluginVersionTwoTest extends
AbstractPluginDataInit {
@Test
public void testSignWithWrongPath() throws Exception {
String now = String.valueOf(System.currentTimeMillis());
- Map<String, Object> errorPathHeaders =
buildHeadersMap(GATEWAY_END_POINT + "/wrong_path", now, APP_KEY, APP_SECRET,
null);
+ Map<String, Object> errorPathHeaders =
buildHeadersMap(HttpHelper.INSTANCE.getGatewayEndpoint() + "/wrong_path", now,
APP_KEY, APP_SECRET, null);
AdminResponse<Object> result = HttpHelper.INSTANCE
.getFromGateway(GET_URL, errorPathHeaders,
AdminResponse.class);
assertEquals("signature value is error!", result.getMessage());
@@ -97,7 +96,7 @@ public final class SignPluginVersionTwoTest extends
AbstractPluginDataInit {
@Test
public void testSignWithWrongKey() throws Exception {
String now = String.valueOf(System.currentTimeMillis());
- Map<String, Object> headers = buildHeadersMap(GATEWAY_END_POINT +
GET_URL, now, "ERRORKEY", APP_SECRET, null);
+ Map<String, Object> headers =
buildHeadersMap(HttpHelper.INSTANCE.getGatewayEndpoint() + GET_URL, now,
"ERRORKEY", APP_SECRET, null);
AdminResponse<Object> result = HttpHelper.INSTANCE
.getFromGateway(GET_URL, headers, AdminResponse.class);
@@ -109,7 +108,7 @@ public final class SignPluginVersionTwoTest extends
AbstractPluginDataInit {
public void testSignWithExpiredSignature() throws Exception {
String errorTime = String.valueOf(System.currentTimeMillis() - 360000);
- Map<String, Object> headers = buildHeadersMap(GATEWAY_END_POINT +
GET_URL, errorTime, APP_KEY, APP_SECRET, null);
+ Map<String, Object> headers =
buildHeadersMap(HttpHelper.INSTANCE.getGatewayEndpoint() + GET_URL, errorTime,
APP_KEY, APP_SECRET, null);
AdminResponse<Object> result = HttpHelper.INSTANCE
.getFromGateway(GET_URL, headers, AdminResponse.class);
@@ -124,7 +123,7 @@ public final class SignPluginVersionTwoTest extends
AbstractPluginDataInit {
Map<String, String> requestBody = Maps.newHashMapWithExpectedSize(2);
requestBody.put("userName", "Lee");
requestBody.put("userId", "3");
- Map<String, Object> headers = buildHeadersMap(GATEWAY_END_POINT +
POST_URL, now, APP_KEY, APP_SECRET, JsonUtils.toJson(requestBody));
+ Map<String, Object> headers =
buildHeadersMap(HttpHelper.INSTANCE.getGatewayEndpoint() + POST_URL, now,
APP_KEY, APP_SECRET, JsonUtils.toJson(requestBody));
UserDTO result = HttpHelper.INSTANCE
.postGateway(POST_URL, headers, requestBody, UserDTO.class);
@@ -141,7 +140,7 @@ public final class SignPluginVersionTwoTest extends
AbstractPluginDataInit {
requestBody.put("userName", "Lee");
requestBody.put("userId", "3");
- Map<String, Object> headers = buildHeadersMap(GATEWAY_END_POINT +
POST_URL, now, APP_KEY, APP_SECRET, JsonUtils.toJson(ImmutableMap.of("userId",
"1234")));
+ Map<String, Object> headers =
buildHeadersMap(HttpHelper.INSTANCE.getGatewayEndpoint() + POST_URL, now,
APP_KEY, APP_SECRET, JsonUtils.toJson(ImmutableMap.of("userId", "1234")));
AdminResponse<Object> result = HttpHelper.INSTANCE
.postGateway(POST_URL, headers, requestBody,
AdminResponse.class);
@@ -151,7 +150,7 @@ public final class SignPluginVersionTwoTest extends
AbstractPluginDataInit {
@Test
public void testSignWithIncompleteParam() throws Exception {
- Map<String, Object> headers = buildHeadersMap(GATEWAY_END_POINT +
POST_URL,
+ Map<String, Object> headers =
buildHeadersMap(HttpHelper.INSTANCE.getGatewayEndpoint() + POST_URL,
null, APP_KEY, APP_SECRET, null);
AdminResponse<Object> result = HttpHelper.INSTANCE
@@ -169,7 +168,7 @@ public final class SignPluginVersionTwoTest extends
AbstractPluginDataInit {
buildSelectorConditionList(notConfiguredPath),
buildRuleLocalDataList(false, notConfiguredPath));
String now = String.valueOf(System.currentTimeMillis());
- Map<String, Object> headers = buildHeadersMap(GATEWAY_END_POINT +
notConfiguredPath, now, APP_KEY, APP_SECRET, null);
+ Map<String, Object> headers =
buildHeadersMap(HttpHelper.INSTANCE.getGatewayEndpoint() + notConfiguredPath,
now, APP_KEY, APP_SECRET, null);
AdminResponse<Object> result = HttpHelper.INSTANCE
.getFromGateway(notConfiguredPath, headers,
AdminResponse.class);
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/Dockerfile
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/Dockerfile
new file mode 100644
index 000000000..b6e063cc7
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/Dockerfile
@@ -0,0 +1,29 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM openjdk:8-jre-alpine
+
+ENV APP_NAME shenyu-integrated-test-k8s-ingress
+ENV LOCAL_PATH /opt/${APP_NAME}
+
+RUN mkdir -p ${LOCAL_PATH}
+
+ADD target/${APP_NAME}.jar ${LOCAL_PATH}
+
+WORKDIR ${LOCAL_PATH}
+EXPOSE 9195
+
+CMD java -jar ${APP_NAME}.jar
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/deploy/deploy-shenyu.yaml
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/deploy/deploy-shenyu.yaml
new file mode 100644
index 000000000..09d8b0d5b
--- /dev/null
+++
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/deploy/deploy-shenyu.yaml
@@ -0,0 +1,110 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: v1
+kind: Namespace
+metadata:
+ name: shenyu-ingress
+---
+apiVersion: v1
+automountServiceAccountToken: true
+kind: ServiceAccount
+metadata:
+ name: shenyu-ingress-controller
+ namespace: shenyu-ingress
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: shenyu-ingress-controller
+ namespace: shenyu-ingress
+ labels:
+ app: shenyu-ingress-controller
+ all: shenyu-ingress-controller
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: shenyu-ingress-controller
+ template:
+ metadata:
+ labels:
+ app: shenyu-ingress-controller
+ spec:
+ containers:
+ - name: shenyu-ingress-controller
+ image: apache/shenyu-integrated-test-k8s-ingress:latest
+ ports:
+ - containerPort: 9195
+ env:
+ - name: KUBECONFIG
+ value: '/root/.kube/config'
+ imagePullPolicy: IfNotPresent
+ serviceAccountName: shenyu-ingress-controller
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: shenyu-ingress-controller
+ namespace: shenyu-ingress
+spec:
+ selector:
+ app: shenyu-ingress-controller
+ type: NodePort
+ ports:
+ - port: 9195
+ targetPort: 9195
+ nodePort: 30095
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+ name: shenyu-ingress-controller
+rules:
+- apiGroups:
+ - ""
+ resources:
+ - namespaces
+ - services
+ - endpoints
+ - secrets
+ - pods
+ verbs:
+ - get
+ - list
+ - watch
+- apiGroups:
+ - networking.k8s.io
+ resources:
+ - ingresses
+ verbs:
+ - get
+ - list
+ - watch
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ name: shenyu-ingress-controller
+ namespace: shenyu-ingress
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: shenyu-ingress-controller
+subjects:
+- kind: ServiceAccount
+ name: shenyu-ingress-controller
+ namespace: shenyu-ingress
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/deploy/kind-config.yaml
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/deploy/kind-config.yaml
new file mode 100644
index 000000000..18b7da990
--- /dev/null
+++
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/deploy/kind-config.yaml
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+kind: Cluster
+apiVersion: kind.x-k8s.io/v1alpha4
+nodes:
+ - role: control-plane
+ kubeadmConfigPatches:
+ - |
+ kind: InitConfiguration
+ nodeRegistration:
+ kubeletExtraArgs:
+ node-labels: "ingress-ready=true"
+ extraPortMappings:
+ - containerPort: 80
+ hostPort: 80
+ protocol: TCP
+ - containerPort: 443
+ hostPort: 443
+ protocol: TCP
+ - containerPort: 30095
+ hostPort: 30095
+ protocol: TCP
\ No newline at end of file
diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/pom.xml
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/pom.xml
new file mode 100644
index 000000000..cc16d753a
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/pom.xml
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>shenyu-integrated-test</artifactId>
+ <groupId>org.apache.shenyu</groupId>
+ <version>2.6.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>shenyu-integrated-test-k8s-ingress</artifactId>
+ <name>shenyu-integrated-test-k8s-ingress</name>
+ <url>https://shenyu.apache.org</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-integrated-test-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-plugin-divide</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+
<artifactId>shenyu-spring-boot-starter-plugin-httpclient</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-plugin-global</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-plugin-uri</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+
<artifactId>shenyu-spring-boot-starter-plugin-general-context</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-k8s</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>it</id>
+ <properties>
+
<docker.buildArg.APP_NAME>shenyu-integrated-test-k8s-ingress</docker.buildArg.APP_NAME>
+
<docker.image.tag.repo>apache/shenyu-integrated-test-k8s-ingress</docker.image.tag.repo>
+ <docker.image.tag.tagName>latest</docker.image.tag.tagName>
+ </properties>
+ <build>
+ <finalName>shenyu-integrated-test-k8s-ingress</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${spring-boot.version}</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+
<mainClass>org.apache.shenyu.integrated.test.k8s.ingress.IngressControllerBootstrap</mainClass>
+ <executable>true</executable>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>${docker-maven-plugin.version}</version>
+ <configuration>
+ <images>
+ <image>
+
<name>apache/shenyu-integrated-test-k8s-ingress</name>
+ <build>
+
<contextDir>${project.basedir}</contextDir>
+ </build>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start</id>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>false</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-http/script/healthcheck.sh
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/script/healthcheck.sh
similarity index 99%
copy from
shenyu-integrated-test/shenyu-integrated-test-http/script/healthcheck.sh
copy to
shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/script/healthcheck.sh
index 22a76034a..896e78414 100644
--- a/shenyu-integrated-test/shenyu-integrated-test-http/script/healthcheck.sh
+++
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/script/healthcheck.sh
@@ -32,5 +32,5 @@ do
done
done
-sleep 3
+sleep 20
echo -e "\n-------------------"
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/script/services.list
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/script/services.list
new file mode 100644
index 000000000..566b51d0d
--- /dev/null
+++
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/script/services.list
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+http://localhost:31189/test/path/123?name=tom
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/src/main/java/org/apache/shenyu/integrated/test/k8s/ingress/IngressControllerBootstrap.java
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/src/main/java/org/apache/shenyu/integrated/test/k8s/ingress/IngressControllerBootstrap.java
new file mode 100644
index 000000000..127bc413f
--- /dev/null
+++
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/src/main/java/org/apache/shenyu/integrated/test/k8s/ingress/IngressControllerBootstrap.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.integrated.test.k8s.ingress;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * The type ingress controller integrated bootstrap.
+ */
+@SpringBootApplication
+public class IngressControllerBootstrap {
+
+ /**
+ * main method of App.
+ *
+ * @param args args
+ */
+ public static void main(final String[] args) {
+ SpringApplication.run(IngressControllerBootstrap.class);
+ }
+}
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/src/main/resources/application.yml
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/src/main/resources/application.yml
new file mode 100644
index 000000000..854a16e16
--- /dev/null
+++
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/src/main/resources/application.yml
@@ -0,0 +1,329 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+server:
+ port: 9195
+ address: 0.0.0.0
+
+spring:
+ main:
+ allow-bean-definition-overriding: true
+ application:
+ name: shenyu-bootstrap
+ codec:
+ max-in-memory-size: 2MB
+ cloud:
+ discovery:
+ enabled: false
+ nacos:
+ discovery:
+ server-addr: 127.0.0.1:8848 # Spring Cloud Alibaba Dubbo use this.
+ enabled: false
+ namespace: ShenyuRegisterCenter
+
+# if you want use ribbon please config every server.
+#springCloud-test:
+# ribbon:
+# NIWSServerListClassName:
com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList
+
+eureka:
+ client:
+ enabled: false
+ serviceUrl:
+ defaultZone: http://localhost:8761/eureka/
+ instance:
+ prefer-ip-address: true
+
+# security:
+# oauth2:
+# client:
+# registration:
+# <your client-registration-id>:
+# client-id: <your client-id>
+# client-secret: <your client-secret>
+# provider:
+# <your client-registration-id>:
+# authorization-uri: <your authorization-uri>
+# token-uri: <your access-token-uri>
+# user-info-uri: <your user-info-uri>
+# jwk-set-uri: <your jwk-set-uri>
+
+management:
+ health:
+ redis:
+ enabled: false
+ elasticsearch:
+ enabled: false
+ endpoint:
+ health:
+ enabled: true
+ show-details: always
+ endpoints:
+ web:
+ exposure:
+ include: "*" # or health,info
+
+
+shenyu:
+ selectorMatchCache:
+ ## selector L1 cache
+ cache:
+ enabled: false
+ initialCapacity: 10000 # initial capacity in cache
+ maximumSize: 10000 # max size in cache
+ ## selector L2 cache, use trie as L2 cache
+ trie:
+ enabled: false
+ cacheSize: 128 # the number of plug-ins
+ matchMode: antPathMatch
+ ruleMatchCache:
+ ## rule L1 cache
+ cache:
+ enabled: true
+ initialCapacity: 10000 # initial capacity in cache
+ maximumSize: 65536 # max size in cache
+ ## rule L2 cache, use trie as L2 cache
+ trie:
+ enabled: false
+ cacheSize: 1024 # the number of selectors
+ matchMode: antPathMatch
+ netty:
+ http:
+ # set to false, user can custom the netty tcp server config.
+ webServerFactoryEnabled: true
+ selectCount: 1
+ workerCount: 8
+ accessLog: false
+ serverSocketChannel:
+ soRcvBuf: 87380
+ soBackLog: 128
+ soReuseAddr: false
+ connectTimeoutMillis: 10000
+ writeBufferHighWaterMark: 65536
+ writeBufferLowWaterMark: 32768
+ writeSpinCount: 16
+ autoRead: false
+ allocType: "pooled"
+ messageSizeEstimator: 8
+ singleEventExecutorPerGroup: true
+ socketChannel:
+ soKeepAlive: false
+ soReuseAddr: false
+ soLinger: -1
+ tcpNoDelay: true
+ soRcvBuf: 87380
+ soSndBuf: 16384
+ ipTos: 0
+ allowHalfClosure: false
+ connectTimeoutMillis: 10000
+ writeBufferHighWaterMark: 65536
+ writeBufferLowWaterMark: 32768
+ writeSpinCount: 16
+ autoRead: false
+ allocType: "pooled"
+ messageSizeEstimator: 8
+ singleEventExecutorPerGroup: true
+ sni:
+ enabled: false
+ mod: k8s #manul
+ defaultK8sSecretNamespace: shenyu-ingress
+ defaultK8sSecretName: default-cert
+# mod: manual
+# certificates:
+# - domain: 'localhost'
+# keyCertChainFile:
'/Users/zhukunshuai/Desktop/cert/example.com+1.pem'
+# keyFile: '/Users/zhukunshuai/Desktop/cert/example.com+1-key.pem'
+# - domain: 'example.com'
+# keyCertChainFile:
'/Users/zhukunshuai/Desktop/cert/example.com+1.pem'
+# keyFile: '/Users/zhukunshuai/Desktop/cert/example.com+1-key.pem'
+ httpclient:
+ strategy: netty
+# connectTimeout: 45000
+# responseTimeout: 3000
+# readerIdleTime: 3000
+# writerIdleTime: 3000
+# allIdleTime: 3000
+# readTimeout: 3000
+# writeTimeout: 3000
+# wiretap: false
+# keepAlive: false
+# maxInMemorySize: 1 #1mb
+# pool:
+# type: ELASTIC
+# name: proxy
+# maxConnections: 16
+# acquireTimeout: 45000
+# maxIdleTime: 3000
+# proxy:
+# host:
+# port:
+# username:
+# password:
+# nonProxyHostsPattern:
+# ssl:
+# useInsecureTrustManager: true
+# keyStoreType: PKCS12
+# keyStorePath: classpath:keystore.p12
+# keyStorePassword: 123456
+# keyStoreProvider:
+# keyPassword: 123456
+# trustedX509Certificates:
+# handshakeTimeout:
+# closeNotifyFlushTimeout:
+# closeNotifyReadTimeout:
+# defaultConfigurationType:
+# threadPool:
+# prefix: shenyu
+# selectCount: 1
+# workerCount: 8
+# daemon: true
+ register:
+ enabled: false
+ registerType: zookeeper #etcd #consul
+ serverLists: localhost:2181 #http://localhost:2379 #localhost:8848
+ props:
+ cross:
+ enabled: true
+ allowedHeaders:
+ allowedMethods: "*"
+ allowedAnyOrigin: true # the same of Access-Control-Allow-Origin: "*"
+# allowedOrigin:
+ # format : schema://prefix spacer domain
+ # Access-Control-Allow-Origin: "http://a.apache.org,http://b.apache.org"
+# spacer: "."
+# domain: apache.org
+# prefixes:
+# - a # a.apache.org
+# - b # b.apache.org
+# origins:
+# - c.apache.org
+# - d.apache.org
+# - http://e.apache.org
+# originRegex: ^http(|s)://(.*\.|)abc.com$
+ allowedExpose: ""
+ maxAge: "18000"
+ allowCredentials: true
+
+ switchConfig:
+ local: true
+ collapseSlashes: false
+ file:
+ enabled: true
+ maxSize : 10
+# sync:
+# websocket:
+# urls: ws://localhost:9095/websocket
+# allowOrigin: ws://localhost:9195
+# apollo:
+# appId: shenyu
+# meta: http://localhost:8080
+# env: dev
+# clusterName: test
+# namespace: application
+# zookeeper:
+# url: localhost:2181
+# sessionTimeout: 5000
+# connectionTimeout: 2000
+# http:
+# url: http://localhost:9095
+# username:
+# password:
+# nacos:
+# url: localhost:8848
+# namespace: 1c10d748-af86-43b9-8265-75f487d20c6c
+# username:
+# password:
+# acm:
+# enabled: false
+# endpoint: acm.aliyun.com
+# namespace:
+# accessKey:
+# secretKey:
+# etcd:
+# url: http://localhost:2379
+# consul:
+# url: http://localhost:8500
+# waitTime: 1000
+# watchDelay: 1000
+ exclude:
+ enabled: false
+ paths:
+ - /favicon.ico
+ fallback:
+ enabled: false
+ paths:
+ - /fallback/hystrix
+ - /fallback/resilience4j
+ - /fallback/sentinel
+ health:
+ enabled: true
+ paths:
+ - /actuator
+ - /health_check
+ extPlugin:
+ path:
+ enabled: true
+ threads: 1
+ scheduleTime: 300
+ scheduleDelay: 30
+ scheduler:
+ enabled: false
+ type: fixed
+ threads: 16
+ upstreamCheck:
+ enabled: false
+ poolSize: 10
+ timeout: 3000
+ healthyThreshold: 1
+ unhealthyThreshold: 1
+ interval: 5000
+ printEnabled: true
+ printInterval: 60000
+ springCloudCache:
+ enabled: false
+ ribbon:
+ serverListRefreshInterval: 10000
+ metrics:
+ enabled: false
+ name : prometheus
+ host: 127.0.0.1
+ port: 8090
+ jmxConfig:
+ props:
+ jvm_enabled: true
+# plugins:
+# rate-limiter.enabled: false
+ local:
+ enabled: false
+ sha512Key:
"BA3253876AED6BC22D4A6FF53D8406C6AD864195ED144AB5C87621B6C233B548BAEAE6956DF346EC8C17F5EA10F35EE3CBC514797ED7DDD3145464E2A0BAB413"
+# sharedPool:
+# enable: true
+# prefix: "shenyu-shared"
+# corePoolSize: 200
+# maximumPoolSize: 2000
+# keepAliveTime: 60000
+# # 1GB
+# maxWorkQueueMemory: 1073741824
+# # 256MB
+# maxFreeMemory: 268435456
+
+logging:
+ level:
+ root: info
+ org.springframework.boot: info
+ org.apache.ibatis: info
+ org.apache.shenyu.bonuspoint: info
+ org.apache.shenyu.lottery: info
+ org.apache.shenyu: info
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/src/test/java/org/apache/shenyu/integrated/test/k8s/ingress/DividePluginTest.java
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/src/test/java/org/apache/shenyu/integrated/test/k8s/ingress/DividePluginTest.java
new file mode 100644
index 000000000..e81337fe8
--- /dev/null
+++
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress/src/test/java/org/apache/shenyu/integrated/test/k8s/ingress/DividePluginTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.integrated.test.k8s.ingress;
+
+import org.apache.shenyu.integratedtest.common.dto.OrderDTO;
+import org.apache.shenyu.integratedtest.common.helper.HttpHelper;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * Test divide plugin in ingress controller.
+ */
+public class DividePluginTest {
+
+ private static final HttpHelper HTTP_HELPER = HttpHelper.INSTANCE;
+
+ @BeforeAll
+ public static void setup() {
+ HTTP_HELPER.setGatewayEndpoint("http://localhost:30095");
+ }
+
+ @Test
+ public void testHelloWorld() throws Exception {
+ OrderDTO user = new OrderDTO("123", "Tom");
+ user = HttpHelper.INSTANCE.postGateway("/order/save", user,
OrderDTO.class);
+ assertEquals("hello world save order", user.getName());
+ }
+}