Migrating from S2I (Source-to-Image) components to Devfile components
Devfiles are new way of deploying component with odo.
Existing users using S2I based components can migrate to a devfile component by following the below steps:
-
Change to the component directory you want to migrate:
$ cd <directory-name>
-
List the component status
$ odo list S2I Components: APP NAME PROJECT TYPE SOURCETYPE STATE app myapp myproject nodejs local Pushed
-
Convert the S2I component to a devfile component by running the following command:
$ odo utils convert-to-devfile devfile.yaml is available in the current directory.
-
Push the newly generated devfile component:
$ odo push Validation ✓ Validating the devfile [40136ns] Creating Kubernetes resources for component myapp ✓ Waiting for component to start [12s] Applying URL changes ✓ URL myapp-8080: http://myapp-8080-example.com/ created Syncing to component myapp ✓ Checking files for pushing [499419ns] ✓ Syncing files to the component [155ms] Executing devfile commands for component myapp ✓ Executing s2i-assemble command "/opt/odo/bin/s2i-setup && /opt/odo/bin/assemble-and-restart" [47s] ✓ Executing s2i-run command "/opt/odo/bin/run" [1s] Pushing devfile component myapp ✓ Changes successfully pushed to component
-
Check the component status, there should be two components running both S2I and devfile:
$ odo list Devfile Components: APP NAME PROJECT TYPE STATE app myapp myproject myapp Pushed S2I Components: APP NAME PROJECT TYPE SOURCETYPE STATE app myapp myproject nodejs local Pushed
-
Delete the unused S2I component:
$ odo delete --s2i --all --force ✓ Deleting component myapp [277ms] ✓ Component myapp from application app has been deleted ✓ Config for the Component myapp has been deleted