Demo Setup¶
Although the operators have been tested with IBM Cloud Kubernetes Service, the demo video and descriptions in this section relate only to Red Hat OpenShift. If you wish to test the sample operators, then follow these mostly automated steps to setup an OpenShift cluster ready for demonstration.
Clone the repo¶
Provision an IBM Cloud OpenShift service¶
Install the workstation prerequistes¶
Install all demo components to OpenShift¶
Note: Ensure you are logged on to your OpenShift cluster, before you execute following command.
cd scripts
sh demo-openshift-operators.sh app demo reset
Create a Cloud Object Storage (COS) Bucket and Access Secrets¶
Create Object Storage on IBM Cloud
- Login to your IBM Cloud Console
- Search for Object Storage in Search Bar or Click on Catalog from Upper Navigation Menu, Choose Services in Type
- Click on the Object Storage
- Once clicked a tab window will open of Cloud Ojbect Storage, IBM Cloud will be selected by default
- Choose your pricing plan
- In configure your resource section:
- Enter Service Name
- Select a Resource Group
- Enter Tags as requied
- Click on Create
Create service credentials
- From the Left Navigation Menu Click on "Service Credentials".
- Click the "New Credential" blue button.
- Enter the name of credentials. (Example:
operator-sample-go-secret
) - Keep the Role to "writer".
- Click on "Adavanced options".
- Enable to the toggle to "Include HMAC Credentials".
- Click the "Add" button.
- Expand the credential name to show the "ACCESS KEY ID" and "SECRET ACCESS KEY" written in the JSON.
Store the service credentials to a Kubernetes Secret. This is required for the operator-database-backup application which backs up data to Cloud Object Storage
1 Navigate to the secret.yaml location (operator-database-backup/kubernetes
) and open the file.
operator-database-backup/kubernetes
nano secret.yaml
2 Edit file secret.yaml and change the following lines respectively:
HmacAccessKeyId: "Add access_key_id from Credential JSON"
HmacSecretAccessKey: "Add ecret_access_key from Credential JSON"
3 Create the secret on the cluster.
kubectl apply -f secret.yaml
Create a Route to the /hello endpoint for the micro-service application¶
Before you can create and test the route, you must have deployed the Application and DatabaseCluster resources.
cd operator-database
oc apply -f config/samples/database.sample_v1alpha1_databasecluster.yaml
cd operator-application
oc apply -f config/samples/application.sample_v1beta1_application.yaml
- Login to Openshift console
- Ensure you are in the "Administrator" view
- Ensure you are in the "application-beta" project
- Go to the "Networking" section in left navigation
- Select "Routes"
- Click the "Create Route" button
- Add following details
- Name the route "hello"
- Add the path "/hello"
- Select Service "application-service-microservice"
- Select Target Port 8081 -> 8081 (TCP)
- Click on "Create"
Now browse to the Location Link provided in the Routes List to invoke the /hello endpoint. It sometimes takes a couple of requests before the simple-microservice application responds. The browser should render the following response:
Hello World and hello Adam
The Route will continue to work even if the simple-microservice application is deleted and later re-created (by the Application operator)
Uninstall components prior to demo¶
Having followed the above steps, you should have an OpenShift cluster with all the required components to test the sample operators. However, in the demo video, certain steps were performed manually via the OpenShift console e.g. installing the operators via OperatorHub. If you wish to reproduce the demo yourself, it is necessary to delete some resources in preparation:
- Uninstall both operators (but leave Catalog sources), using OpenShift Console menu
Installed Operators
- Delete all CR instances (if present): Application, Database, Databasecluster, Databasebackup, using using OpenShift Console menu
Administration->CustomResourceDefinitions->[CRD Name]->Instances
- Delete all CRDs: Application, Database, Databasecluster, Databasebackup, using using OpenShift Console menu
Administration->CustomResourceDefinitions