Prepare your Quarkus API for Service discovery

Service Discovery is a feature used by Red Hat OpenShift API Management to import services running in the OpenShift cluster into your API Management portal. When Service Discovery is configured, OpenShift API Management can discover API services that are annotated for Service Discovery running in the same OpenShift cluster and automatically imports the associated API definitions.

 Additionally, OpenShift API Management  can update the API integration and its specification, based on OpenAPI Specification (OAS), to resynchronize them with the cluster. OAS used to be called Swagger, a name that still turns up in the interface.

You have to apply some labels and annotations to the Quarkus-based API you deployed in the previous step  before OpenShift API Management will be able to find it via the Service Discovery feature. Do this task as follows:

  1. Navigate to the Topology View in your Developer Sandbox.
  2. Click on the Quarkus application that you created in the previous section. A panel will appear on the right.
  3. Select the Resources tab in the panel.
  4. Click the rhoam-quarkus-openapi link under the Services heading (Figure 3) to load the Service details screen.
Figure 3: Click on rhoam-quarkus-openapi link under Services.

 

  1. Use the Edit link beside the Labels heading (Figure 4) to add a label discovery.3scale.net=true. Click Save (Figure 5).

 

Figure 4: Click Edit under Labels.

 

Figure 5: Add a new label, discovery.3scale.net=true, and save the label.

 

  1. Scroll down and click the Annotations to open the Edit annotations dialog for the Service.
  2. Use the Add more button to add the following key-value pairs (Figure 6):

Key

value

discovery.3scale.net/description-path /q/openapi?format=json
discovery.3scale.net/port 8080
discovery.3scale.net/scheme http

 

Figure 6: Add the three new annotations.

 

  1. Click the Save button after you've added the three annotations.


These labels and annotations will be used by Service Discovery to import and configure your API. For example, Service Discovery will read the OpenAPI Specification from your Quarkus application at /q/openapi?format=json via HTTP on port 8080 during the import process.