Welcome to the Green Team Cluster

This cluster demonstrates how to:

Pre-Applied Customisations

Your Green Team cluster already has a fun customisation pre-applied.

Try it out:

  1. Login to your OpenShift Web Console using the credentials supplied by your workshop administrator.

  2. Expand the Application Launcher* menu (the 3x3 sqaure icon) in the top-right of the OpenShift console.

These customizations can be applied to any cluster where you have cluster-admin access:

git clone https://github.com/redhat-scholars/quickstart-workshop
cd quickstart-workshop/apps/green/cluster-setup
./setup.sh

Notice that there’s a Cluster Argo CD link in the launcher. This is an example of a customisation that has been pre-applied to your cluster.

To see another example of a customisation, logout of the cluster by clicking your username in the top-right corner and clicking the Log out link!

Customise the Web Terminal

Customising the Web Terminal tooling image enables you to provide your developers with specific versions of tools to use directly from the OpenShift Web Console.

The source code for the default tooling container image is available in the redhat-developer/web-terminal-tooling repository on GitHub.

In this guide you’ll customise the Web Terminal tooling container to use a pre-prepared container image.

Modify the Web Terminal Container Image

  1. Login to your OpenShift cluster as a user that has the cluster-admin role.

    You posses the cluster-admin role if you can view Projects starting with the openshift- prefix. An existing user with the cluster-admin role can grant the same role to other users using the oc adm policy add-cluster-role-to-user cluster-admin <username> command.
  2. Select the Administrator view from the top left.

  3. Expand the Home pane in the sidemenu and select the Search section.

  4. Choose openshift-operators in the Project dropdown at the top of the screen.

    Use the Show default projects toggle if the openshift-operators Project is not listed.
  5. Use the Resources dropdown to find the DevWorkspaceTemplate and select it.

    DevWorkspaceTemplate listing in the OpenShift Web Console
  6. Select the web-terminal-tooling item in the resulting list, and navigate to the YAML tab on the subsequent screen.

  7. Add the line web-terminal.redhat.com/unmanaged-state: 'true' to the annotations in the YAML.

  8. Change the image property in the listed container to use the quay.io/evanshortiss/summit-connect-2022-web-terminal:latest container image.

    DevWorkspaceTemplate YAML in the OpenShift Web Console

Use the Customised Web Terminal Container Image

Take your customised Web Terminal for a spin:

  1. Login to the cluster as any user available to you.

  2. Click the Web Terminal icon in the toolbar at the top of the screen.

  3. Follow the onscreen prompts to select an existing project or create a new project that will be used to deploy the Web Terminal Pod.

  4. Verify that the terminal has started and you see a unqiue ASCII art welcome message.

    You might not see the ASCII art if you used a Project that had an existing terminal session.

    Force the new container image to be used by deleting the existing Pod(s) using the following command in your Web Terminal session:

    oc delete pod -l 'controller.devfile.io/devworkspace_id'

    The Web Terminal will freeze for a moment while a new Pod is created. The new Pod will use the new customised container image and print the ASCII art. If a Try again error message is displayed, click the link and reopen the Web Terminal.

The ASCII art displayed by the customised Web Terminal is shown in the image below.

A customised Web Terminal showing ASCII Art

Customising the OpenShift Web Console

The OpenShift Web Console provides extensive customistion options. These are documented in the Customizing the Web Console section of the OpenShift documentation.

Customising the Web Console requires use of a user account with cluster-admin permission.

Console Notification Banners

A notification banner can be added to the OpenShift Console using a ConsoleNotification CRD. An example is shown in the following screenshot.

A custom banner at the top of the OpenShift Web Console

Add this banner to your cluster:

  1. Select the Developer Perspective from the side-menu on OpenShift.

  2. Click the Search link in the side-menu of the Developer Perspective.

  3. Search for the ConsoleNotification using the Resources dropdown. Check the box beside it when listed.

    Search feature in the OpenShift Web Console showing the ConsoleNotification listing
  4. Click the Create ConsoleNotification button.

  5. Replace the YAML sample with the following content:

    apiVersion: console.openshift.io/v1
    kind: ConsoleNotification
    metadata:
      name: hackathon-banner
    spec:
      text: Welcome to the Green Team OpenShift cluster for the Summit Connect Hackathon!
      location: BannerTop
      link:
        href: 'https://github.com/redhat-scholars/quickstart-workshop/tree/master/apps/green'
        text: (View Code for the Green Team Cluster)
      color: '#fafafa'
      backgroundColor: '#65a30d'
  6. Click the Create button.

If you are unable to create the ConsoleNotification, make sure to log in as a user with cluster-admin permissions and try again.

Take note of the link to a GitHub repository in the ConsoleNotification. You’ll be using that code shortly!

Customise the Cluster Branding

A custom logo and/or custom product name can be applied by modifying the Console CR.

Follow these instructions to set a custom logo on your cluster:

  1. Login to your OpenShift Web Console as a user with cluster-admin permissions.

  2. Open the Web Terminal.

  3. Download a logo file using cURL inside the Web Terminal:

  4. Use the Web Terminal to create a ConfigMap in the openshift-config namespace on your OpenShift cluster to store the logo binary data:

    oc create configmap console-custom-logo \
    --from-file /tmp/green-team.png -n openshift-config

