Here you will learn how to relocate select Spring Cloud Stream and Spring Cloud Task applications in Spring Cloud Data Flow for Kubernetes.
Three stream applications are used as examples for this article: the http
source app, the split
processor app and the log
sink app.
Review the following configuration sections: configuring the Container Registry, and configuring ImagePullSecrets for Apps
For this topic we will be using a CLI utility called imgpkg
that is available from the Carvel imgpkg project.
Install the latest imgpkg
CLI utility release following instructions at imgpkg install page. Select the instructions that match your operating system.
Before we relocate the OCI images for the three selected app images we need to select the versions we should relocate. We will use the latest available images for the selected apps based on the content of the Stream Apps (RabbitMQ/Docker) property file.
The images we will relocate are:
source.http=docker:springcloudstream/http-source-rabbit:3.1.1
processor.splitter=docker:springcloudstream/splitter-processor-rabbit:3.1.1
sink.log=docker:springcloudstream/log-sink-rabbit:3.1.1
First, define an environment variable for the registry prefix (substitute with the prefix to use for your target registry):
export TARGET_REGISTRY_PREFIX=registry.example.com/my-project/apps
Next, we use imgpkg copy
to relocate each image.
For http
source run:
imgpkg copy -i springcloudstream/http-source-rabbit:3.1.1 --to-repo ${TARGET_REGISTRY_PREFIX}/http-source-rabbit
For the splitter
processor run:
imgpkg copy -i springcloudstream/splitter-processor-rabbit:3.1.1 --to-repo ${TARGET_REGISTRY_PREFIX}/splitter-processor-rabbit
For log
sink run:
imgpkg copy -i springcloudstream/log-sink-rabbit:3.1.1 --to-repo ${TARGET_REGISTRY_PREFIX}/log-sink-rabbit
We can now register the apps using the the Spring Cloud Data Flow Shell.
Replace the registry.example.com/my-project/apps
prefix with the one you used for the relocation.
For http
source run:
dataflow:>app register --name http --type source --uri docker:registry.example.com/my-project/apps/http-source-rabbit:3.1.1
For the splitter
processor run:
dataflow:>app register --name splitter --type processor --uri docker:registry.example.com/my-project/apps/splitter-processor-rabbit:3.1.1
For log
sink run:
dataflow:>app register --name log --type sink --uri docker:registry.example.com/my-project/apps/log-sink-rabbit:3.1.1
For more details, see the Register a Stream Application section of the Spring Cloud Data Flow Reference Guide.
To relocate Spring Cloud Task applications and use them with SCDF for Kubernetes, you can perform the steps described in the previous sections, but registering the applications with the type task
. For more information, see the Registering a Task Application section of the Spring Cloud Data Flow Reference Guide.