Red Hat OpenShift - Group home

Getting start with Red Hat OpenShift Do

By Gerald Hosch posted Wed May 31, 2023 10:02 AM

  

Authors: Rishika Kedia, Harshitha M S, Surender Yadav

Red Hat OpenShift Do (odo) is a fast and straightforward tool for developers who deploy applications on Red Hat OpenShift Container Platform or Kubernetes on IBM® Z® and IBM® LinuxONE. Odo abstracts the complex concepts of Kubernetes so you can focus on one thing, the code.

Why one should use odo?

Odo is essentially focused on inner loop development as well as tooling that would help users transition to the outer loop.
Odo simplifies and creates Time-To-Value (TTV) feature for adaptability of platform. Odo exposes the interfaces that help deploy microservices-based applications – applications intended to run on Kubernetes-like infrastructure without having deep understanding of the platform. The most widely used CLI kubectl and oc require deeper understanding about container platforms.


Concept of Inner loop and Outer loop

The inner loop consists of all activities that a developer can control. Developers activities mainly involves designing, local coding, building, running, and testing the application on a development environment.
The outer loop consists of the larger team processes like code reviews, peer reviews, integrations tests, necessary scans that is imperative to be done before the code is deployed onto the cluster. Usually, a code commit to source control is the transition point between the inner and outer loops.
For more information refer to this article.

Installation of odo on IBM Z and IBM® LinuxONE
Odo can be deployed as a CLI tool on either of the Linux, Mac, or Windows.
For installing on IBM Z and IBM® LinuxONE platforms we use the Linux approach as described in this document.

Key concepts of odo
Application:  The application is developed using cloud-native approach and will be deployed as microservices on container platform. For example, Hardware management application, Online Shopping, etc.
Component: An application comprises of components which are small, independent, and loosely coupled units; a odo component is one of these components. Odo uses Devfile to define the component. For example, messaging component or storage component.
Devfile: Devfile is a portable YAML file that contains the definition of a component and its parts like other endpoints, storage and services. For deeper understanding about Devfiles refer to the documentation.
Context: Context points to the source code, tests, libraries and odo specific config files for a single component.
Project: Huge organizations usually comprises of business units or universities comprises various departments in such cases multi-tenancy is required where different teams use the same cluster under the hood of their respective projects. In Kubernetes, Project is represented by namespace.

Develop and deploy an application using odo
Prerequisites

·        Red Hat OpenShift Container Platform cluster – for installation refer the document here

·        odo tool installed on the cluster – for installation refer the document here

·        Configure odo global settings

·        Configure Devfile registry

·        Deploy an application using odo commands

Configuring odo global settings
The global settings for odo can be found in the preference.yaml file, which is located by default in the .odo directory of the user's HOME directory.
Example: /home/userName/.odo/preference.yaml
A different location can be set for the preference.yaml by exporting GLOBALODOCONFIG in the user environment.

View the configuration
Run the following command to view the current configuration
odo preference view
Example:
$ odo preference view
Preference parameters:
 PARAMETER           VALUE
 ConsentTelemetry    true
 Ephemeral           true
 PushTimeout
 RegistryCacheTime
 Timeout
 UpdateNotification
Devfile registries:
 NAME                    URL                                                  SECURE
 StagingRegistry  https://registry.stage.devfile.io  No
Set a configuration
To set a value for a preference key, run the following command:
odo preference set <key> <value>
Note: the preference key is case-insensitive

Example:
$ odo preference set updatenotification false
Global preference was successfully updated

Unset a configuration
To unset a value of a preference key, run the following command:
odo preference unset <key> [--force]
Example:
$ odo preference unset updatednotification
? Do you want to unset updatenotification in the preference (y/N) y
Global preference was successfully updated
Configuring Devfile Registry
We can use devfiles to automate and simplify development process. With devfiles one can record instructions for configuring and running build environments as YAML formatted text files.
Odo uses the portable devfile format to describe the components. Odo can connect to various devfile registries to download devfiles for different languages and frameworks.
One can connect to publicly available devfile registries, or you can install your own Devfile Registry.
We can use the “odo preference <add/remove> registry” command to manage the registries used by odo to retrieve devfile information.


Adding Registry
odo preference add registry <name> <url>
Example:
$ odo preference add registry StageRegistry https://registry.stage.devfile.io
New registry successfully added
Deleting Registry
odo preference remove registry <name> [--force]
Example:
$ odo preference remove registry StageRegistry
? Are you sure you want to delete registry "StageRegistry" Yes
Successfully deleted registry
Deploy an application using odo commands

To deploy an application using odo we have two important commands odo dev and odo deploy.
Odo dev should be used when you are working with local development environment, making changes constantly to your application, debug tests and during development process of an application.
Odo deploy should be used when your application is production ready and require building and pushing to the container.
For more information on how to use those two commands to deploy your application, please refer these blog articles:

Using Red Hat odo dev command to deploy applications on IBM Z and IBM® LinuxONE

Using Red Hat odo deploy command to deploy applications on IBM Z and IBM® LinuxONE

Commands Reference

·        odo add binding

·        odo build-mages

·        odo completion

·        odo create namespace

·        odo delete component

·        odo delete namespace

·        odo deploy

·        odo describe binding

·        odo describe component

·        odo dev

·        odo init

·        odo list binding

·        odo list component

·        odo list namespace

·        odo list services

·        odo list

·        odo logs

·        odo registry

·        odo remove binding

·        odo set namespace

·        json output


0 comments
25 views