Continuous Delivery of an Application

⏱️ Estimated Time: 15 Minutes

👨‍💻 Role: Developer

In this section you’re no longer acting as a cluster administrator, but are instead playing the role of a developer. Time to stretch your developer legs as the foo user, and have Argo CD continuously deploy an application of yours into the development environment that was setup in prior sections.

The application you’ll be using can be found at github.com/redhat-scholars/summit-2023-gitops-lab-sample-application. This repository contains a simple web application that renders a web page containing a randomly chosen meme. The repository also contains a set of resources in the k8s/ directory that will be used to deploy the application on OpenShift. You’re going to deploy this application into the project-memes-dev namespace, then make an update to the application Git repository that runs a CI pipeline, and observe how Argo CD detects the new changes and automatically deploys them to complete the CI/CD flow.

ex8.architecture

Separating the OpenShift/Kubernetes resources and source code for an application into separate repositories is a common approach. To reduce the number of repositories you need to manage, this workshop has placed both the source code and OpenShift/Kubernetes resources together in a single repository.

Login to Argo CD as a Developer User

If you’re not already logged into the Argo CD dashboard as the foo user:

  1. Login to the OpenShift Web Console using the following steps:

    • Select the standard-users provider.

    • Use the username: foo.

    • Use the password: foopassword.

    • Click the Log in button.

  2. Expand the Application Launcher icon (3x3 sqaure) in the top-right of the OpenShift Web Console.

    ex6.openshift ui argo link
  3. Click the Cluster Argo CD link. This will open a new browser tab.

  4. Accept the self-signed certificate warning if one appears. The login page will now appear.

  5. Click the Log in via OpenShift button.

  6. Login using the same standard-users identity provider, the foo username, and the foopassword password you used previously.

Create the Random Meme Application

The foo user now has permission to create an Application that targets the project-memes-dev Namespace in the in-cluster destination. You observed this in the prior exercise by viewing the project-memes in the Projects section in the Settings screen.

ex8.argocd project settings

Create an Argo CD Application to manage your containerised random meme web application:

  1. Visit the random-meme application repository.

  2. Click the Use this template button, and select Create a new repository from the list of options that are displayed.

    ex8.gh use template

  3. Enter the following as the Repository Name.

    rht-summit-2023-sample-application
  4. Navigate to the Argo CD dashboard.

  5. Click the New App button. An overlay will appear.

  6. Switch to the YAML editor in the overlay using the Edit as YAML button.

  7. Fill in the form with the following information:

    • Application Name: random-meme-dev (Using any other value will result in an error. Feel free to try a different value to see what happens!)

    • Project: project-memes

    • Sync Policy: Automatic

    • Prune Resources: Enabled

    • Self Heal: Enabled

    • Repository URL: https://github.com/%USERID%/rht-summit-2023-sample-application

    • Path: k8s/overlays/development

    • Cluster URL: https://kubernetes.default.svc

    • Namespace: project-memes-dev (Using any other value will result in an error. Feel free to try a different value to see what happens!)

  8. After filling out these details you can switch to the YAML view and confirm that it matches this screenshot:

    ex8.argocd application yaml

  9. Click the Create button.

The Application creation should be a success, and a new random-meme-dev Application tile should be shown in the Argo CD dashboard. Clicking on the tile reveals the Application details. It should have synchronised successfully.

ex8.argocd random meme application

Test the Containerised Application

Now that your containerised application has been deployed, go see what it does!

  1. Return to the OpenShift Web Console. Log in as either foo or opentlc-mgr user.

  2. Switch to the Developer perspective using the Perspective Switcher.

  3. Click the Topology link in the side-menu.

  4. Select the project-memes-dev from the Project dropdown.

  5. Click on the Node.js application in the topology. The application’s details will appear on the right.

    ex8.openshift topology

  6. Scroll down and click on the URL in the Routes section. A new browser tab will open and display a meme.

    ex8.random meme

Excellent, you’ve just deployed a containerised application using Argo CD!