This topic describes how to pre-process Swarm Compose files.
- Download a Swarm Compose file.
- Log on to the Container Service for Swarm console. In the left-side navigation pane, click Applications. On the Applications page, find the application that you want to manage and click Change Configuration in the Actions column.
- Copy the configurations and save them in a YAML file on an on-premises machine. In this topic, the file is named swarm-piggymetrics.yaml, which is the Swarm Compose file to be pre-processed.
- Replace environment variables in the Swarm compose file with actual values.The Container Service for Swarm console allows you to use a configuration file to replace variables in a Swarm Compose file with actual values. Kubernetes does not support this feature. Before you use Kompose to convert a Swarm Compose file, you must manually replace the dollar signs ($) in the Compose file with actual values. To replace variables in the Swarm Compose file, perform the following steps:
- Log on to the Container Service for Swarm console. In the left-side navigation pane, click Configurations. On the page that appears, select the region where the configuration file is deployed and find the configuration file.
- Replace the dollar signs ($) in the swarm-piggymetrics.yaml file with the actual values based on this configuration file.
- Pre-process labels.You must pre-process the labels in the Swarm Compose file. Otherwise, Kompose may report an error and stop the conversion as a result of invalid formats or unsupported labels. The following section describes two methods of label processing. For more information about each label, see Application configuration labels, Application release labels, Network configuration labels, and Log configuration parameters.
- Change the values of the following labels from BOOLEAN to STRING. For example, change
true or false to
- Kubernetes Services with labels that contain the following values cannot be migrated.
You must delete them and create new ones with the same configurations in the related
- Change the values of the following labels from BOOLEAN to STRING. For example, change true or false to
- Modify the version number of the Swarm Compose file.Kompose supports Swarm Compose files of version 2. You must change the version declaration from version: '2.X' to version: '2' in the Swarm Compose file. Otherwise, an error occurs during conversion.