Database as a service using Software Template Patterns
Introduction
Welcome to this lab, where you will have the chance to learn how to work with Software templates in Red Hat Developer Hub, and create a new instance of Red Hat Data Grid with Infinispan from Red Hat Developer Hub.
This lab will use creating the instance in an existent, not yet ready template. You will be working to adding the infinispan instance as part of this new template. During this lab, you will have the opportunity to explore how to build clusters for Data Grid, with main goal of learning the different options to build and bring new components into OpenShift in a self-service approach.
Explore RH Data Grid
Scenario
Now, imagine for a moment that you need to fullfil a need for the Java Development team. The Java Team’s responsibility is to connect a new application with Data Grid, for now, only for the development environment.
Explore the RH Data Grid template in GitLab
-
Take the time to review the source code to get familiarize with the content.
-
{gitlab_url}/rhdh/rhads-enablement-l3-st-self-service/-/blob/main/rhdatagrid_infinispan[{gitlab_url}/rhdh/rhads-enablement-l3-st-self-service/-/blob/main/rhdatagrid_infinispan,window=_blank]
-
Login with your user credentials:
-
Username: {gitlab_user}
-
Password: {gitlab_user_password}
-
-
Component/catalog-info.yaml: This file will represent the object in Developer Hub, such as name and links.
-
Developer Hub, powered by GitOps, maintains the desired state as the actual state in the cluster for any template definitions, ensuring system stability.
-
GitOps application definitions and necessary secrets to read from the SCM. In this case, the argo-app-dev.yaml is the Argo CD Application pointing to the Data Grid manifest’s folder.
-
Helm Charts are great for templating. In this case, the Data Grid manifests are implemented using Helm.
-
template.yaml file: Defines the UI experience for the end user and the desired steps to get the software templates, create repositories, create GitOps objects, and more.
-
Explore the RH Data Grid template in RHDH
-
Select the plus icon on the top navigation bar to access the Create option or from URL {rhdh_url}/create[Red Hat Developer Hub UI Create^]
-
Click the Register Existing Component button.
{rhdh_url}/catalog-import[Red Hat Developer Hub UI- Catalog^]
-
Enter the following URL in the Select URL field and click Analyze:
{gitlab_url}/rhdh/rhads-enablement-l3-st-self-service/-/blob/main/rhdatagrid_infinispan/template.yaml
-
Click on the Import button
Congratulations! You now have a new Software template in RHDH. Now, end-users can self-provision RH Data Grid.
-
We’ll explore the end-user experience by accessing the Software Templates view.
-
From catalog, select Self-service
-
Look for the RH Data Grid infinispan catalog
Let’s explore the current catalog:
-
Click on the Choose
-
Review and fill out the information with dummy data until you reach the review screen, without creating the RH Data Grid. DO NOT CLICK ON CREATE.
Implement changes in Software Templates.
To accomplish the requirement, you need to update the infinispan.yaml file right now is blank.
The Java Team can access RH Data Grid by creating an Infinispan cluster from RHDH. After this, Developer Hub will use the power of GitOps to create a new Data Grid cluster in OpenShift.
-
Click on Catalog on the RHDH menu
-
Next, select the filters: Kind:Template and Tags: self-service As shown in the following picture:
-
Select the Red Hat Data Grid infinispan
-
Access the Source code by clicking on View Source
-
We need to update the RH Data Grid instance.
-
Go to manifests/helm/app/templates/ or click on {gitlab_url}/rhdh/rhads-enablement-l3-st-self-service/-/tree/main/rhdatagrid_infinispan/manifests/helm/app/templates[templates folder^]
-
Create a new file:
-
We’ll review the configuration needed from the Operator official documentation.
-
Review the official documentation:
-
Copy the infinispan definition
-
Paste the content on new file
Take the time to review your file with the solution file provided here:
-
Note that your file needs to be ready to be used with Helm. In the following solution, you will find the name was updated to be a variable, and labels were included.
-
Note: The file also contains a definition to expose the deployment with a Route: Exposing Data Grid through a Route and we added the custom credentials as well as defined on the documentation Configuring authentication
As we had modified the content, use the solution provided for this configuration:
-
Copy the content from the solution provided.
-
Name your file as infinispan.yaml
Note: Don’t forget to commit your changes.
-
Ensure the template has the latest changes.
-
On RHDH, in the Data Grid template:
-
{rhdh_url}/catalog/default/template/rhdatagrid-infinispan-instance/[Red Hat Developer Hub UI Template^]
-
Click on the entity refresh icon
Test your changes: Explore the user experience as Developer
Let’s create an instance of the RH Data Grid defined in the software templates.
-
From catalog, select Self-service and find the Red Hat Data Grid infinispan
-
Click on the Choose
-
Click on the Choose
-
Review the information until you complete the flow and click on Create.
-
Open the catalog from the component’s creation page:
-
The component is created, and you should see a screen like this one:
-
Click on Data Grid URL from the component’s overview
-
Access RH Data Grid with the credentials listed on the {gitlab_url}/rhdh/rhads-enablement-l3-st-self-service/-/blob/main/rhdatagrid_infinispan/manifests/helm/app/templates/identities.yaml[identity file^]
user: user1
password: openshift!3415@
Note: The infinispan might take a few minutes to complete provisioning.
-
Click on Proceed, next click on Open the console
-
You should see only one screen, like this one:
-
In case you want to log in to the OpenShift Cluster{openshift_console_url}[Web Console^]
-
Use your user credentials:
-
Username: {openshift_admin_user}
-
Password: {openshift_admin_password}
-
-
Note: In a production environment, the security setup and user creation will not be managed in this identity yaml file. Explore the RH Data Grid documentation to learn more about best practices. Configuring Authentication
Conclusion
You have updated the RH Data Grid software template by adding the infinispan instance to fulfill the requirement from the Java Development team. After this process, other configurations can be applied to the cluster. Explore more at Configuring Clusters