This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git
The following commit(s) were added to refs/heads/master by this push:
new 7413d3fe submit xds demo (#493)
7413d3fe is described below
commit 7413d3fe3653b84cd654e1ebd56c928cb2640081
Author: Albumen Kevin <[email protected]>
AuthorDate: Wed Aug 10 16:33:51 2022 +0800
submit xds demo (#493)
* submit xds demo
* remove readme
* update image
* update scala
---
dubbo-samples-scala/pom.xml | 2 +-
.../dubbo-samples-xds-consumer/Dockerfile | 3 +
.../dubbo-samples-xds-consumer/pom.xml | 233 +++++++++++++++++++++
.../apache/dubbo/samples/ConsumerBootstrap.java | 54 +++++
.../samples/action/GreetingServiceConsumer.java | 37 ++++
.../apache/dubbo/samples/api/GreetingService.java | 26 +++
.../src/main/resources/k8s/Deployment.yml | 36 ++++
.../src/main/resources/k8s/Service.yml | 14 ++
.../src/main/resources/log4j.properties | 23 ++
.../resources/spring/dubbo-consumer.properties | 25 +++
.../dubbo-samples-xds-provider/Dockerfile | 3 +
.../dubbo-samples-xds-provider/pom.xml | 232 ++++++++++++++++++++
.../apache/dubbo/samples/ProviderBootstrap.java | 44 ++++
.../apache/dubbo/samples/api/GreetingService.java | 26 +++
.../samples/impl/AnnotatedGreetingService.java | 35 ++++
.../src/main/resources/k8s/Deployment.yml | 36 ++++
.../src/main/resources/k8s/Service.yml | 14 ++
.../src/main/resources/log4j.properties | 23 ++
.../resources/spring/dubbo-provider.properties | 25 +++
dubbo-samples-xds/pom.xml | 51 +++++
pom.xml | 1 +
21 files changed, 942 insertions(+), 1 deletion(-)
diff --git a/dubbo-samples-scala/pom.xml b/dubbo-samples-scala/pom.xml
index b8de17c4..a540d16e 100644
--- a/dubbo-samples-scala/pom.xml
+++ b/dubbo-samples-scala/pom.xml
@@ -138,7 +138,7 @@
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
- <version>3.3.3</version>
+ <version>4.7.1</version>
<executions>
<execution>
<goals>
diff --git a/dubbo-samples-xds/dubbo-samples-xds-consumer/Dockerfile
b/dubbo-samples-xds/dubbo-samples-xds-consumer/Dockerfile
new file mode 100644
index 00000000..04734e95
--- /dev/null
+++ b/dubbo-samples-xds/dubbo-samples-xds-consumer/Dockerfile
@@ -0,0 +1,3 @@
+FROM openjdk:8-jdk
+ADD ./target/dubbo-samples-xds-consumer-1.0-SNAPSHOT.jar
dubbo-samples-xds-consumer-1.0-SNAPSHOT.jar
+CMD java -jar
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=31000
/dubbo-samples-xds-consumer-1.0-SNAPSHOT.jar
\ No newline at end of file
diff --git a/dubbo-samples-xds/dubbo-samples-xds-consumer/pom.xml
b/dubbo-samples-xds/dubbo-samples-xds-consumer/pom.xml
new file mode 100644
index 00000000..54ac25c4
--- /dev/null
+++ b/dubbo-samples-xds/dubbo-samples-xds-consumer/pom.xml
@@ -0,0 +1,233 @@
+<?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">
+ <groupId>org.apache.dubbo</groupId>
+ <version>1.0-SNAPSHOT</version>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>dubbo-samples-xds-consumer</artifactId>
+
+ <properties>
+ <source.level>1.8</source.level>
+ <target.level>1.8</target.level>
+ <dubbo.version>3.1.0-SNAPSHOT</dubbo.version>
+ <spring.version>4.3.16.RELEASE</spring.version>
+ <junit.version>4.12</junit.version>
+ <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-framework-bom</artifactId>
+ <version>${spring.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-bom</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-dependencies-bom</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-xds</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-protobuf</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-stub</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-netty-shaded</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.envoyproxy.controlplane</groupId>
+ <artifactId>api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java-util</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcprov-jdk15on</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcpkix-jdk15on</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcprov-ext-jdk15on</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <!-- For jdk 11 above JavaEE annotation -->
+ <profile>
+ <id>javax.annotation</id>
+ <activation>
+ <jdk>[1.11,)</jdk>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ <version>1.3.2</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${maven-compiler-plugin.version}</version>
+ <configuration>
+ <source>${source.level}</source>
+ <target>${target.level}</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>2.6.4</version>
+ <configuration>
+
<mainClass>org.apache.dubbo.samples.ConsumerBootstrap</mainClass>
+ <image>
+ <name>dubboteam/${project.artifactId}</name>
+ <!--
<pullPolicy>IF_NOT_PRESENT</pullPolicy>-->
+ </image>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>2.4.1</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <filters>
+ <filter>
+ <artifact>*:*</artifact>
+ <excludes>
+ <exclude>META-INF/*.SF</exclude>
+ <exclude>META-INF/*.DSA</exclude>
+ <exclude>META-INF/*.RSA</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ <transformers>
+ <transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+
<mainClass>org.apache.dubbo.samples.ConsumerBootstrap</mainClass>
+ </transformer>
+ <transformer
+
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+
<resource>META-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscoveryFactory</resource>
+ </transformer>
+ <transformer
+
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+
<resource>META-INF/dubbo/internal/org.apache.dubbo.registry.RegistryFactory</resource>
+ </transformer>
+ </transformers>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>apache.snapshots.https</id>
+ <name>Apache Development Snapshot Repository</name>
+
<url>https://repository.apache.org/content/repositories/snapshots</url>
+ <layout>default</layout>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
\ No newline at end of file
diff --git
a/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/java/org/apache/dubbo/samples/ConsumerBootstrap.java
b/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/java/org/apache/dubbo/samples/ConsumerBootstrap.java
new file mode 100644
index 00000000..304e47de
--- /dev/null
+++
b/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/java/org/apache/dubbo/samples/ConsumerBootstrap.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * 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.dubbo.samples;
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.apache.dubbo.samples.action.GreetingServiceConsumer;
+
+import
org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+
+public class ConsumerBootstrap {
+
+ public static void main(String[] args) {
+ AnnotationConfigApplicationContext context = new
AnnotationConfigApplicationContext(ConsumerConfiguration.class);
+ context.start();
+ GreetingServiceConsumer greetingServiceConsumer =
context.getBean(GreetingServiceConsumer.class);
+ while (true) {
+ try {
+ String hello = greetingServiceConsumer.doSayHello("xDS
Consumer");
+ System.out.println("result: " + hello);
+ Thread.sleep(100);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ }
+
+ @Configuration
+ @EnableDubbo(scanBasePackages = "org.apache.dubbo.samples.action")
+ @PropertySource("classpath:/spring/dubbo-consumer.properties")
+ @ComponentScan(value = {"org.apache.dubbo.samples.action"})
+ static class ConsumerConfiguration {
+
+ }
+}
diff --git
a/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/java/org/apache/dubbo/samples/action/GreetingServiceConsumer.java
b/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/java/org/apache/dubbo/samples/action/GreetingServiceConsumer.java
new file mode 100644
index 00000000..b5c9abdc
--- /dev/null
+++
b/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/java/org/apache/dubbo/samples/action/GreetingServiceConsumer.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.dubbo.samples.action;
+
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.apache.dubbo.samples.api.GreetingService;
+
+import org.springframework.stereotype.Component;
+
+@Component("annotatedConsumer")
+public class GreetingServiceConsumer {
+
+ @DubboReference(version = "1.0.0", providedBy =
"dubbo-samples-xds-provider")
+ private GreetingService greetingService;
+
+ public String doSayHello(String name) {
+ return greetingService.sayHello(name);
+ }
+
+}
diff --git
a/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/java/org/apache/dubbo/samples/api/GreetingService.java
b/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/java/org/apache/dubbo/samples/api/GreetingService.java
new file mode 100644
index 00000000..997ece7e
--- /dev/null
+++
b/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/java/org/apache/dubbo/samples/api/GreetingService.java
@@ -0,0 +1,26 @@
+/*
+ *
+ * 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.dubbo.samples.api;
+
+public interface GreetingService {
+
+ String sayHello(String name);
+
+}
diff --git
a/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/resources/k8s/Deployment.yml
b/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/resources/k8s/Deployment.yml
new file mode 100644
index 00000000..859acd69
--- /dev/null
+++
b/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/resources/k8s/Deployment.yml
@@ -0,0 +1,36 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: dubbo-samples-xds-consumer
+ namespace: dubbo-demo
+spec:
+ replicas: 2
+ selector:
+ matchLabels:
+ app: dubbo-samples-xds-consumer
+ template:
+ metadata:
+ labels:
+ app: dubbo-samples-xds-consumer
+ spec:
+ containers:
+ - name: server
+ image: dubboteam/dubbo-samples-xds-consumer:1.0.0
+ livenessProbe:
+ httpGet:
+ path: /live
+ port: 22222
+ initialDelaySeconds: 5
+ periodSeconds: 5
+ readinessProbe:
+ httpGet:
+ path: /ready
+ port: 22222
+ initialDelaySeconds: 5
+ periodSeconds: 5
+ startupProbe:
+ httpGet:
+ path: /startup
+ port: 22222
+ failureThreshold: 30
+ periodSeconds: 10
\ No newline at end of file
diff --git
a/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/resources/k8s/Service.yml
b/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/resources/k8s/Service.yml
new file mode 100644
index 00000000..1e7eeca1
--- /dev/null
+++
b/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/resources/k8s/Service.yml
@@ -0,0 +1,14 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: dubbo-samples-xds-consumer
+ namespace: dubbo-demo
+spec:
+ clusterIP: None
+ selector:
+ app: dubbo-samples-xds-consumer
+ ports:
+ - name: grpc
+ protocol: TCP
+ port: 50051
+ targetPort: 50051
\ No newline at end of file
diff --git
a/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/resources/log4j.properties
b/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/resources/log4j.properties
new file mode 100644
index 00000000..9e04984b
--- /dev/null
+++
b/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/resources/log4j.properties
@@ -0,0 +1,23 @@
+#
+#
+# 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.
+#
+#
+log4j.rootLogger=info, stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}]
%t %5p %c{2}: %m%n
\ No newline at end of file
diff --git
a/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/resources/spring/dubbo-consumer.properties
b/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/resources/spring/dubbo-consumer.properties
new file mode 100644
index 00000000..e866c68d
--- /dev/null
+++
b/dubbo-samples-xds/dubbo-samples-xds-consumer/src/main/resources/spring/dubbo-consumer.properties
@@ -0,0 +1,25 @@
+#
+#
+# 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.
+#
+#
+dubbo.application.name=dubbo-samples-xds-consumer
+dubbo.application.metadataServicePort=20885
+dubbo.registry.address=xds://istiod.istio-system.svc:15012
+dubbo.consumer.timeout=3000
+dubbo.consumer.check=false
+dubbo.application.qosEnable=true
+dubbo.application.qosAcceptForeignIp=true
\ No newline at end of file
diff --git a/dubbo-samples-xds/dubbo-samples-xds-provider/Dockerfile
b/dubbo-samples-xds/dubbo-samples-xds-provider/Dockerfile
new file mode 100644
index 00000000..38c6d220
--- /dev/null
+++ b/dubbo-samples-xds/dubbo-samples-xds-provider/Dockerfile
@@ -0,0 +1,3 @@
+FROM openjdk:8-jdk
+ADD ./target/dubbo-samples-xds-provider-1.0-SNAPSHOT.jar
dubbo-samples-xds-provider-1.0-SNAPSHOT.jar
+CMD java -jar
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=31000
/dubbo-samples-xds-provider-1.0-SNAPSHOT.jar
\ No newline at end of file
diff --git a/dubbo-samples-xds/dubbo-samples-xds-provider/pom.xml
b/dubbo-samples-xds/dubbo-samples-xds-provider/pom.xml
new file mode 100644
index 00000000..6d8ff9eb
--- /dev/null
+++ b/dubbo-samples-xds/dubbo-samples-xds-provider/pom.xml
@@ -0,0 +1,232 @@
+<?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">
+ <groupId>org.apache.dubbo</groupId>
+ <version>1.0-SNAPSHOT</version>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>dubbo-samples-xds-provider</artifactId>
+
+ <properties>
+ <source.level>1.8</source.level>
+ <target.level>1.8</target.level>
+ <dubbo.version>3.1.0-SNAPSHOT</dubbo.version>
+ <spring.version>4.3.16.RELEASE</spring.version>
+ <junit.version>4.12</junit.version>
+ <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-framework-bom</artifactId>
+ <version>${spring.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-bom</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-dependencies-bom</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-xds</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-protobuf</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-stub</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-netty-shaded</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.envoyproxy.controlplane</groupId>
+ <artifactId>api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java-util</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcprov-jdk15on</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcpkix-jdk15on</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcprov-ext-jdk15on</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <!-- For jdk 11 above JavaEE annotation -->
+ <profile>
+ <id>javax.annotation</id>
+ <activation>
+ <jdk>[1.11,)</jdk>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ <version>1.3.2</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${maven-compiler-plugin.version}</version>
+ <configuration>
+ <source>${source.level}</source>
+ <target>${target.level}</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>2.6.4</version>
+ <configuration>
+
<mainClass>org.apache.dubbo.samples.ProviderBootstrap</mainClass>
+ <image>
+ <name>dubboteam/${project.artifactId}</name>
+ <pullPolicy>IF_NOT_PRESENT</pullPolicy>
+ </image>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>2.4.1</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <filters>
+ <filter>
+ <artifact>*:*</artifact>
+ <excludes>
+ <exclude>META-INF/*.SF</exclude>
+ <exclude>META-INF/*.DSA</exclude>
+ <exclude>META-INF/*.RSA</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ <transformers>
+ <transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+
<mainClass>org.apache.dubbo.samples.ProviderBootstrap</mainClass>
+ </transformer>
+ <transformer
+
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+
<resource>META-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscoveryFactory</resource>
+ </transformer>
+ <transformer
+
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+
<resource>META-INF/dubbo/internal/org.apache.dubbo.registry.RegistryFactory</resource>
+ </transformer>
+ </transformers>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>apache.snapshots.https</id>
+ <name>Apache Development Snapshot Repository</name>
+
<url>https://repository.apache.org/content/repositories/snapshots</url>
+ <layout>default</layout>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
\ No newline at end of file
diff --git
a/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/java/org/apache/dubbo/samples/ProviderBootstrap.java
b/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/java/org/apache/dubbo/samples/ProviderBootstrap.java
new file mode 100644
index 00000000..7a494a27
--- /dev/null
+++
b/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/java/org/apache/dubbo/samples/ProviderBootstrap.java
@@ -0,0 +1,44 @@
+/*
+ *
+ * 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.dubbo.samples;
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+
+import
org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+
+import java.util.concurrent.CountDownLatch;
+
+public class ProviderBootstrap {
+
+ public static void main(String[] args) throws Exception {
+ AnnotationConfigApplicationContext context = new
AnnotationConfigApplicationContext(ProviderConfiguration.class);
+ context.start();
+ System.out.println("dubbo service started");
+ new CountDownLatch(1).await();
+ }
+
+ @Configuration
+ @EnableDubbo(scanBasePackages = "org.apache.dubbo.samples.impl")
+ @PropertySource("classpath:/spring/dubbo-provider.properties")
+ static class ProviderConfiguration {
+ }
+}
diff --git
a/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/java/org/apache/dubbo/samples/api/GreetingService.java
b/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/java/org/apache/dubbo/samples/api/GreetingService.java
new file mode 100644
index 00000000..997ece7e
--- /dev/null
+++
b/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/java/org/apache/dubbo/samples/api/GreetingService.java
@@ -0,0 +1,26 @@
+/*
+ *
+ * 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.dubbo.samples.api;
+
+public interface GreetingService {
+
+ String sayHello(String name);
+
+}
diff --git
a/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/java/org/apache/dubbo/samples/impl/AnnotatedGreetingService.java
b/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/java/org/apache/dubbo/samples/impl/AnnotatedGreetingService.java
new file mode 100644
index 00000000..f47ded88
--- /dev/null
+++
b/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/java/org/apache/dubbo/samples/impl/AnnotatedGreetingService.java
@@ -0,0 +1,35 @@
+/*
+ *
+ * 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.dubbo.samples.impl;
+
+import org.apache.dubbo.common.utils.NetUtils;
+import org.apache.dubbo.config.annotation.DubboService;
+import org.apache.dubbo.samples.api.GreetingService;
+
+@DubboService(version = "1.0.0")
+public class AnnotatedGreetingService implements GreetingService {
+
+ @Override
+ public String sayHello(String name) {
+ System.out.println("greeting service received: " + name);
+ return "hello, " + name + "! from host: " + NetUtils.getLocalHost();
+ }
+
+}
diff --git
a/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/resources/k8s/Deployment.yml
b/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/resources/k8s/Deployment.yml
new file mode 100644
index 00000000..4aa005af
--- /dev/null
+++
b/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/resources/k8s/Deployment.yml
@@ -0,0 +1,36 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: dubbo-samples-xds-provider
+ namespace: dubbo-demo
+spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ app: dubbo-samples-xds-provider
+ template:
+ metadata:
+ labels:
+ app: dubbo-samples-xds-provider
+ spec:
+ containers:
+ - name: server
+ image: dubboteam/dubbo-samples-xds-provider:1.0.0
+ livenessProbe:
+ httpGet:
+ path: /live
+ port: 22222
+ initialDelaySeconds: 5
+ periodSeconds: 5
+ readinessProbe:
+ httpGet:
+ path: /ready
+ port: 22222
+ initialDelaySeconds: 5
+ periodSeconds: 5
+ startupProbe:
+ httpGet:
+ path: /startup
+ port: 22222
+ failureThreshold: 30
+ periodSeconds: 10
\ No newline at end of file
diff --git
a/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/resources/k8s/Service.yml
b/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/resources/k8s/Service.yml
new file mode 100644
index 00000000..8009868f
--- /dev/null
+++
b/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/resources/k8s/Service.yml
@@ -0,0 +1,14 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: dubbo-samples-xds-provider
+ namespace: dubbo-demo
+spec:
+ clusterIP: None
+ selector:
+ app: dubbo-samples-xds-provider
+ ports:
+ - name: grpc
+ protocol: TCP
+ port: 50051
+ targetPort: 50051
\ No newline at end of file
diff --git
a/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/resources/log4j.properties
b/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/resources/log4j.properties
new file mode 100644
index 00000000..9e04984b
--- /dev/null
+++
b/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/resources/log4j.properties
@@ -0,0 +1,23 @@
+#
+#
+# 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.
+#
+#
+log4j.rootLogger=info, stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}]
%t %5p %c{2}: %m%n
\ No newline at end of file
diff --git
a/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/resources/spring/dubbo-provider.properties
b/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/resources/spring/dubbo-provider.properties
new file mode 100644
index 00000000..1edcc825
--- /dev/null
+++
b/dubbo-samples-xds/dubbo-samples-xds-provider/src/main/resources/spring/dubbo-provider.properties
@@ -0,0 +1,25 @@
+#
+#
+# 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.
+#
+#
+dubbo.application.name=dubbo-samples-xds-provider
+dubbo.application.metadataServicePort=20885
+dubbo.registry.address=xds://istiod.istio-system.svc:15012
+dubbo.protocol.name=tri
+dubbo.protocol.port=50051
+dubbo.application.qosEnable=true
+dubbo.application.qosAcceptForeignIp=true
\ No newline at end of file
diff --git a/dubbo-samples-xds/pom.xml b/dubbo-samples-xds/pom.xml
new file mode 100644
index 00000000..bcafabf4
--- /dev/null
+++ b/dubbo-samples-xds/pom.xml
@@ -0,0 +1,51 @@
+<?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">
+ <groupId>org.apache.dubbo</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <modules>
+ <module>dubbo-samples-xds-provider</module>
+ <module>dubbo-samples-xds-consumer</module>
+ </modules>
+
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>pom</packaging>
+ <artifactId>dubbo-samples-xds</artifactId>
+
+ <repositories>
+ <repository>
+ <id>apache.snapshots.https</id>
+ <name>Apache Development Snapshot Repository</name>
+
<url>https://repository.apache.org/content/repositories/snapshots</url>
+ <layout>default</layout>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 8a020622..e6416487 100644
--- a/pom.xml
+++ b/pom.xml
@@ -91,6 +91,7 @@
<module>dubbo-samples-autowire</module>
<module>dubbo-samples-boundary-test</module>
<module>dubbo-samples-kubernetes</module>
+ <module>dubbo-samples-xds</module>
<module>dubbo-samples-spring-boot</module>
</modules>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]