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 81d4c1b3 Add k8s deploy script for rpc task (#642)
81d4c1b3 is described below

commit 81d4c1b3e9e42e79d8758e468ff0bb8200b347be
Author: Albumen Kevin <[email protected]>
AuthorDate: Mon Dec 19 14:32:58 2022 +0800

    Add k8s deploy script for rpc task (#642)
    
    * Add k8s deploy script for rpc basic task
    
    * Add k8s deploy script for rpc advanced task
---
 10-task/dubbo-samples-rpc-advanced/deploy/All.yml  | 232 +++++++++++++++++++++
 .../deploy/Namespace.yml                           |  25 +++
 .../deploy/a/Deployment.yml                        |  41 ++++
 .../deploy/b-v1/Deployment.yml                     |  41 ++++
 .../deploy/b-v2/Deployment.yml                     |  41 ++++
 .../deploy/c/Deployment.yml                        |  41 ++++
 .../deploy/d/Deployment.yml                        |  41 ++++
 .../deploy/nacos/Deployment.yml                    |  54 +++++
 .../deploy/nacos/Service.yml                       |  32 +++
 .../dubbo-samples-rpc-advanced-app-a/pom.xml       |  19 ++
 .../apache/dubbo/samples/a/BenchmarkClient.java    |  19 +-
 .../dubbo-samples-rpc-advanced-app-b-v1/pom.xml    |  19 ++
 .../dubbo-samples-rpc-advanced-app-b-v2/pom.xml    |  19 ++
 .../dubbo-samples-rpc-advanced-app-c/pom.xml       |  19 ++
 .../dubbo-samples-rpc-advanced-app-d/pom.xml       |  19 ++
 10-task/dubbo-samples-rpc-basic/deploy/All.yml     | 137 ++++++++++++
 .../dubbo-samples-rpc-basic/deploy/Namespace.yml   |  25 +++
 .../deploy/consumer/Deployment.yml                 |  38 ++++
 .../deploy/nacos/Deployment.yml                    |  54 +++++
 .../deploy/provider/Deployment.yml                 |  38 ++++
 .../dubbo-samples-rpc-basic-consumer/pom.xml       |  19 ++
 .../dubbo-samples-rpc-basic-provider/pom.xml       |  19 ++
 22 files changed, 985 insertions(+), 7 deletions(-)

diff --git a/10-task/dubbo-samples-rpc-advanced/deploy/All.yml 
b/10-task/dubbo-samples-rpc-advanced/deploy/All.yml
new file mode 100644
index 00000000..4cf12996
--- /dev/null
+++ b/10-task/dubbo-samples-rpc-advanced/deploy/All.yml
@@ -0,0 +1,232 @@
+# 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.
+
+# Namespace
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: dubbo-demo
+---
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: dubbo-system
+---
+
+# Nacos
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: nacos
+  namespace: dubbo-system
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: nacos
+  template:
+    metadata:
+      labels:
+        app: nacos
+    spec:
+      containers:
+        - name: consumer
+          image: nacos/nacos-server:v2.1.2
+          imagePullPolicy: Always
+          resources:
+            requests:
+              memory: "2Gi"
+              cpu: "500m"
+          ports:
+            - containerPort: 8848
+              name: client
+            - containerPort: 9848
+              name: client-rpc
+          env:
+            - name: NACOS_SERVER_PORT
+              value: "8848"
+            - name: NACOS_APPLICATION_PORT
+              value: "8848"
+            - name: PREFER_HOST_MODE
+              value: "hostname"
+            - name: MODE
+              value: "standalone"
+            - name: NACOS_AUTH_ENABLE
+              value: "true"
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: nacos
+  namespace: dubbo-system
+spec:
+  type: ClusterIP
+  sessionAffinity: None
+  selector:
+    app: nacos
+  ports:
+    - port: 8848
+      name: server
+      targetPort: 8848
+    - port: 9848
+      name: client-rpc
+      targetPort: 9848
+---
+
+# App A
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: a
+  namespace: dubbo-demo
+spec:
+  replicas: 2
+  selector:
+    matchLabels:
+      app: a
+  template:
+    metadata:
+      labels:
+        app: a
+    spec:
+      containers:
+        - name: a
+          image: apache/dubbo-demo:dubbo-samples-rpc-advanced_app_a_0.0.1
+          imagePullPolicy: Always
+          ports:
+            - name: dubbo
+              containerPort: 20881
+              protocol: TCP
+            - name: dubbo-qos
+              containerPort: 20991
+              protocol: TCP
+---
+
+# App B V1
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: b-v1
+  namespace: dubbo-demo
+spec:
+  replicas: 2
+  selector:
+    matchLabels:
+      app: b-v1
+  template:
+    metadata:
+      labels:
+        app: b-v1
+    spec:
+      containers:
+        - name: b-v1
+          image: apache/dubbo-demo:dubbo-samples-rpc-advanced_app_b_v1_0.0.1
+          imagePullPolicy: Always
+          ports:
+            - name: dubbo
+              containerPort: 20882
+              protocol: TCP
+            - name: dubbo-qos
+              containerPort: 20992
+              protocol: TCP
+---
+
+# App B V2
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: b-v2
+  namespace: dubbo-demo
+spec:
+  replicas: 3
+  selector:
+    matchLabels:
+      app: b-v2
+  template:
+    metadata:
+      labels:
+        app: b-v2
+    spec:
+      containers:
+        - name: b-v2
+          image: apache/dubbo-demo:dubbo-samples-rpc-advanced_app_b_v2_0.0.1
+          imagePullPolicy: Always
+          ports:
+            - name: dubbo
+              containerPort: 20883
+              protocol: TCP
+            - name: dubbo-qos
+              containerPort: 20993
+              protocol: TCP
+
+---
+
+# App C
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: c
+  namespace: dubbo-demo
+spec:
+  replicas: 3
+  selector:
+    matchLabels:
+      app: c
+  template:
+    metadata:
+      labels:
+        app: c
+    spec:
+      containers:
+        - name: c
+          image: apache/dubbo-demo:dubbo-samples-rpc-advanced_app_c_0.0.1
+          imagePullPolicy: Always
+          ports:
+            - name: dubbo
+              containerPort: 20884
+              protocol: TCP
+            - name: dubbo-qos
+              containerPort: 20994
+              protocol: TCP
+---
+
+# App D
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: d
+  namespace: dubbo-demo
+spec:
+  replicas: 3
+  selector:
+    matchLabels:
+      app: d
+  template:
+    metadata:
+      labels:
+        app: d
+    spec:
+      containers:
+        - name: d
+          image: apache/dubbo-demo:dubbo-samples-rpc-advanced_app_d_0.0.1
+          imagePullPolicy: Always
+          ports:
+            - name: dubbo
+              containerPort: 20885
+              protocol: TCP
+            - name: dubbo-qos
+              containerPort: 20995
+              protocol: TCP
+---
\ No newline at end of file
diff --git a/10-task/dubbo-samples-rpc-advanced/deploy/Namespace.yml 
b/10-task/dubbo-samples-rpc-advanced/deploy/Namespace.yml
new file mode 100644
index 00000000..20d311f1
--- /dev/null
+++ b/10-task/dubbo-samples-rpc-advanced/deploy/Namespace.yml
@@ -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.
+
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: dubbo-demo
+---
+
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: dubbo-system
\ No newline at end of file
diff --git a/10-task/dubbo-samples-rpc-advanced/deploy/a/Deployment.yml 
b/10-task/dubbo-samples-rpc-advanced/deploy/a/Deployment.yml
new file mode 100644
index 00000000..f3cced58
--- /dev/null
+++ b/10-task/dubbo-samples-rpc-advanced/deploy/a/Deployment.yml
@@ -0,0 +1,41 @@
+# 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: apps/v1
+kind: Deployment
+metadata:
+  name: a
+  namespace: dubbo-demo
+spec:
+  replicas: 2
+  selector:
+    matchLabels:
+      app: a
+  template:
+    metadata:
+      labels:
+        app: a
+    spec:
+      containers:
+        - name: a
+          image: apache/dubbo-demo:dubbo-samples-rpc-advanced_app_a_0.0.1
+          imagePullPolicy: Always
+          ports:
+            - name: dubbo
+              containerPort: 20881
+              protocol: TCP
+            - name: dubbo-qos
+              containerPort: 20991
+              protocol: TCP
\ No newline at end of file
diff --git a/10-task/dubbo-samples-rpc-advanced/deploy/b-v1/Deployment.yml 
b/10-task/dubbo-samples-rpc-advanced/deploy/b-v1/Deployment.yml
new file mode 100644
index 00000000..ced8c131
--- /dev/null
+++ b/10-task/dubbo-samples-rpc-advanced/deploy/b-v1/Deployment.yml
@@ -0,0 +1,41 @@
+# 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: apps/v1
+kind: Deployment
+metadata:
+  name: b-v1
+  namespace: dubbo-demo
+spec:
+  replicas: 2
+  selector:
+    matchLabels:
+      app: b-v1
+  template:
+    metadata:
+      labels:
+        app: b-v1
+    spec:
+      containers:
+        - name: b-v1
+          image: apache/dubbo-demo:dubbo-samples-rpc-advanced_app_b_v1_0.0.1
+          imagePullPolicy: Always
+          ports:
+            - name: dubbo
+              containerPort: 20882
+              protocol: TCP
+            - name: dubbo-qos
+              containerPort: 20992
+              protocol: TCP
\ No newline at end of file
diff --git a/10-task/dubbo-samples-rpc-advanced/deploy/b-v2/Deployment.yml 
b/10-task/dubbo-samples-rpc-advanced/deploy/b-v2/Deployment.yml
new file mode 100644
index 00000000..1c23eeb7
--- /dev/null
+++ b/10-task/dubbo-samples-rpc-advanced/deploy/b-v2/Deployment.yml
@@ -0,0 +1,41 @@
+# 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: apps/v1
+kind: Deployment
+metadata:
+  name: b-v2
+  namespace: dubbo-demo
+spec:
+  replicas: 3
+  selector:
+    matchLabels:
+      app: b-v2
+  template:
+    metadata:
+      labels:
+        app: b-v2
+    spec:
+      containers:
+        - name: b-v2
+          image: apache/dubbo-demo:dubbo-samples-rpc-advanced_app_b_v2_0.0.1
+          imagePullPolicy: Always
+          ports:
+            - name: dubbo
+              containerPort: 20883
+              protocol: TCP
+            - name: dubbo-qos
+              containerPort: 20993
+              protocol: TCP
\ No newline at end of file
diff --git a/10-task/dubbo-samples-rpc-advanced/deploy/c/Deployment.yml 
b/10-task/dubbo-samples-rpc-advanced/deploy/c/Deployment.yml
new file mode 100644
index 00000000..25999cdf
--- /dev/null
+++ b/10-task/dubbo-samples-rpc-advanced/deploy/c/Deployment.yml
@@ -0,0 +1,41 @@
+# 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: apps/v1
+kind: Deployment
+metadata:
+  name: c
+  namespace: dubbo-demo
+spec:
+  replicas: 3
+  selector:
+    matchLabels:
+      app: c
+  template:
+    metadata:
+      labels:
+        app: c
+    spec:
+      containers:
+        - name: c
+          image: apache/dubbo-demo:dubbo-samples-rpc-advanced_app_c_0.0.1
+          imagePullPolicy: Always
+          ports:
+            - name: dubbo
+              containerPort: 20884
+              protocol: TCP
+            - name: dubbo-qos
+              containerPort: 20994
+              protocol: TCP
\ No newline at end of file
diff --git a/10-task/dubbo-samples-rpc-advanced/deploy/d/Deployment.yml 
b/10-task/dubbo-samples-rpc-advanced/deploy/d/Deployment.yml
new file mode 100644
index 00000000..49b01386
--- /dev/null
+++ b/10-task/dubbo-samples-rpc-advanced/deploy/d/Deployment.yml
@@ -0,0 +1,41 @@
+# 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: apps/v1
+kind: Deployment
+metadata:
+  name: d
+  namespace: dubbo-demo
+spec:
+  replicas: 3
+  selector:
+    matchLabels:
+      app: d
+  template:
+    metadata:
+      labels:
+        app: d
+    spec:
+      containers:
+        - name: d
+          image: apache/dubbo-demo:dubbo-samples-rpc-advanced_app_d_0.0.1
+          imagePullPolicy: Always
+          ports:
+            - name: dubbo
+              containerPort: 20885
+              protocol: TCP
+            - name: dubbo-qos
+              containerPort: 20995
+              protocol: TCP
\ No newline at end of file
diff --git a/10-task/dubbo-samples-rpc-advanced/deploy/nacos/Deployment.yml 
b/10-task/dubbo-samples-rpc-advanced/deploy/nacos/Deployment.yml
new file mode 100644
index 00000000..16037ec1
--- /dev/null
+++ b/10-task/dubbo-samples-rpc-advanced/deploy/nacos/Deployment.yml
@@ -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.
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: nacos
+  namespace: dubbo-system
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: nacos
+  template:
+    metadata:
+      labels:
+        app: nacos
+    spec:
+      containers:
+        - name: consumer
+          image: nacos/nacos-server:v2.1.2
+          imagePullPolicy: Always
+          resources:
+            requests:
+              memory: "2Gi"
+              cpu: "500m"
+          ports:
+            - containerPort: 8848
+              name: client
+            - containerPort: 9848
+              name: client-rpc
+          env:
+            - name: NACOS_SERVER_PORT
+              value: "8848"
+            - name: NACOS_APPLICATION_PORT
+              value: "8848"
+            - name: PREFER_HOST_MODE
+              value: "hostname"
+            - name: MODE
+              value: "standalone"
+            - name: NACOS_AUTH_ENABLE
+              value: "true"
\ No newline at end of file
diff --git a/10-task/dubbo-samples-rpc-advanced/deploy/nacos/Service.yml 
b/10-task/dubbo-samples-rpc-advanced/deploy/nacos/Service.yml
new file mode 100644
index 00000000..94498143
--- /dev/null
+++ b/10-task/dubbo-samples-rpc-advanced/deploy/nacos/Service.yml
@@ -0,0 +1,32 @@
+# 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: Service
+metadata:
+  name: nacos
+  namespace: dubbo-system
+spec:
+  type: ClusterIP
+  sessionAffinity: None
+  selector:
+    app: nacos
+  ports:
+    - port: 8848
+      name: server
+      targetPort: 8848
+    - port: 9848
+      name: client-rpc
+      targetPort: 9848
\ No newline at end of file
diff --git 
a/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-a/pom.xml 
b/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-a/pom.xml
index 87b82e26..61ed06e9 100644
--- 
a/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-a/pom.xml
+++ 
b/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-a/pom.xml
@@ -92,6 +92,25 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugin>
+            <plugin>
+                <groupId>com.google.cloud.tools</groupId>
+                <artifactId>jib-maven-plugin</artifactId>
+                <version>3.2.1</version>
+                <configuration>
+                    <to>
+                        
<image>apache/dubbo-demo:dubbo-samples-rpc-advanced_app_a_0.0.1</image>
+                    </to>
+                    <container>
+                        <jvmFlags>
+                            
<jvmFlag>-Dnacos.address=nacos.dubbo-system.svc</jvmFlag>
+                        </jvmFlags>
+                        <ports>
+                            <port>20881</port>
+                            <port>20991</port>
+                        </ports>
+                    </container>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
diff --git 
a/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-a/src/main/java/org/apache/dubbo/samples/a/BenchmarkClient.java
 
b/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-a/src/main/java/org/apache/dubbo/samples/a/BenchmarkClient.java
index 0d400d14..931cd1aa 100644
--- 
a/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-a/src/main/java/org/apache/dubbo/samples/a/BenchmarkClient.java
+++ 
b/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-a/src/main/java/org/apache/dubbo/samples/a/BenchmarkClient.java
@@ -27,6 +27,7 @@ import org.springframework.stereotype.Component;
 import java.util.Arrays;
 import java.util.List;
 import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
 
@@ -39,12 +40,16 @@ public class BenchmarkClient implements CommandLineRunner {
 
     @Override
     public void run(String... args) {
-        Executors.newScheduledThreadPool(1)
-                .scheduleAtFixedRate(()->{
-                    List<String> names = Arrays.asList("John", "Mike", 
"Kevin", "Grace", "Mark");
-                    String name = 
names.get(ThreadLocalRandom.current().nextInt(names.size()));
-                    String result = serviceA.sayHello(name);
-                    logger.info(result);
-                }, 0, 1, TimeUnit.SECONDS);
+        Runnable task = () -> {
+            long startTime = System.currentTimeMillis();
+            List<String> names = Arrays.asList("John", "Mike", "Kevin", 
"Grace", "Mark");
+            String name = 
names.get(ThreadLocalRandom.current().nextInt(names.size()));
+            String result = serviceA.sayHello(name) + "Usage Time: " + 
(System.currentTimeMillis() - startTime) + "ms";
+            logger.info(result);
+        };
+        ScheduledExecutorService executorService = 
Executors.newScheduledThreadPool(50);
+        for (int i = 0; i < 50; i++) {
+            executorService.scheduleAtFixedRate(task, 
ThreadLocalRandom.current().nextInt(1000), 1000, TimeUnit.MILLISECONDS);
+        }
     }
 }
diff --git 
a/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-b-v1/pom.xml
 
b/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-b-v1/pom.xml
index 3c654fb2..ceabe8c8 100644
--- 
a/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-b-v1/pom.xml
+++ 
b/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-b-v1/pom.xml
@@ -87,6 +87,25 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugin>
+            <plugin>
+                <groupId>com.google.cloud.tools</groupId>
+                <artifactId>jib-maven-plugin</artifactId>
+                <version>3.2.1</version>
+                <configuration>
+                    <to>
+                        
<image>apache/dubbo-demo:dubbo-samples-rpc-advanced_app_b_v1_0.0.1</image>
+                    </to>
+                    <container>
+                        <jvmFlags>
+                            
<jvmFlag>-Dnacos.address=nacos.dubbo-system.svc</jvmFlag>
+                        </jvmFlags>
+                        <ports>
+                            <port>20882</port>
+                            <port>20992</port>
+                        </ports>
+                    </container>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
diff --git 
a/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-b-v2/pom.xml
 
b/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-b-v2/pom.xml
index 2512b54a..d53aa869 100644
--- 
a/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-b-v2/pom.xml
+++ 
b/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-b-v2/pom.xml
@@ -87,6 +87,25 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugin>
+            <plugin>
+                <groupId>com.google.cloud.tools</groupId>
+                <artifactId>jib-maven-plugin</artifactId>
+                <version>3.2.1</version>
+                <configuration>
+                    <to>
+                        
<image>apache/dubbo-demo:dubbo-samples-rpc-advanced_app_b_v2_0.0.1</image>
+                    </to>
+                    <container>
+                        <jvmFlags>
+                            
<jvmFlag>-Dnacos.address=nacos.dubbo-system.svc</jvmFlag>
+                        </jvmFlags>
+                        <ports>
+                            <port>20883</port>
+                            <port>20993</port>
+                        </ports>
+                    </container>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
diff --git 
a/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-c/pom.xml 
b/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-c/pom.xml
index 193f7273..842fe77f 100644
--- 
a/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-c/pom.xml
+++ 
b/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-c/pom.xml
@@ -82,6 +82,25 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugin>
+            <plugin>
+                <groupId>com.google.cloud.tools</groupId>
+                <artifactId>jib-maven-plugin</artifactId>
+                <version>3.2.1</version>
+                <configuration>
+                    <to>
+                        
<image>apache/dubbo-demo:dubbo-samples-rpc-advanced_app_c_0.0.1</image>
+                    </to>
+                    <container>
+                        <jvmFlags>
+                            
<jvmFlag>-Dnacos.address=nacos.dubbo-system.svc</jvmFlag>
+                        </jvmFlags>
+                        <ports>
+                            <port>20884</port>
+                            <port>20994</port>
+                        </ports>
+                    </container>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
diff --git 
a/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-d/pom.xml 
b/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-d/pom.xml
index 22a62ba3..5f53e44e 100644
--- 
a/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-d/pom.xml
+++ 
b/10-task/dubbo-samples-rpc-advanced/dubbo-samples-rpc-advanced-app-d/pom.xml
@@ -82,6 +82,25 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugin>
+            <plugin>
+                <groupId>com.google.cloud.tools</groupId>
+                <artifactId>jib-maven-plugin</artifactId>
+                <version>3.2.1</version>
+                <configuration>
+                    <to>
+                        
<image>apache/dubbo-demo:dubbo-samples-rpc-advanced_app_d_0.0.1</image>
+                    </to>
+                    <container>
+                        <jvmFlags>
+                            
<jvmFlag>-Dnacos.address=nacos.dubbo-system.svc</jvmFlag>
+                        </jvmFlags>
+                        <ports>
+                            <port>20885</port>
+                            <port>20995</port>
+                        </ports>
+                    </container>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
diff --git a/10-task/dubbo-samples-rpc-basic/deploy/All.yml 
b/10-task/dubbo-samples-rpc-basic/deploy/All.yml
new file mode 100644
index 00000000..aefa6aec
--- /dev/null
+++ b/10-task/dubbo-samples-rpc-basic/deploy/All.yml
@@ -0,0 +1,137 @@
+# 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.
+
+# Namespace
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: dubbo-demo
+---
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: dubbo-system
+---
+
+# Nacos
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: nacos
+  namespace: dubbo-system
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: nacos
+  template:
+    metadata:
+      labels:
+        app: nacos
+    spec:
+      containers:
+        - name: consumer
+          image: nacos/nacos-server:v2.1.2
+          imagePullPolicy: Always
+          resources:
+            requests:
+              memory: "2Gi"
+              cpu: "500m"
+          ports:
+            - containerPort: 8848
+              name: client
+            - containerPort: 9848
+              name: client-rpc
+          env:
+            - name: NACOS_SERVER_PORT
+              value: "8848"
+            - name: NACOS_APPLICATION_PORT
+              value: "8848"
+            - name: PREFER_HOST_MODE
+              value: "hostname"
+            - name: MODE
+              value: "standalone"
+            - name: NACOS_AUTH_ENABLE
+              value: "true"
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: nacos
+  namespace: dubbo-system
+spec:
+  type: ClusterIP
+  sessionAffinity: None
+  selector:
+    app: nacos
+  ports:
+    - port: 8848
+      name: server
+      targetPort: 8848
+    - port: 9848
+      name: client-rpc
+      targetPort: 9848
+---
+
+# Provider
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: dubbo-samples-rpc-basic-provider
+  namespace: dubbo-demo
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: dubbo-samples-rpc-basic-provider
+  template:
+    metadata:
+      labels:
+        app: dubbo-samples-rpc-basic-provider
+    spec:
+      containers:
+        - name: consumer
+          image: apache/dubbo-demo:dubbo-samples-rpc-basic-provider_0.0.1
+          imagePullPolicy: Always
+          ports:
+            - name: dubbo
+              containerPort: 20880
+              protocol: TCP
+---
+
+# Consumer
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: dubbo-samples-rpc-basic-consumer
+  namespace: dubbo-demo
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: dubbo-samples-rpc-basic-consumer
+  template:
+    metadata:
+      labels:
+        app: dubbo-samples-rpc-basic-consumer
+    spec:
+      containers:
+        - name: consumer
+          image: apache/dubbo-demo:dubbo-samples-rpc-basic-consumer_0.0.1
+          imagePullPolicy: Always
+          ports:
+            - name: dubbo
+              containerPort: 20880
+              protocol: TCP
\ No newline at end of file
diff --git a/10-task/dubbo-samples-rpc-basic/deploy/Namespace.yml 
b/10-task/dubbo-samples-rpc-basic/deploy/Namespace.yml
new file mode 100644
index 00000000..20d311f1
--- /dev/null
+++ b/10-task/dubbo-samples-rpc-basic/deploy/Namespace.yml
@@ -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.
+
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: dubbo-demo
+---
+
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: dubbo-system
\ No newline at end of file
diff --git a/10-task/dubbo-samples-rpc-basic/deploy/consumer/Deployment.yml 
b/10-task/dubbo-samples-rpc-basic/deploy/consumer/Deployment.yml
new file mode 100644
index 00000000..599138d3
--- /dev/null
+++ b/10-task/dubbo-samples-rpc-basic/deploy/consumer/Deployment.yml
@@ -0,0 +1,38 @@
+# 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: apps/v1
+kind: Deployment
+metadata:
+  name: dubbo-samples-rpc-basic-consumer
+  namespace: dubbo-demo
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: dubbo-samples-rpc-basic-consumer
+  template:
+    metadata:
+      labels:
+        app: dubbo-samples-rpc-basic-consumer
+    spec:
+      containers:
+        - name: consumer
+          image: apache/dubbo-demo:dubbo-samples-rpc-basic-consumer_0.0.1
+          imagePullPolicy: Always
+          ports:
+            - name: dubbo
+              containerPort: 20880
+              protocol: TCP
\ No newline at end of file
diff --git a/10-task/dubbo-samples-rpc-basic/deploy/nacos/Deployment.yml 
b/10-task/dubbo-samples-rpc-basic/deploy/nacos/Deployment.yml
new file mode 100644
index 00000000..16037ec1
--- /dev/null
+++ b/10-task/dubbo-samples-rpc-basic/deploy/nacos/Deployment.yml
@@ -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.
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: nacos
+  namespace: dubbo-system
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: nacos
+  template:
+    metadata:
+      labels:
+        app: nacos
+    spec:
+      containers:
+        - name: consumer
+          image: nacos/nacos-server:v2.1.2
+          imagePullPolicy: Always
+          resources:
+            requests:
+              memory: "2Gi"
+              cpu: "500m"
+          ports:
+            - containerPort: 8848
+              name: client
+            - containerPort: 9848
+              name: client-rpc
+          env:
+            - name: NACOS_SERVER_PORT
+              value: "8848"
+            - name: NACOS_APPLICATION_PORT
+              value: "8848"
+            - name: PREFER_HOST_MODE
+              value: "hostname"
+            - name: MODE
+              value: "standalone"
+            - name: NACOS_AUTH_ENABLE
+              value: "true"
\ No newline at end of file
diff --git a/10-task/dubbo-samples-rpc-basic/deploy/provider/Deployment.yml 
b/10-task/dubbo-samples-rpc-basic/deploy/provider/Deployment.yml
new file mode 100644
index 00000000..e1cbc28a
--- /dev/null
+++ b/10-task/dubbo-samples-rpc-basic/deploy/provider/Deployment.yml
@@ -0,0 +1,38 @@
+# 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: apps/v1
+kind: Deployment
+metadata:
+  name: dubbo-samples-rpc-basic-provider
+  namespace: dubbo-demo
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: dubbo-samples-rpc-basic-provider
+  template:
+    metadata:
+      labels:
+        app: dubbo-samples-rpc-basic-provider
+    spec:
+      containers:
+        - name: consumer
+          image: apache/dubbo-demo:dubbo-samples-rpc-basic-provider_0.0.1
+          imagePullPolicy: Always
+          ports:
+            - name: dubbo
+              containerPort: 20880
+              protocol: TCP
\ No newline at end of file
diff --git 
a/10-task/dubbo-samples-rpc-basic/dubbo-samples-rpc-basic-consumer/pom.xml 
b/10-task/dubbo-samples-rpc-basic/dubbo-samples-rpc-basic-consumer/pom.xml
index fd597cba..1ede786b 100644
--- a/10-task/dubbo-samples-rpc-basic/dubbo-samples-rpc-basic-consumer/pom.xml
+++ b/10-task/dubbo-samples-rpc-basic/dubbo-samples-rpc-basic-consumer/pom.xml
@@ -83,6 +83,25 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugin>
+            <plugin>
+                <groupId>com.google.cloud.tools</groupId>
+                <artifactId>jib-maven-plugin</artifactId>
+                <version>3.2.1</version>
+                <configuration>
+                    <to>
+                        
<image>apache/dubbo-demo:dubbo-samples-rpc-basic-consumer_0.0.1</image>
+                    </to>
+                    <container>
+                        <jvmFlags>
+                            
<jvmFlag>-Dnacos.address=nacos.dubbo-system.svc</jvmFlag>
+                        </jvmFlags>
+                        <ports>
+                            <port>20880</port>
+                            <port>22222</port>
+                        </ports>
+                    </container>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
diff --git 
a/10-task/dubbo-samples-rpc-basic/dubbo-samples-rpc-basic-provider/pom.xml 
b/10-task/dubbo-samples-rpc-basic/dubbo-samples-rpc-basic-provider/pom.xml
index 289cd218..55916144 100644
--- a/10-task/dubbo-samples-rpc-basic/dubbo-samples-rpc-basic-provider/pom.xml
+++ b/10-task/dubbo-samples-rpc-basic/dubbo-samples-rpc-basic-provider/pom.xml
@@ -82,6 +82,25 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugin>
+            <plugin>
+                <groupId>com.google.cloud.tools</groupId>
+                <artifactId>jib-maven-plugin</artifactId>
+                <version>3.2.1</version>
+                <configuration>
+                    <to>
+                        
<image>apache/dubbo-demo:dubbo-samples-rpc-basic-provider_0.0.1</image>
+                    </to>
+                    <container>
+                        <jvmFlags>
+                            
<jvmFlag>-Dnacos.address=nacos.dubbo-system.svc</jvmFlag>
+                        </jvmFlags>
+                        <ports>
+                            <port>20880</port>
+                            <port>22222</port>
+                        </ports>
+                    </container>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to