With the TechZone Accelerator Toolkit IBM software, open source projects and custom applications can easily be deployed to various clouds. This article explains how to deploy resources on existing OpenShift clusters.
Check out my earlier blog that introduces the toolkit: Introducing IBM’s Toolkit to handle Everything as Code. The toolkit leverages Terrafrom and GitOps and is based on best practices from IBM projects with partners and clients.
With the toolkit both infrastructure like Kubernetes clusters as well as resources within Kubernetes clusters can be deployed. Infrastructure resources are deployed via Terraform, resources within clusters via Argo CD.
In some cases you might already have clusters and only want to set up resources within these clusters. Additionally when developing your own modules for the toolkit, you often want to skip creations of clusters, since it takes too much time.
To automate the deployments of Watson containers to embed AI in custom applications, we’ve created a repo. The repo contains documentation how to set up an OpenShift cluster with Watson containers and also documentation how to deploy the Watson containers to existing clusters.
The following sample shows how an OpenShift cluster is created in the IBM Cloud which comes with Argo CD, a GitOps repo, Watson NLP and a sample application based on ubi.
1
2
3
4
5
6
7
8
9
10
11
apiVersion: cloudnativetoolkit.dev/v1alpha1
kind: BillOfMaterial
metadata:
name: cluster-with-watson-nlp
spec:
modules:
- name: ibm-ocp-vpc
- name: argocd-bootstrap
- name: gitops-repo
- name: terraform-gitops-ubi
- name: terraform-gitops-watson-nlp
To deploy Watson containers to existing OpenShift cluster, another module called ‘ocp-login‘ can be used.
1
2
3
4
5
6
7
8
9
10
11
apiVersion: cloudnativetoolkit.dev/v1alpha1
kind: BillOfMaterial
metadata:
name: cluster-with-watson-nlp
spec:
modules:
- name: ocp-login
- name: argocd-bootstrap
- name: gitops-repo
- name: terraform-gitops-ubi
- name: terraform-gitops-watson-nlp
There is documentation that describes how to use the ocp-login module. You need two pieces of information that are defined in credentials.properties.
- OpenShift server URL, for example ‘https://cXXX-e.yy-zz.containers.cloud.ibm.com:30364’
- OpenShift login token, for example ‘sha256~xxx’
This is the complete credentials.properties file which also includes credentials to access the GitOps repo and the Watson container registry:
1
2
3
4
export TF_VAR_gitops_repo_token=___your-github-token____
export TF_VAR_terraform_gitops_watson_nlp_registry_credentials=___your-registry-credentials___
export TF_VAR_server_url=https://cXXX-e.yy-zz.containers.cloud.ibm.com:30364
export TF_VAR_cluster_login_token=sha256~xxx
To obtain ‘TF_VAR_server_url’ and ‘TF_VAR_cluster_login_token’ open the OpenShift console, click on your user name in the upper right corner and choose ‘copy login command’.
To find out more about these capabilities, check out the following resources: