IBM Z and LinuxONE - Solutions

Solutions

Solutions

IBM Z and LinuxONE platforms are built for cloud, ready for blockchain, optimized for machine learning, open for DevSecOps, and highly secured.

 View Only

Red Hat OpenShift Do on IBM System Z/LinuxONE

By Xiao Mei Zheng posted Mon July 05, 2021 10:09 PM

  

Part I Understand OpenShift Do

 
With OCP version 4.6 and newer , the Red Hat OpenShift Do— ODO — is available on IBM System Z/LinuxOne and Power Systems.
 
ODO is a CLI tool for creating applications on OpenShift Container Platform and Kubernetes. With ODO, you can write, build, and debug applications on a cluster without the need to administer the cluster itself. Creating deployment configurations, build configurations, service routes and other OpenShift Container Platform or Kubernetes elements are all automated by ODO.
 
On IBM system Z/LinuxONE, OpenShift Do has been supported since release 1.2.5. You can download and check the latest release on OpenShift mirror site.
 

Install ODO on Linux on IBM Z/LinuxONE

$ curl -L https://mirror.openshift.com/pub/openshift-v4/clients/odo/latest/odo-linux-s390x -o /usr/local/bin/odo
$ chmod +x /usr/local/bin/odo
 
How to use ODO is very much as documented. Especially, You can check the document about how to use ODO on IBM Z/LinuxONE.
 

Part II Using Openshift Do with Microsoft Visual Studio Code

 

Overview

 
The OpenShift VS Code extension uses both odo and the oc binary to interact with your OpenShift Container Platform cluster on IBM system Z/LinuxONE. To work with these features, install the OpenShift VS Code extension OpenShift Connector on VS Code. Then VS Developers can easily create, deploy and live debug applications running on OpenShift.
 

Prerequisites

 
You have installed VS Code.
 

Install OpenShift Connector Extension

 
There are two ways to install OpenShift Connector.
1.    Install by commands, steps are:
a)    Open VS Code.
b)   Launch VS Code Quick Open with Ctrl+P.
c)    Enter the following command:
   $ ext install redhat.vscode-openshift-connector
2.    Install by extension in VS Code View.
You can also install OpenShift Connector Extension on the VS Code view directly by searching extension with OpenShift connector.
 
Once the extension installed, you can enter OpenShift Application Explorer View on left menu.

Supported Commands and Features


To interact with OpenShift clusters and resources on VS code, the OpenShift Connector Extension supports a number of commands .The commands are accessible via the command palette (Cmd+Shift+P ⌘⇧P on macOS or Ctrl+Shift+P ⌃⇧P on Windows and Linux), Visual Studio Code View title buttons and tree context menus.

In the next section, we will introduce how to interact with OpenShift clusters and resources on VS code with three parts:

  1.     Login to the OpenShift cluster on VS Code View
  2.     Create components on VS Code View
  3.     More Operations for the deployed components on VS Code View

Log in to OpenShift Cluster

There are two ways to log in to OpenShift cluster. One is logging in to the given cluster with the given credentials. The other is logging in using bearer token for authentication to the API server. Click the login button and input the cluster URL, then you can choose both two ways to log in.
 

After logging in , you can build, deploy and manage your applications on a remote OpenShift Container Platform.
 

Create Components

A component is a set of Kubernetes resources which host code or data. Each component can be run and deployed inside the project or selected application. On VS Code view, you can create one component directly or by commands. Next, we will introduce how to prepare the resource and create one component on VS Code.
 

1.    Create new Project inside the OpenShift Cluster

A project is your source code, tests, and libraries organized in a separate single unit. Before creating components, you need create or set the active project. In VS code view, Use New Project button directly to create the new project. Use Set Active Project button directly to set the active project.
 

2.     List all available Component Types

The list of the available ODO supported and unsupported components and corresponding container images are sourced from the OpenShift cluster’s internal container registry and external registries associated with the cluster. In VS Code view, Use List Catalog Components directly to get the available components list.
 

3.    Create a new Component

To create a component from the project or inside the selected application, you can use New Component command directly by right clicking the project or application. Two ways are supported to create a new component now.
  • git - Use a git repository as a source for the Component.
  • local - Use local directory as a source for the Component. You need git clone the code to your directory, and then choose the code folder.
 

Then push the initial source code to the component by command Push. Your component will be deployed to OpenShift Container Platform.

More Operations for the Deployed Component

 
When the component is in pushed state, there are many operations supported in VS Code. In the next part, we will introduce the common operation for the deployed component.

1.   Expose component to the outside world

The URLs that are generated using New URL command, can be used to access the deployed components from outside the Cluster. Then push the component to reflect the changes on the cluster.

In VS Code view, you can access the URL directly by clicking the URL tab.
Then you can see the nodejs component demo’s output page.

2.    Add storage to the application components

Use the New Storage command to create Storage newstorage and mount to a Component. Then push the component to reflect the changes on the cluster.
 

Deleting storage are supported after adding the storage to the component.
 

3.    Watch for code changes and update component

In VS Code view, you can modify your application code and have the changes applied to your application on OpenShift Container Platform. With the update to the OpenShift Connector Version v0.2.7, The command Watch is supported to help watch for changes, update Component on change. This is not supported for git based components. Click Watch and you can see there is a WATCH SESSIONS.
 

Then if you change and save changed code, Watch will update and push the latest code, you can see the latest result when open the URL.
 

4.    Debug local component

You can debug local Java or Node.js Component in VS Code view. Click the Debug command and enter the debug window.

5.    Delete the component

In VS Code view, you can delete existing component from the remote cluster and removes the local config also.


Summary of  Part II Using Red Hat Openshift Do with MicrosoftVisual Studio Code

 
In this article, we have installed the Red Hat OpenShift Connector extension and used this extension for Visual Studio Code to provide an end-to-end developer experience for Red Hat® OpenShift® on IBM System Z/LinuxONE.

Many thanks to Tony Gargya, Nourhane Bziouech, Xin ke Wang and Cheryl A Fillekes for editing assistance and source materials.
0 comments
18 views

Permalink