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:
- Navigate to the Topology View in your Developer Sandbox.
- Click on the Quarkus application that you created in the previous section. A panel will appear on the right.
- Select the Resources tab in the panel.
- Click the rhoam-quarkus-openapi link under the Services heading (Figure 3) to load the Service details screen.
- Use the Edit link beside the Labels heading (Figure 4) to add a label discovery.3scale.net=true. Click Save (Figure 5).
- Scroll down and click the Annotations to open the Edit annotations dialog for the Service.
- 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 |
- 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.