One of the desirable properties which users expect in a modern cloud-hosted application is portability. Users want to migrate portable applications between private and public clouds or between different cloud regions. With container images as portable application implementations and emerging sophisticated container runtimes, this should be an easy task. But when a containerised application starts to become more complex, a container platform or an orchestration tool needs to be deployed. This add specifics blueprints and together with the persistent data makes the migration of the application tough. This means that the application is not in a condition to be moved as easily between clouds or even between the orchestration tools or container platforms, losing the desirable portability property. With the idea in mind that the next generation of Cloud-Native Applications must be deployable to different cloud providers as the requirements change, we are proud to announce the first proof of concept release of os2os, a tool to migrate cloud-native applications between OpenShift installations. While our research on application migration is not limited to this single container platform, we see it as one of the more popular and technically interesting ones.
Description of the tool
As other successful tools in the containers ecosystem (Docker, Docker Swarm, Kubernetes, Kompose, …), os2os is implemented using the Go programming language, opening the path towards sharing features and libraries. The Go library Cobra is used to produce a user-friendly command line interface. Internally, os2os uses the openshift command-line tool, oc, which is supposed to be pre-installed, a reasonable assumption for any user wanting to migrate between OpenShift clusters.
Kompose is a tool which also contributes to solving the portability problem. In this case, Kompose translates Docker Compose files to Kubernetes resources. It is one of the most “starred or liked” repositories according to the Kubernetes Github page. Trying to be consistent with tools which are tackling comparable problems and making the use easy for e.g. existing Kompose users, os2os offers similar commands which can be learned in few minutes.
In this first version of os2os, users can access these three commands:
- os2os export: Download the templates of all the objects or resources of your project.
- os2os down: Delete a project in your old OpenShift project or cluster.
- os2os up: Deploy a project in your new OpenShift project or cluster.
In all the commands, users can configure flags such as project name, clusters or the objects to migrate.
In this example, we show how to migrate a simple application consisting of a single deployment and a single service between two OpenShift clusters using the three implemented commands. Our demonstration environment includes two local VM-hosted OpenShift clusters which were produced with the command oc up. The scenario service arkisdocument has been taken from a cloud-native reference application. The obligatory screenshot below shows the initial project screen within OpenShift.
Next, using the configuration file, export the current objects to your local computer into the current directory. You can filter objects. In the example shown in the next screenshot, only services and deployments are being migrated.
The last step depends on the migration semantics being a copy or move migration. In the case of a move, the previous instance shall be deleted. Hence, the last command deletes all objects from the source system. Executing all the commands in order (as shown in the screenshots), the commands export, up and down migrate this application statelessly between two clusters.
With this proof of concept prototype, we have released just a first version of the tool which can migrate only stateless applications without loss of functionality. Currently, we are working on more useful features such as migrating the associated data of the application or right-sizing the application to fit into the constraints of the target environment (we already implemented an example of this feature for Kubernetes applications) or the command convert which can help to change some features of the objects before deploying them into the target cluster.
This tool is designed to work together with others in a set of tools for migrating applications not only between the container platforms but also including orchestration tools such as Docker Swarm and Kubernetes. We are continuing our investigation in the context of seamless application onboarding to the APPUiO Swiss container platform which operates a production-grade OpenShift environment.