2. Plan


We start by planning the migration. During the plan phase, Move2Kube will analyze the files in the source directory, detect what services exist, create a plan on how to containerize them using Dockerfiles, and transform them into Kubernetes deployments, services, ingress, etc.

In order to do the planning, Move2Kube has a large number of built-in transformers for different languages and platforms. Each transformer walks through the source directory from top to bottom and tries to find files that it recognizes. For example, a Golang transformer will try to find a go.mod file to detect a Golang project. Once it detects a directory containing a service, it will try to extract as much information from it as possible. Some of the information it tries to find are the service name, ports, environment variables, etc.

This information is stored in YAML format in a plan file called m2k.plan which is used later during the transformation phase. We can edit this file to enable/disable transformers, add/remove detected services, etc.

Prerequisites

We will be using the enterprise-app app. Download it using the below command.

$ curl https://move2kube.konveyor.io/scripts/download.sh | bash -s -- -d samples/enterprise-app/src -r move2kube-demos
$ ls src
README.md		config-utils		customers	docs			frontend		gateway			orders

Planning using the CLI

  1. Run move2kube plan -s src to generate a plan for migrating the multiple components of the app to Kubernetes.
$ move2kube plan -s src
INFO[0000] Configuration loading done   
INFO[0000] Planning Transformation - Base Directory 
INFO[0000] [CloudFoundry] Planning transformation   
INFO[0000] Identified 3 named services and 0 to-be-named services
INFO[0000] [CloudFoundry] Done  
INFO[0000] [ComposeAnalyser] Planning transformation
INFO[0000] [ComposeAnalyser] Done   
INFO[0000] [DockerfileDetector] Planning transformation
INFO[0000] [DockerfileDetector] Done
INFO[0000] [Base Directory] Identified 3 named services and 0 to-be-named services
INFO[0000] Transformation planning - Base Directory done
INFO[0000] Planning Transformation - Directory Walk 
INFO[0000] Identified 1 named services and 0 to-be-named services in config-utils
INFO[0000] Identified 1 named services and 0 to-be-named services in customers
INFO[0000] Identified 1 named services and 0 to-be-named services in frontend
INFO[0000] Identified 1 named services and 0 to-be-named services in gateway
INFO[0000] Identified 1 named services and 0 to-be-named services in inventory
INFO[0000] Identified 1 named services and 0 to-be-named services in orders
INFO[0000] Transformation planning - Directory Walk done
INFO[0000] [Directory Walk] Identified 6 named services and 0 to-be-named services
INFO[0000] [Named Services] Identified 6 named services
INFO[0000] No of services identified : 6
INFO[0000] Plan can be found at [/Users/user/Desktop/tutorial/m2k.plan].
  1. Look at the plan file that was generated.
$ cat m2k.plan
apiVersion: move2kube.konveyor.io/v1alpha1
kind: Plan
......
apiVersion: move2kube.konveyor.io/v1alpha1
kind: Plan
metadata:
  name: myproject
spec:
  sourceDir: src
  services:
    config-utils:
Click to see the rest of the yaml.

The plan file contains all the transformers that Move2Kube detected and ran. These transformers will be run again during the transformation phase.

The plan file also contains all the services that Move2Kube was able to detect. The service name comes from the transformer that detected that service. We can edit this plan before we move on to the transformation phase. For now we will leave it as is.

Next step: Transform

Planning using the UI

  1. Open the UI:
$ docker run --rm -it -p 8080:8080 quay.io/konveyor/move2kube-ui:v0.3.1
INFO[0000] Starting Move2Kube API server at port: 8080
  1. Create a new workspace.
  2. Create a new project.
  3. Scroll down to the project inputs section and then upload the source directory and the collected information zip files.

Optional: If you have collected cloud foundry runtime metadata using the move2kube collect command you can create a zip file and upload that as well. Make sure to upload it as sources.

  1. Scroll down to the planning section and click Start Planning.

Note Planning takes a few minutes.

Now that we have generated a plan file we can move on to the Transform phase which generates the output we need to deploy our app to Kubernetes.