Validated Patterns

Introduction

The multicloud gitops pattern is designed to be an entrypoint into the Validated Patterns framework. Demo, accessible within the pattern, contains two applications config-demo and hello-world to show the basic configuration and execution examples. For more information on Validated Patterns visit our documentation site.

Objectives

In this demo you will complete the following:

  • Prepare your local workstation

  • Deploy the pattern

  • Extend the pattern with a small tweak

Getting Started

This demo begins after ./pattern.sh make install has been executed

Demo

Now that we have deployed the pattern onto our cluster, with origin pointing to your fork and using my-branch as the name of the used branch, we can begin to discover what has happened. You should be able to click on the nine-box and see the following entries:

nine box

If you now click on the "Hub ArgoCD" menu entry you will be taken to the ArgoCD instance with all the applications.

hub argocd

Secrets loading

With pattern.sh script

By default in the MultiCloud GitOps pattern the secrets get loaded automatically via an out of band process inside the vault running in the OCP cluster. This means that running ./pattern.sh make install will also call the load-secrets makefile target. This load-secrets target will look for a yaml file describing the secrets to be loaded into vault and in case it cannot find one it will use the values-secret.yaml.template file in the git repo to try and generate random secrets.

Let’s copy the template to our home folder and reload the secrets:

cp ./values-secret.yaml.template ~/values-secret-multicloud-gitops.yaml
./pattern.sh make load-secrets

At this point if the config-demo application was not green already it should become green in the ArgoCD user interface.

Manually

Another way to load secrets is to add them for config-demo application (from values-secret-multicloud-gitops.yaml) to Vault manually:

  1. Go to Vault service route. URL can be found:

    1. by running command:

      oc -n vault get route vault -ojsonpath='{.spec.host}'
    2. in Openshift Container Platform web console under Networking > Routes for vault project.

  2. Log into the Vault using root token. Root token can be found by executing command:

    oc -n imperative get secrets vaultkeys -ojsonpath='{.data.vault_data_json}' | base64 -d
  3. After login go to secret catalog and clik Create secret and fill all the fields manually:

    1. Put global/config-demo value in the Path for this secret field (the value comes from values-secret-multicloud-gitops.yaml file).

    2. Add one Secret data key-value pair. Put secret as a key (left field) and required value (right field). Click Add button to confirm.

    3. Click Save to save changes.

      Create secret in the vault

Verify the test web pages

If you now click on the Routes in the Networking menu entry you will see the following network routes:

network routes

Clicking on the hello-world application should show a small demo app that prints "Hello World!":

hello world

Once the secrets are loaded correctly inside the vault, clicking on the config-demo route should display a small application where said secret is shown:

config demo

Make a small change to the test web pages

Now we can try and tweak the hello-world application and add the below line in the charts/all/hello-world/templates/hello-world-cm.yaml file:

diff --git a/charts/all/hello-world/templates/hello-world-cm.yaml b/charts/all/hello-world/templates/hello-world-cm.yaml
index e59561ca..bd416bc6 100644
--- a/charts/all/hello-world/templates/hello-world-cm.yaml
+++ b/charts/all/hello-world/templates/hello-world-cm.yaml
@@ -14,6 +14,7 @@ data:
     	</head>
       	<body>
         	<h1>Hello World!</h1>
+        	<h1>This is a patched version via git</h1>
         	<br/>
         	<h2>
         	Hub Cluster domain is '{{ .Values.global.hubClusterDomain }}' <br>

Once we commit the above change via git commit -a -m "test a change" and run git push origin my-branch we will be able to observe argo applying the above change:

config demo patched

Summary

You did it! You have completed the deployment of the MultiCloud GitOps pattern and you made a small local change and applied it via GitOps! Hopefully you are getting ideas of how you can take advantage of our GitOps framework to deploy and manage your applications.

For more information on Validated Patterns visit our website