Relocating Spring Cloud Stream and Task Applications
This topic describes how to relocate select Spring Cloud Stream and Spring Cloud Task applications for use with Spring Cloud Data Flow for Kubernetes (SCDF for Kubernetes). This can be useful if the SCDF for Kubernetes server is deployed in an environment without internet access (an “air-gapped” environment).
The following sections demonstrate the relocation process using three stream applications: the
http source application, the
split processor application, and the
log sink application.
Image relocation for an air-gapped environment requires an Open Container Initiative (OCI) image layout.
The following example uses the
prel command line utility to create this layout.
You can find the latest
prel release from the vmware-tanzu/properties-file-image-relocation repository on GitHub.
Download the appropriate download for your operating system. Extract the archive file, rename the program file to
prel, and move it to a directory that is on your
Before creating an OCI image layout for the application images, you must select the applications and versions to relocate. In the following example, we use the latest available images for the selected applications (based on the content of the Stream Apps (RabbitMQ/Docker) property file.
We will relocate the following stream applications:
We prepare a new
rabbitmq-docker-example.properties file and add the application type, name, image name and tag for each selected application:
source.http=docker:springcloudstream/http-source-rabbit:2.1.5.RELEASE processor.splitter=docker:springcloudstream/splitter-processor-rabbit:2.1.4.RELEASE sink.log=docker:springcloudstream/log-sink-rabbit:2.1.5.RELEASE
Next, we package the properties file plus the referenced images in a
prel package --file rabbitmq-docker-example.properties \ --archive rabbitmq-docker-example.tgz
This creates an archive file containing the OCI image layout that can be moved to an air-gapped environment.
We are now ready to push the images to a new registry.
First, define an environment variable for the registry prefix (substitute with the prefix to use for your target registry ):
Next, relocate the images in the archive containing the OCI image layout.
This will genetate a new
rabbitmq-docker-example-relocated.properties file that can be used to import these applications using the relocated images.
prel relocate --repository-prefix $TARGET_REPOSITORY_PREFIX \ --archive rabbitmq-docker-example.tgz \ --output rabbitmq-docker-example-relocated.properties
Finally, you can register the applications with SCDF for Kubernetes, using the the Spring Cloud Data Flow shell. For information about connecting to the SCDF for Kubernetes server using the shell, see Connecting to Spring Cloud Data Flow for Kubernetes.
dataflow:>app import --uri file:rabbitmq-docker-example-relocated.properties
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
For more information, see the Registering a Task Application section of the Spring Cloud Data Flow Reference Guide.