odo
v3 is now GA! ๐
Are you an application developer wanting to work closely with a production-like environment? Pressured on time due to the steep learning curve involved in cluster development?
odo
is here to answer your problems!
Over the past couple of months, the odo
team has been developing better experiences on working with applications and container clusters.
So, what's new?โ
odo
v3 comes with a new set of commands that replaces the old one but essentially does the same thing, in a faster and more efficient way.
odo initโ
odo init
allows you to generate example code or fetch an appropriate Devfile for your existing project.
__
/ \__ Initializing a new component
\__/ \ Files: Source code detected, a Devfile will be determined based upon source code autodetection
/ \__/ odo version: v3.0.0
\__/
Interactive mode enabled, please answer the following questions:
Based on the files in the current directory odo detected
Language: javascript
Project type: nodejs
The devfile "nodejs" from the registry "StagingRegistry" will be downloaded.
? Is this correct? Yes
โ Downloading devfile "nodejs" from registry "StagingRegistry" [3s]
โช Container Configuration "runtime":
OPEN PORTS:
- 3000
ENVIRONMENT VARIABLES:
? Select container for which you want to change configuration? NONE - configuration is correct
? Enter component name: my-node-app
Your new component 'my-node-app' is ready in the current directory.
To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
Changes will be directly reflected on the cluster.
How is it different from the odo create
command of v2?
Detect the appropriate Devfileโ
odo init
will automatically analyze your directory and based on the project type, suggest an appropriate Devfile for use.
Personalize the Devfile configurationโ
odo init
also provides a better interactive way to configure your Devfile according to your project requirement. With this feature, you can modify the environment variables exported to and ports exposed by your application on the cluster.
odo devโ
odo dev
allows you to build, run, debug and test your application on the cluster in a continuous workflow.
$ odo dev
__
/ \__ Developing using the "my-node-app" Devfile
\__/ \ Namespace: default
/ \__/ odo version: v3.0.0
\__/
โช Deploying to the cluster in developer mode
โข Waiting for Kubernetes resources ...
โ Pod is Pending
โ Pod is Running
โ Syncing files into the container [172ms]
โ Building your application in container on cluster (command: install) [11s]
โข Executing the application (command: run) ...
- Forwarding from 127.0.0.1:40001 -> 3000
โช Dev mode
Status:
Watching for changes in the current directory /tmp/pd
Keyboard Commands:
[Ctrl+c] - Exit and delete resources from the cluster
[p] - Manually apply local changes to the application on the cluster
How is it different from the odo push
command of v2?
odo
v3 combines the odo push
and odo watch
commands from v2 into a single odo dev
command.
Additionally the command provides:
- Continuous workflow
- Manual trigger to apply local changes on the cluster
- Resource cleanup
- Better watch system
- Port forwarding to access the application
Continuous workflowโ
odo dev
is a non-terminating command that runs until the user hits Ctrl+c
. It continuously watches the directory for any new changes (including the changes occurring in the Devfile) and automatically syncs them with the application running on the cluster.
Manual trigger to apply local changes on the clusterโ
By default, odo dev
automatically detects any new change in the directory, and syncs it with the application running on the cluster, but it is possible to do this trigger manually by running the command with a --no-watch
flag and pressing p
to trigger the sync.
Better watch systemโ
odo dev
continuously monitors the resources created to run the application on the cluster and ensures that the application stays running.
Resource cleanupโ
Before exiting, odo dev
will cleanup any resources that it created while running the application on the cluster.
Port forwarding to access the applicationโ
odo dev
uses port-forwarding instead of Routes and Ingresses for accessing the application.
Read this section to learn more: What happened to Ingress/Route?
odo add bindingโ
odo add binding
allows the application to connect to an Operator Backed service.
$ odo add binding
? Do you want to list services from: current namespace
? Select service instance you want to bind to: cluster-sample (Cluster.postgresql.k8s.enterprisedb.io)
? Enter the Binding's name: my-node-app-cluster-sample
? How do you want to bind the service? Bind As Files
? Select naming strategy for binding names: DEFAULT
โ Successfully added the binding to the devfile.
Run `odo dev` to create it on the cluster.
You can automate this command by executing:
odo add binding --service cluster-sample.Cluster.postgresql.k8s.enterprisedb.io --name my-node-app-cluster-sample
How is it different from the odo link
command of v2?
- Interactive mode
- Ability to connect to a service in any namespace
- Run from anywhere
- Work without a running application
- Only supports Bindable Operators
- Requires the Service Binding Operator
Interactive modeโ
odo add binding
provides an interactive mode that lists bindable services across all the namespaces, and a way to personalize related configuration, making the experience better.
Ability to connect to a service in any namespaceโ
odo add binding
allows the application to connect to any bindable service in any namespace, it does not necessarily have to be in the same namespace as the application.
Run from anywhereโ
odo add binding
can be run from anywhere and does not require access to a Devfile in order to work. With this method, you can either: directly create the Service Binding on the cluster, write the YAML to a file, or simply display it.
Work without a running applicationโ
As opposed to v2, odo add binding
no longer requires the application to be running on the cluster, making it even faster.
Only supports Bindable Operatorsโ
odo link
could link an application to another application and any Operator Backed service. As of now, v3 only supports connecting to services that are backed by Operators considered bindable by the Service Binding Operator.
Requires the Service Binding Operatorโ
odo add binding
requires that the Service Binding Operator is installed on the cluster before it is run. The command relies on the Operator to provide it with a list of Bindable services.
odo deployโ
odo deploy
allows you to run the outerloop of your development cycle, essentially in a production-like environment.
Once you are satisfied with your application development locally, and are now ready to show your application to the world, you can use odo deploy
to move to the next stage.
$ odo deploy
__
/ \__ Deploying the application using "my-node-app" Devfile
\__/ \ Namespace: my-node-app
/ \__/ odo version: v3.0.0
\__/
โช Building & Pushing Container: quay.io/pvala18/myimage
โข Building image locally ...
STEP 1/7: FROM quay.io/phmartin/node:17
STEP 2/7: WORKDIR /usr/src/app
--> Using cache b18c8d9f4c739a91e5430f235b7beaac913250bec8bfcae531a8e93c750cea87
--> b18c8d9f4c7
STEP 3/7: COPY package*.json ./
--> Using cache cd151181cd9b2c69fc938eb89f3f71d0327d27ffba53c54247a105733cb36217
--> cd151181cd9
STEP 4/7: RUN npm install
--> Using cache 72b79a4f76ab0f9665653a974f5c667b1cb964c89c58e71aa4817b1055b1c473
--> 72b79a4f76a
STEP 5/7: COPY . .
--> 5c81f92690e
STEP 6/7: EXPOSE 8080
--> 9892b562a8a
STEP 7/7: CMD [ "node", "server.js" ]
COMMIT quay.io/pvala18/myimage
--> 7578e3e3667
Successfully tagged quay.io/pvala18/myimage:latest
7578e3e36676418853c579063dd190c9d736114ca414e28c8646880b446a1618
โ Building image locally [2s]
โข Pushing image to container registry ...
Getting image source signatures
Copying blob 0b3c02b5d746 skipped: already exists
Copying blob 62a747bf1719 skipped: already exists
Copying blob 650b52851ab5 done
Copying blob 013fc0144002 skipped: already exists
Copying blob aef6a4d33347 skipped: already exists
Copying config 7578e3e366 done
Writing manifest to image destination
Storing signatures
โ Pushing image to container registry [22s]
โช Deploying Kubernetes Component: my-component
โ Creating kind Deployment
Your Devfile has been successfully deployed
odo dev
vs odo deploy
โ
You might find yourself wondering how odo dev
is different from odo deploy
and when should you use the either one, you can read this article to get an answer to that question.
odo registryโ
odo registry
lists all the Devfiles provided by the Devfile registries added to your development environment.
$ odo registry
NAME REGISTRY DESCRIPTION
dotnet50 StagingRegistry Stack with .NET 5.0
dotnet60 StagingRegistry Stack with .NET 6.0
dotnetcore31 StagingRegistry Stack with .NET Core 3.1
go StagingRegistry Go is an open source programming languag...
java-maven StagingRegistry Upstream Maven and OpenJDK 11
java-openliberty StagingRegistry Java application Maven-built stack using...
java-openliberty-gradle StagingRegistry Java application Gradle-built stack usin...
java-quarkus StagingRegistry Quarkus with Java
java-springboot StagingRegistry Spring Bootยฎ using Java
java-vertx StagingRegistry Upstream Vert.x using Java
java-websphereliberty StagingRegistry Java application Maven-built stack using...
java-websphereliberty-gradle StagingRegistry Java application Gradle-built stack usin...
java-wildfly StagingRegistry Upstream WildFly
java-wildfly-bootable-jar StagingRegistry Java stack with WildFly in bootable Jar ...
nodejs StagingRegistry Stack with Node.js 16
nodejs-angular StagingRegistry Angular is a development platform, built...
nodejs-nextjs StagingRegistry Next.js gives you the best developer exp...
nodejs-nuxtjs StagingRegistry Nuxt is the backbone of your Vue.js proj...
nodejs-react StagingRegistry React is a free and open-source front-en...
nodejs-svelte StagingRegistry Svelte is a radical new approach to buil...
nodejs-vue StagingRegistry Vue is a JavaScript framework for buildi...
php-laravel StagingRegistry Laravel is an open-source PHP framework,...
python StagingRegistry Flask is a web framework, itโs a Pytho...
python-django StagingRegistry Django is a high-level Python web framew...
How is it different from odo registry
command of v2?
odo registry
of v2 was useful in creating/deleting/updating/listing the Devfile registries, however in v3, this command can now be used to list the Devfiles.
In odo
v3, you can use odo preference <add/remove> registry
to create/delete/update the Devfile registries, and odo preference view
to list them.
Additionally, it also provides,
Filtering the Devfilesโ
odo registry
can filter the list of Devfiles based on a keyword (--filter
), a Devfile registry (--devfile-registry
), or the Devfile name (--devfile
).
Detailed information about the Devfilesโ
odo registry
can provide a detailed information about all the Devfiles by running it with --details
flag.
odo listโ
odo list
lists all the resources created by odo
including components, and bindings.
$ odo list
โ Listing resources from the namespace "my-percona-server-mongodb-operator" [302ms]
NAME PROJECT TYPE RUNNING IN MANAGED
my-node-app nodejs Deploy odo (v3.0.0)
my-go-app go Dev odo (v3.0.0-rc1)
mongodb-instance Unknown None percona-server-mongodb-operator
Bindings:
NAME APPLICATION SERVICES RUNNING IN
my-go-app-mongodb-instance my-go-app-app (Deployment) mongodb-instance (PerconaServerMongoDB.psmdb.percona.com) Dev
How is it different from odo list
of v2?
Better informationโ
odo list
gives a better experience by providing information about your application such as: the mode it is running in, the tool (versioned) managing it, and the project type.
It further provides subcommands such as odo list components
, and odo list bindings
to list respective resources.
Ability to list Bindingsโ
odo list
provides a way to list the bindings created on the cluster by odo
.
Migrating from v2 to v3โ
The changes from v2 to v3 have been huge, but that does not have to mean big changes for you. We have documented the migration process to ease things for you.
The migration doc also documents the commands that have been added, modified or removed from v3.
Installation Guideโ
To install odo
v3.0.0, refer to our installation guide.
Full Changelogโ
You can find the full changelog from v2.5.1 to v3.0.0 in our GitHub release page.
Contributing to odoโ
If odo
interests you and you would like to contribute to it, we whole heartedly welcome you!
You can contribute to odo
in a lot of different ways!
Take it for a spin ๐ and report back bugs๐ that you encountered, or features๐ that you would like to see.
Help us with the documentation๐, or tell us how you used odo
๐.
Review the PRs๐, or help us fix a failing test ๐ฉ.
Work on the TODOs๐, or help us cleanup the code๐ฎ.
Or, simply tune in๐ป to our contributor calls and learn more about odo
.
odo
is your playground!
Read the developer reference guide on contributing to odo to know more.