The last step in this process is to instruct the OpenShift Web Console to display your logo instead of the default logo. This requires modifying the existing Console CR. This can be accomplished using the either the oc edit or oc patch commands. Use the oc patch command to apply the Console configuration change:

  1. Create the patch YAML by running the following command in the Web Terminal:

    cat <<EOF > /tmp/patch.yaml
    spec:
      customization:
        customLogoFile:
          key: green-team.png
          name: console-custom-logo
    EOF
  2. Run the patch command, applying the change to the Console item named cluster:

    oc patch consoles.operator.openshift.io cluster \
    --type merge --patch-file /tmp/patch.yaml
  3. Wait a minute, and refresh your web browser. The custom logo should be displayed in the top-left of the OpenShift Web Console.

A custom logo at the top of the OpenShift Web Console

Using GitOps to Manage Cluster Resources

In this section you’ll add further customisations known as QuickStarts to the OpenShift cluster, but there’s a twist! You’ll be using link: OpenShift GitOps to synchronise the QuickStart YAML definitions from a Git repository to the OpenShift cluster. The QuickStarts will guide users through the steps required to manage a resource using OpenShift GitOps.

If you’re not familiar with it, GitOps is a set of practices to manage infrastructure and application configurations using Git repositories as a single source of truth for declarative infrastructure. Red Hat OpenShift GitOps uses Argo CD to maintain cluster resources. Argo CD is an open-source declarative tool for the continuous integration and continuous deployment (CI/CD) of applications.

Simplified Argo CD Flow Diagram

It’s possible to run OpenShift GitOps on the same cluster that you want to sync resources to, or on a separate cluster and sync resources to one or more distinct clusters. In this workshop we’re running everything on a single cluster to remove the need for managing multiple clusters.

Access the Cluster Argo CD Instance

To get started, you’ll need to access the Argo CD UI:

  1. Login to your OpenShift cluster as a “cluster-admin” user.

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

    Expanded Application Launcher in the OpenShift Web Console showing an Argo CD Link
  3. Click the Cluster Argo CD link to load the Argo CD UI.

  4. Use the Log in via OpenShift button to initiate an OpenShift SSO login flow. Enter your password and accept the permissions request when prompted.

    This Argo CD instance has been pre-configured to support integration with OpenShift SSO. All users on the cluster can login, but only users in cluster-admins group have write access.

You will be redirected to the Argo CD applications dashboard upon successful login.

The Argo CD Dashboard

Applications and Argo CD

Argo CD uses an Application CRD to represent deployed application resources. The Application definition specifies the source state, represented using YAML files in a Git repository, and a destination cluster and namespace in which to deploy the resources.

An example Application CR is shown below.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: guestbook
  namespace: guestbook
spec:
  project: default
  source:
    repoURL: https://github.com/argoproj/argo cd-example-apps.git
    targetRevision: HEAD
    path: guestbook
  destination:
    server: https://kubernetes.default.svc
    namespace: guestbook

You will create an Argo CD Application that uses source files defined in the redhat-scholars/quickstart-workshop repository. Take a look at these files and you might notice that some, such as the consolenotifiction.hackathon-banner.yaml look familiar.

Create an Application in Argo CD

Applications can be created using the Argo CD UI, or by directly by applying Application CRs to your OpenShift cluster using the OpenShift CLI or the OpenShift Web Console.

Create an Application using the Argo CD UI:

  1. Login to the Argo CD applications dashboard.

  2. Click the Create Application button on the Argo CD applications dashboard. An overlay will appear.

    New Application Button in Argo CD
  3. Set the following paramaters in General section of the overlay:

    • Application Name: console-customisations

    • Project: default

    • Sync Policy: automatic

    • Self Heal: Enabled

  4. Set the following paramaters in Source section of the overlay:

  5. Set the following paramaters in Destination section of the overlay:

  6. Set the following paramaters in Directory section of the overlay:

    • Directory Recurse: Enabled

  7. Click the Create button at the top of the overlay.

The console-customisations Application will be created, and the status of the Application will be shown in the Argo CD UI.

All of the listed resources will be synced to the OpenShift cluster. Changes made in to resources in the Git repository will automatically be detected and synchronised to the OpenShift cluster by Argo CD.

An application being rendered in the Argo CD UI

Return to the OpenShift Console, refresh the page, and verify that:

  1. The previously added ConsoleNotification banner message has been modified.

  2. The Application Launcher menu (the 3x3 sqaure icon) contains a Hackathon Resources section.

  3. Selecting Quick Starts from the Help Menu (question mark icon) in the top-right of the OpenShift Web Console lists new Quick Starts named Customise, Deploy and Observe.

Custom Quick Starts displayed in the OpenShift Web Console

Follow the Quick Starts

Congratulations on making it this far! You’re now ready to start your own cluster customisation journey.

To get started visit the Quick Starts, and complete the Quick Start named Summit Connect Hackathon (Customise). Remember, you can find the Quick Starts by selecting Quick Starts from the Help Menu (question mark icon) in the top-right of the OpenShift Web Console.

After completing this Quick Start you’ll have a Git repository that contains your unique customisations, and you can synchronise them with your cluster using Argo CD.