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 VMware 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.
Important: You must configure SCDF for Kubernetes with credentials for accessing the registry that will store the relocated images. See Container Registry and Application ImagePullSecrets.
Install Properties File Image Relocation CLI utility
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 PATH
.
Create an Archive File containing the OCI Image Layout for Selected Applications
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:
http
sourcesplitter
processorlog
sink
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:3.0.0
processor.splitter=docker:springcloudstream/splitter-processor-rabbit:3.0.0
sink.log=docker:springcloudstream/log-sink-rabbit:3.0.0
Next, we package the properties file plus the referenced images in a .tgz
archive.
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.
Push Selected Applications to a Registry
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 ):
export TARGET_REPOSITORY_PREFIX=registry.example.com/my-project/apps
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
Register the Relocated Applications
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 VMware Spring Cloud® Data Flow for Kubernetes.
dataflow:>app import --uri file:rabbitmq-docker-example-relocated.properties
For more details, see the Register a Stream Application section of the Spring Cloud Data Flow Reference Guide.
Relocate Task Applications
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.