Skip to content

Commit 0a596a1

Browse files
committed
Updated partitioning readme to contain content on Kubernetes
1 parent 30ac726 commit 0a596a1

File tree

1 file changed

+56
-0
lines changed
  • spring-cloud-task-samples/partitioned-batch-job

1 file changed

+56
-0
lines changed

spring-cloud-task-samples/partitioned-batch-job/README.adoc

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,59 @@ Currently partitions are launched sequentially. To launch them asynchronously
4040

4141
NOTE: We need to close the context since the use of ThreadPoolTaskExecutor leaves a thread active thus the app will not terminate.
4242
To close the application appropriately, we will need to set `spring.cloud.task.closecontextEnabled`` to true.
43+
44+
== Running Partitioned sample on Kubernetes
45+
The current sample is set up to run the partitioning using the `local` deployer, so to change this sample so that it work with the `kubernetes` deployer.
46+
47+
=== Changes to the application in order to partition on Kubernetes
48+
. Replace the `spring-cloud-deployer-local` dependency with `spring-cloud-deployer-kubernetes` in the pom.xml. For example:
49+
+
50+
[source,xml]
51+
----
52+
# Replace
53+
<dependency>
54+
<groupId>org.springframework.cloud</groupId>
55+
<artifactId>spring-cloud-deployer-local</artifactId>
56+
<version>${spring-cloud-deployer}</version>
57+
</dependency>
58+
# With
59+
<dependency>
60+
<groupId>org.springframework.cloud</groupId>
61+
<artifactId>spring-cloud-deployer-kubernetes</artifactId>
62+
<version>${spring-cloud-deployer}</version>
63+
</dependency>
64+
----
65+
66+
. Add the following dependency so that we can use docker as a resource:
67+
+
68+
[source,xml]
69+
----
70+
<dependency>
71+
<groupId>org.springframework.cloud</groupId>
72+
<artifactId>spring-cloud-deployer-resource-docker</artifactId>
73+
<version>${spring-cloud-deployer}</version>
74+
</dependency>
75+
----
76+
. Replace the resource that is used to retrieve the jar from maven with the docker resource to obtain the docker image as follows:
77+
+
78+
[source,java]
79+
----
80+
// Replace
81+
Resource resource = this.resourceLoader
82+
.getResource("maven://io.spring.cloud:partitioned-batch-job:3.0.0-SNAPSHOT");
83+
// With
84+
Resource resource = new DockerResource("partitioned-batch-job:3.0.0-SNAPSHOT");
85+
----
86+
. Build a docker image using the following command:
87+
+
88+
[source,bash]
89+
----
90+
./mvnw spring-boot:build-image
91+
----
92+
93+
=== Notes on when launching this application on Kubernetes
94+
95+
* Be sure to make sure the application has the proper permissions to launch another pod. For example in Spring Cloud Data Flow be sure to set the `deployment-service-account-name` ot `scdf-sa`.
96+
* When using Spring Cloud Data Flow be sure to set the `entry-point-style` to `boot`.
97+
98+

0 commit comments

Comments
 (0)