Setting up OpenShift and Applications in one Hour

With the TechZone Accelerator Toolkit OpenShift can be set up in the cloud including custom applications by using automation via Terraform and Argo CD.

In my previous blog I explained the toolkit: Introducing IBM’s Toolkit to handle Everything as Code. The toolkit leverages Terrafrom and GitOps and is based on best practices based on IBM’s deployment experiences from partner and client projects.

Let’s take a look how the toolkit can be used. The module catalog provides 200+ modules to install IBM Software and open source components which can be deployed on clouds like AWS, Azure and IBM Cloud.

Complete stack solutions are defined in yaml files. These bill of materials contain list of modules, in this example OpenShift in the IBM Cloud, Argo CD including a GitOps repo, the Watson NLP (natural language processing) container and a custom application.

apiVersion: cloudnativetoolkit.dev/v1alpha1
kind: BillOfMaterial
metadata:
  name: cluster-with-watson-nlp
spec:
  modules:
    - name: ibm-ocp-vpc
      version: v1.16.0
    - name: argocd-bootstrap
      version: v1.12.0
    - name: gitops-repo
      alias: gitops_repo
      version: v1.22.2
    - name: terraform-gitops-ubi
      alias: terraform_gitops_ubi
      version: v0.0.8
    - name: terraform-gitops-watson-nlp
      alias: terraform_gitops_watson_nlp
      version: v0.0.80

The modules can be configured via variables, for example regions, resource group names, sizes of clusters, etc.

variables:
  # overall
  - name: region
    description: The IBM Cloud region where the instance should be provisioned
    value: xxx
  - name: resource_group_name
    description: The name of the IBM Cloud resource group where the resources should be provisioned
    value: xxx
  # ocp
  - name: worker_count
    description: The number of workers that should be provisioned per subnet
    value: 2
  - name: cluster_flavor
    description: The flavor of the worker nodes that will be provisioned
    value: bx2.4x16

To run the sample, you need to clone the repo and install the toolkit’s CLI, called iascable.

$ curl -sL https://iascable.cloudnativetoolkit.dev/install.sh | sh
$ git clone https://github.com/IBM/watson-automation

With the CLI the bill of material is converted into Terraform assets.

$ cd watson-deployments/roks-new-nlp 
$ iascable build -i bom.yaml
$ cd output

An image is provided which comes with all tools necessary to run Terraform. To start the container, invoke this command in a terminal:

$ ./launch.sh

In the running container invoke these commands:

$ cd cluster-with-watson-nlp
$ ./apply.sh

The ‘apply’ command takes roughly 45 minutes to set up the managed OpenShift cluster in the IBM Cloud and the additional modules. After this, you can find the resources in the IBM Cloud console.

Argo CD has been set up to deploy the Watson NLP container and the custom application.

To find out more about the toolkit, check out the documentation and the sample above.