-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from daizhenyu/2.1.x
xds router demo
- Loading branch information
Showing
23 changed files
with
903 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,4 +195,14 @@ jobs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ github.workspace }}/package/result/sermant-examples-xds-service-discovery-demo-${{ env.version }}.tar.gz | ||
asset_name: sermant-examples-xds-service-discovery-demo-${{ env.version }}.tar.gz | ||
asset_content_type: application/tar | ||
- name: Upload Release xds-router-demo # xds-router-demo release包 | ||
id: upload-release-asset-xds-router | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ github.workspace }}/package/result/sermant-examples-xds-router-demo-${{ env.version }}.tar.gz | ||
asset_name: sermant-examples-xds-router-demo-${{ env.version }}.tar.gz | ||
asset_content_type: application/tar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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>sermant-examples</artifactId> | ||
<groupId>com.huaweicloud.sermant.examples</groupId> | ||
<version>1.0.0</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>xds-router-demo</artifactId> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>spring-cloud-client-xds</module> | ||
<module>spring-cloud-server-xds</module> | ||
</modules> | ||
|
||
<properties> | ||
<maven.compiler.source>8</maven.compiler.source> | ||
<maven.compiler.target>8</maven.compiler.target> | ||
<springboot.version>2.7.17</springboot.version> | ||
<springcloud.version>2021.0.3</springcloud.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.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-dependencies</artifactId> | ||
<version>${springcloud.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: spring-client | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: spring-client | ||
template: | ||
metadata: | ||
labels: | ||
app: spring-client | ||
spec: | ||
containers: | ||
- name: spring-client | ||
image: spring-client:1.0.0 | ||
imagePullPolicy: Never | ||
ports: | ||
- containerPort: 8080 | ||
env: | ||
- name: agent_service_dynamic_config_enable | ||
value: "false" | ||
- name: agent_service_xds_service_enable | ||
value: "true" | ||
- name: router_plugin_enabled_xds_route | ||
value: "true" | ||
- name: ZOOKEEPER_ENABLED | ||
value: "false" | ||
- name: JAVA_TOOL_OPTIONS | ||
value: "-javaagent:/home/agent/sermant-agent.jar" | ||
imagePullSecrets: | ||
- name: default-secret | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: spring-client | ||
spec: | ||
type: NodePort | ||
ports: | ||
- port: 8080 | ||
targetPort: 8080 | ||
nodePort: 30110 | ||
selector: | ||
app: spring-client |
16 changes: 16 additions & 0 deletions
16
xds-router-demo/router-product/script/spring-server-destination.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: networking.istio.io/v1alpha3 | ||
kind: DestinationRule | ||
metadata: | ||
name: spring-server-destinationrule-robin | ||
spec: | ||
host: spring-server.default.svc.cluster.local | ||
trafficPolicy: | ||
loadBalancer: | ||
simple: ROUND_ROBIN | ||
subsets: | ||
- name: v1 | ||
labels: | ||
version: v1 | ||
- name: v2 | ||
labels: | ||
version: v2 |
22 changes: 22 additions & 0 deletions
22
xds-router-demo/router-product/script/spring-server-virtureservice.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: networking.istio.io/v1alpha3 | ||
kind: VirtualService | ||
metadata: | ||
name: spring-server-virtualservice | ||
spec: | ||
hosts: | ||
- spring-server | ||
http: | ||
- name: "v1-routes" | ||
match: | ||
- headers: | ||
version: | ||
exact: v1 | ||
uri: | ||
exact: /router | ||
ignoreUriCase: false | ||
route: | ||
- destination: | ||
host: spring-server | ||
subset: v1 | ||
port: | ||
number: 8081 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: spring-server-v1 | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: spring-server | ||
version: v1 | ||
template: | ||
metadata: | ||
labels: | ||
app: spring-server | ||
version: v1 | ||
spec: | ||
containers: | ||
- name: spring-server | ||
image: spring-server:1.0.0 | ||
imagePullPolicy: Never | ||
ports: | ||
- containerPort: 8081 | ||
env: | ||
- name: SERVER_VERSION | ||
value: "v1" | ||
- name: ZOOKEEPER_ENABLED | ||
value: "false" | ||
imagePullSecrets: | ||
- name: default-secret | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: spring-server-v2 | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: spring-server | ||
version: v2 | ||
template: | ||
metadata: | ||
labels: | ||
app: spring-server | ||
version: v2 | ||
spec: | ||
containers: | ||
- name: spring-server | ||
image: spring-server:1.0.0 | ||
imagePullPolicy: Never | ||
ports: | ||
- containerPort: 8081 | ||
env: | ||
- name: SERVER_VERSION | ||
value: "v2" | ||
- name: ZOOKEEPER_ENABLED | ||
value: "false" | ||
imagePullSecrets: | ||
- name: default-secret | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: spring-server | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- port: 8081 | ||
targetPort: 8081 | ||
protocol: TCP | ||
name: http | ||
selector: | ||
app: spring-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM openjdk:8 | ||
WORKDIR /home | ||
COPY agent/ /home/agent | ||
COPY spring-client.jar /home/spring-client.jar | ||
COPY start.sh /home | ||
RUN chmod -R 777 /home | ||
ENTRYPOINT ["sh", "/home/start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docker build -f Dockerfile -t spring-client:1.0.0 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exec java -jar /home/spring-client.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM openjdk:8 | ||
WORKDIR /home | ||
COPY spring-server.jar /home/spring-server.jar | ||
COPY start.sh /home | ||
RUN chmod -R 777 /home | ||
ENTRYPOINT ["sh", "/home/start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docker build -f Dockerfile -t spring-server:1.0.0 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exec java -jar /home/spring-server.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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>xds-router-demo</artifactId> | ||
<groupId>com.huaweicloud.sermant.examples</groupId> | ||
<version>1.0.0</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>spring-cloud-client-xds</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>8</maven.compiler.source> | ||
<maven.compiler.target>8</maven.compiler.target> | ||
<httpclient.version>4.5.13</httpclient.version> | ||
<okhttp3.version>4.9.3</okhttp3.version> | ||
<httpclient.async.version>4.1.5</httpclient.async.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-configuration-processor</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-zookeeper-discovery</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
<artifactId>httpclient</artifactId> | ||
<version>${httpclient.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.squareup.okhttp3</groupId> | ||
<artifactId>okhttp</artifactId> | ||
<version>${okhttp3.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
<artifactId>httpasyncclient</artifactId> | ||
<version>${httpclient.async.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<version>${springboot.version}</version> | ||
<configuration> | ||
<mainClass>io.sermant.demo.xds.spring.client.SpringCloudClientApplication</mainClass> | ||
<finalName>spring-client</finalName> | ||
<outputDirectory>${pom.basedir}/../product/spring-client</outputDirectory> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>repackage</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>2.5</version> | ||
<inherited>false</inherited> | ||
<executions> | ||
<execution> | ||
<id>agent-clean</id> | ||
<phase>clean</phase> | ||
<goals> | ||
<goal>clean</goal> | ||
</goals> | ||
<configuration> | ||
<filesets> | ||
<fileset> | ||
<directory>${pom.basedir}/../product/spring-client</directory> | ||
<includes> | ||
<include>spring-client.jar</include> | ||
</includes> | ||
</fileset> | ||
</filesets> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
Oops, something went wrong.