Validated Patterns

Deploying the retail pattern

Prerequisites
  • An OpenShift cluster

    • To create an OpenShift cluster, go to the Red Hat Hybrid Cloud console.

    • Select OpenShift -> Red Hat OpenShift Container Platform -> Create cluster.

    • The cluster must have a dynamic StorageClass to provision PersistentVolumes. Verify that a dynamic StorageClass exists before creating one by running the following command:

      $ oc get storageclass -o custom-columns=NAME:.metadata.name,PROVISIONER:.provisioner,DEFAULT:.metadata.annotations."storageclass\.kubernetes\.io/is-default-class"
      Example output
      NAME      PROVISIONER       DEFAULT
      gp2-csi   ebs.csi.aws.com   <none>
      gp3-csi   ebs.csi.aws.com   true

      For more information about creating a dynamic StorageClass, see the Dynamic provisioning documentation.

  • Optional: A second OpenShift cluster for multicloud demonstration.

  • Optional: A quay account that can update images; this is if you want to use the pipelines to customize the applications.

  • Optional: A quay account with the following repositories set as public, and which you can write to:

    • quay.io/your-quay-username/quarkuscoffeeshop-barista

    • quay.io/your-quay-username/quarkuscoffeeshop-counter

    • quay.io/your-quay-username/quarkuscoffeeshop-inventory

    • quay.io/your-quay-username/quarkuscoffeeshop-web

    • quay.io/your-quay-username/quarkuscoffeeshop-customerloyalty

    • quay.io/your-quay-username/quarkuscoffeeshop-kitchen

    • quay.io/your-quay-username/quarkuscoffeeshop-majestic-monolith

    • quay.io/your-quay-username/quarkuscoffeeshop-monolith

      These repos contain the demo’s microservices. The public repos (quay.io/hybridcloudpatterns/*) provide pre-built images used by default, allowing the demo to run without rebuilding the apps. Creating your own quay copies offers transparency and lets you reproduce results or customize the apps.

  • Install the tooling dependencies.

The use of this pattern depends on having at least one running Red Hat OpenShift cluster. However, consider creating a cluster for deploying the GitOps management hub assets and a separate cluster for the managed cluster.

If you do not have a running Red Hat OpenShift cluster, you can start one on a public or private cloud by using Red Hat Hybrid Cloud Console.

Procedure
  1. Fork the retail repository on GitHub.

  2. Clone the forked copy of this repository.

    $ git clone git@github.com:your-username/retail.git
  3. Create a local copy of the secret values file that can safely include credentials. Run the following commands:

    $ cp values-secret.yaml.template ~/values-secret.yaml
  4. Edit values-secret.yaml populating with your quay username and password.

    # NEVER COMMIT THESE VALUES TO GIT
    version: "2.0"
    secrets:
        # These are credentials to allow you to push to your image registry (quay.io) for application images
      - name: imageregistry
        fields:
        # eg. Quay -> Robot Accounts -> Robot Login
        - name: username
          value: "my-quay-username"
        - name: password
          value: "my-quay-password"

    Do not commit this file. You do not want to push personal credentials to GitHub.

  5. Customize the deployment for your cluster by following these steps:

    1. Create a new branch named my-branch and switch to it by running the following command:

      $ git switch -c my-branch
    2. Edit the values-hub.yaml file to customize the deployment for your cluster by running the following command:

      $ vi values-global.yaml

      The defaults should suffice if you just want to see the apps running. The values that you might change are under the imageregistry, if you copied the images to your own quay account and hostname. If you like, you can change the git settings of account, email and hostname to reflect your own account settings.

      If you plan to customize the build of the applications themselves, there are revision and imageTag settings for each of them.

    3. Stage the changes to the values-hub.yaml file by running the following commands:

      $ git add values-global.yaml
    4. Commit the changes to the values-hub.yaml file by running the following commands:

      $ git commit -m "update deployment for my-branch"
    5. Push the changes to the values-global.yaml file by running the following command:

      $ git push origin my-branch
  6. Deploy the pattern by running ./pattern.sh make install or by using the Validated Patterns Operator.

Deploying the pattern by using the pattern.sh script

To deploy the pattern by using the pattern.sh script, complete the following steps:

  1. Log in to your cluster by running the following:

    1. Obtain an API token by visiting https://oauth-openshift.apps.<your-cluster>.<domain>/oauth/token/request

    2. Log in with this retrieved token by running the following command:

      $ oc login --token=<retrieved-token> --server=https://api.<your-cluster>.<domain>:6443
  2. Alternatively log in by running the following command:

    $ export KUBECONFIG=~/<path_to_kubeconfig>
  3. Deploy the pattern to your cluster by running the following command:

    $ ./pattern.sh make install

Verify the retail pattern installation

  1. Verify that the Operators have been installed.

    1. To verify, in the OpenShift Container Platform web console, navigate to Operators → Installed Operators page.

    2. Set your project to All Projects and verify the operators are installed and have a status of Succeeded.

      retail-v1-operators

  2. Track the progress through the Hub ArgoCD UI from the nines menu:

    retail-v1-console-menu

  3. Ensure that the Hub ArgoCD instance shows all of its apps in Healthy and Synced status once all of the images have been built:

    retail-v1-argo-apps-p1

  4. Check on the pipelines, if you chose to run them. They should all complete successfully:

    retail-v1-pipelines

  5. Go to the Quarkus Coffeeshop Landing Page where you are presented with the applications in the pattern:

    retail-v1-landing-page

  6. Click the Store Web Page to open the Quarkus Coffeeshop Demo:

    retail-v1-store-page

  7. Click the TEST Store Web Page to open a separate copy of the same demo.

  8. Clicking the respective Kafdrop links to go to a Kafdrop instance that allows inspection of each of the respective environments.

    retail-v1-kafdrop