Skip to content

Latest commit

 

History

History
152 lines (115 loc) · 6.91 KB

experimental-mode.adoc

File metadata and controls

152 lines (115 loc) · 6.91 KB

Experimental mode in odo

By default, the features in odo which are under development or under experiment are not exposed to the user. The odo commands/subcommands/flags associated with these features are hidden in odo help as well.

It is understood that the features in experimental mode (hidden by default) are under development and the behavior of these features is subject to change till the feature is not removed from experimental mode and available for use.

Enabling Experimental mode:

Experimental mode can be enabled by:

  • Setting an environment variable

  • Setting odo preference

Setting environment variable ODO_EXPERIMENTAL:

Experimental mode can be enabled by setting the environment variable ODO_EXPERIMENTAL=true

export ODO_EXPERIMENTAL=true
Setting odo preference:

Experimental mode can be enabled by setting odo preferences as well.

odo preference set experimental true

Working with experimental mode:

Listing devfile components:

When the experimental mode is enabled, odo catalog list components will list the devfile components alongside the S2I components.

$ odo catalog list components
Odo S2I Components:
NAME                       PROJECT       TAGS                                        SUPPORTED
nodejs                     openshift     10,8,8-RHOAR,latest                         YES
codewind-odo-openjdk18     che           latest                                      YES
dotnet                     openshift     2.0,latest                                  NO
httpd                      openshift     2.4,latest                                  NO
nginx                      openshift     1.10,1.12,1.8,latest                        NO
nodejs                     openshift     6                                           NO
perl                       openshift     5.24,5.26,latest                            NO
php                        openshift     7.0,7.1,latest                              NO
python                     openshift     2.7,3.5,3.6,latest                          NO
ruby                       openshift     2.3,2.4,2.5,latest                          NO
wildfly                    openshift     10.0,10.1,11.0,12.0,13.0,8.1,9.0,latest     NO

Odo Devfile Components:
NAME                 DESCRIPTION                           SUPPORTED
java-maven           Upstream Maven and OpenJDK 11         YES
nodejs               Stack with NodeJS 10                  YES
java-openliberty     Open Liberty microservice in Java     YES
java-springboot      Spring Boot® using IBM Java           YES
Creating a devfile component:

When creating a devfile component with the experimental flag enabled, a local config of the component settings in created at .odo/env/env.yaml in the project directory.

$ odo create java-springboot myspring
Experimental mode is enabled, use at your own risk

Validation
 ✓  Checking Devfile compatibility [234445ns]
 ✓  Validating Devfile [84112ns]

Please use `odo push` command to create the component with source deployed
Creating and deleting component url:

Create a devfile component url with odo url create and delete a devfile component url with odo url delete. This updates the component settings at .odo/env/env.yaml accordingly.

When creating a component url, the ingress domain must be specified with the flag --host and a valid port must be specified with --port. The ports to be pushed, must be in the devfile.

$ odo url create myspring --port 8080 --host <ingress domain>
 ✓  URL created for component: myspring, cluster host: <ingress domain>

To create URL on the OpenShift Cluster, please use `odo push`

When deleting a component url, specify the url name to be deleted

$ odo url delete myspring
? Are you sure you want to delete the url myspring Yes
 ✓  URL myspring removed from the env file

To delete URL on the OpenShift Cluster, please use `odo push`

To push either of the url sub-command changes, execute odo push.

Pushing to a devfile component:

When the experimental mode is enabled, odo push creates a pod with all the devfile component containers and volumes. Push syncs the local project on disk to the pod container where devfile component has mountSources: true. The optional build and the mandatory run commands are executed in order.

$ odo push
 •  Push devfile component myspring  ...

Applying URL changes
 ✓  URL myspring: http://myspring.<ingress domain> created
 ✓  Waiting for component to start [65ms]
 ✓  Checking files for pushing [10ms]
 ✓  Syncing files to the component [1s]
 ✓  Executing devbuild command "/artifacts/bin/build-container-full.sh" [1m]
 ✓  Executing devrun command "/artifacts/bin/start-server.sh" [3s]
 ✓  Push devfile component myspring [2m]
 ✓  Changes successfully pushed to component

By default, odo push executes devbuild and devrun devfile commands. However, custom commands can be also be provided to odo push via flags --build-command & --run-command. These flags are only available in the experimental mode.

Deleting a devfile component:

Delete a devfile component with odo delete. This deletes all the Kubernetes resources created during odo push. Use the -all flag to delete the Kubernetes resources and the local config at .odo/env/env.yaml

$ odo delete myspring
? Are you sure you want to delete the devfile component? Yes
 ✓  Deleting devfile component myspring [339ms]
 ✓  Successfully deleted component

Developing a devfile:

The devfile registry can be accessed here.

For more information on how to develop and write a devfile, please read the Odo stack creation document.

Forcing s2i type component creation over devfile type components:

If there is an s2i type component with the same name as a devfile type component, you can use --s2i flag to force the creation of s2i type component over devfile type. If there is a devfile type component with a given name but no s2i component, odo create --s2i will fail. Also, using flags specific to s2i component creation without using --s2i would also fail the odo create command.

In the above example output of odo catalog list components command, you can observe that nodejs component type is available in both s2i and devfile categories.

The following command should create an s2i type component.

$ odo create nodejs mynode --s2i
Experimental mode is enabled, use at your own risk

Validation
 ✓  Validating component [3s]

Please use `odo push` command to create the component with source deployed

The following command would fail for using --s2i flag as there is no s2i component type available with name "java-spring-boot".

$ odo create java-spring-boot myspring --s2i
Experimental mode is enabled, use at your own risk

  ✗  Cannot select this component with --s2i flag