Platform Engineer Activity: Setup Software Templates to Import Existing API/Apps

The Platform Engineering team creates two Templates for importing existing applications/services, and APIs into Red Hat Developer Hub. While it is possible to use the same template to import both of them, there are some key differences in the data that must be gathered.

You are most probably quite familiar by now how to login as a Platform Engineer with pe1/{common_password}. If you are unsure, please refer to the below note.

Click to know how to login as a Platform Engineer

Login as Platform Engineer

You will perform this activity as a Platform Engineer. Please follow the below steps to logout from Red Hat Developer Hub and GitLab, and login back as a Platform Engineer (pe1/{common_password})

  • Logout from Red Hat Developer Hub

    • Navigate to the Settings side menu of Red Hat Developer Hub and click on the kebab menu in the Profile card

      Settings of Red Hat Developer Hub
    • Sign out of Red Hat Developer Hub from the Settings section as shown in the screenshot below.

      Signing out of Red Hat Developer Hub
  • Logout from GitLab

    • Click on the Profile icon, and Sign out from the dropdown as shown in the screenshot below.

      Signing out of Red Hat Developer Hub
  • Login back as a Platform Engineer to Red Hat Developer Hub and GitLab using the credentials pe1/{common_password}

Register the Import Software Templates

Software Template Overview

You learned how to create a Software Template in module 3. In this section we will walk through a Template that has been pre-built for you.

Click here to view the import-existing-api Software Template you’ll be using.

This template does the following:

  1. Gather details of the API (GitLab org name, repo name)

  2. Gather details of the new Software Component to be created (target location of the component, the catalog info, API Path etc)

  3. Creates a Merge Request to create the new catalog-info and TechDocs file of the component

Register the Import API Software Template

  1. Access Red Hat Developer Hub (click here). If prompted login using pe1/{common_password}

  2. Click on the Create menu on the left-hand navigation.

    nav create
  3. Click on the Register Existing Component button on the top-right of the page to launch the Register an existing component wizard.

  4. Paste the following URL into the Select URL field and click on Analyze button. This URL points to Software Template’s template.yaml file.

    https://gitlab-gitlab.{openshift_cluster_ingress_domain}/rhdh/import-existing-api-template/-/blob/main/template.yaml
    nav register wizard
  5. Review, and import the template by clicking on the Import button.

    nav register import
  6. The import-api-catalog Template is successfully registered.

    nav access api template

Register Import App Software Template

  1. Let us now register the Import existing application template as well.

  2. Click on Register another button from the previous step;

    1. If that is not accessible anymore, click Create (left hand nav) → Register Existing Component (top right)

  3. Paste the following URL:

    https://gitlab-gitlab.{openshift_cluster_ingress_domain}/rhdh/import-existing-app-template/-/blob/main/template.yaml
  4. Review and import the template by clicking on the Import button

View the Imported Templates

Navigate back to Create using the side menu. You should see both the templates for importing APIs and applications to Red Hat Developer Hub.

import templates list

Setup GitLab Entity Auto-Discovery

The new templates require a set of dynamic plugins to function detect the newly created Entities:

  • roadiehq-scaffolder-backend-module-utils-dynamic: used to manipulate the file system. In this case it’s used to update commit the newly created catalog-info.yaml files to GitLab.

  • backstage-plugin-catalog-backend-module-gitlab-dynamic to enable auto-discovery of catalog-info.yaml files.

  • immobiliarelabs-backstage-plugin to interact with GitLab to MergeRequests, Issues, Pipeline runs etc

Enable the Plugins

  1. You will also enable a couple of Community plugins which will help view Merge requests and Issues from GitLab

  2. Visit your rhdh/developer-hub-config repository on GitLab. If prompted, login with pe1/{common_password}.

  3. You should already be in Edit mode of the values.yaml file.

  4. Locate the comment --- DYNAMIC_PLUGINS_IMPORT_COMPONENTS ---

  5. Highlight the YAML section shown in the below screenshot, and uncomment those lines. Use CMD + / or CTRL + / to do so.

    uncomment dynamic plugin
  6. Don’t commit the changes yet - you need to also enable auto-discovery.

Enable Auto-Discovery

  1. Locate the comment --- AUTO_DISCOVERY_IMPORT_COMPONENTS --- in the same values.yaml file.

  2. Highlight the YAML as shown in the below screenshot, and uncomment those lines.

    uncomment auto discovery
    This YAML snippet enables auto-discovery for all files named envelope.yaml (entityFilename) where the repo name starts with the word envelope (projectPattern).
  3. Go ahead and commit the file now using the Commit Changes button at the bottom of the page with a suitable commit message.

  4. Refresh the backstage Application to rollout the new Red Hat Developer Hub configuration - login as admin / {openshift_gitops_password}. Wait until the Application turns green and marked as Healthy.

Onboard Parasol’s System and Domain

In a previous chapter you learned how System and Domain Entities help organize and provide a hierarchy of Components in Red Hat Developer Hub. In this section you will setup Parasol’s System and Domain.

  1. From Red Hat Developer Hub, navigate to Create menu; choose Register Existing Component button

  2. Paste the below URL and click on Analyze

    https://gitlab-gitlab.{openshift_cluster_ingress_domain}/rhdh/rhdh-entities/-/blob/main/locations.yaml
  3. Click Import in the Review section.

  4. The Systems and Domain are setup.

Systems are the basic level of encapsulation for related entities. Domains are useful to group a collection of Systems that share terminology, domain models, business purpose etc.