Deploy Service

Deploy a REST API and setup for discovery

In this section, you will deploy an existing Quarkus application container image and configure it to make it easily discoverable by OpenShift API Management.

Deploy a REST API

Now, let’s deploy an existing Quarkus application. The container image of this file is hosted on quay.io. Quay is a registry for storing and building container images as well as distributing other OCI artifacts. The service is free for those who want to set up their own public repositories and available for a fee if you want to create private repositories

  1. Click on the perspective switcher at the top of the navigation of the OpenShift console, and select Developer if you aren’t already in that perspective.

  2. You have two projects automatically created.

  3. From the Project dropdown menu, ensure you are using <username>-dev project

  4. In the navigation menu, click +Add.

    project add
  5. On the +Add page, click the Container Image tile.

  6. In the Image name from external registry field, enter:

    quay.io/evanshortiss/rhoam-quarkus-openapi:latest
  7. Change the Runtime icon to Quarkus.

  8. Check the Create a Route to the Application box under Advanced options.

  9. At the end of the form, click Create.

    create quarkus app
    add quarkus app2
  10. This will deploy the application and show the Topology view. The application is represented by the light grey area with a white border. The deployment is a white circle.

    app deployed
  11. Click the Open URL arrow icon on the deployment.

  12. This opens a new browser window that displays the Quarkus application homepage.

    quarkus welcome
  13. Append /q/openapi?format=json to the URL in the address bar to confirm you can access the OpenAPI Spec for the application. Ensure the URL is http and not https.

    quarkus api call

With this, you have successfully deployed this application on OpenShift.

Annotate the Quarkus application for Service Discovery

In this section, we will

  • Add metadata to the previously deployed Quarkus application to make it easily discoverable by OpenShift API Management.

Service Discovery is a 3scale feature that helps you import services from an OpenShift cluster. The Red Hat 3scale API Management instance provided by Red Hat OpenShift API Management has the Service Discovery feature enabled and pre-configured.

  1. Navigate to the Topology View.

  2. Click the Quarkus Deployment that you created in the previous section. A panel will appear on the right.

  3. Select the Resources tab in the panel.

  4. Click rhoam-quarkus-openapi link under the Services heading to load the Service details screen.

    edit label
  5. Use the Edit link beside the Labels heading to add a label with the key and value, and click on Save

    discovery.3scale.net=true
    discovery label
  6. Scroll down and click the Annotations to open the Edit annotations dialog for the Service.

  7. Use the Add more button to add the following key-value pairs:

    annotations dialog
    KEY VALUE

    discovery.3scale.net/description-path

    /q/openapi?format=json

    discovery.3scale.net/port

    8080

    discovery.3scale.net/scheme

    http

  8. Click the Save button after you’ve added the three annotations.