As a developer of applications and services, you can use OpenShift Service Registry to create and set up Service Registry instances and connect your applications and services to these instances. OpenShift Service Registry is a managed cloud service that enables you to manage schema and API definitions in your applications without having to install, configure, run, and maintain your own Service Registry clusters.
For more overview information, see the OpenShift Service Registry user documentation.
Use the OpenShift Service Registry web console to create and configure a Service Registry instance for your applications or services. A Service Registry instance is an isolated virtual tenant in a multi-tenanted deployment with its own unique instance URL and configuration to connect to producer and consumer applications.
-
You’re logged in to the Service Registry web console at https://console.redhat.com/application-services/service-registry/.
-
In the Service Registry web console, click Create Service Registry instance.
-
Enter a unique Instance name, such as
my-service-registry-instance
. -
Click Create to start the creation process for your Service Registry instance. The new Service Registry instance is listed on the Service Registry Instances page.
-
When the Status is Ready, you can start using this Service Registry instance. You can use the options icon (three vertical dots) to connect to or delete the instance as needed.
Note
|
You can see all Service Registry instances created by other users in your organization, but you might not have permission to connect to those instances. Only instance owners or users with permission can connect to the instance, access associated service accounts, or delete the instance. |
-
Verify that the new Service Registry instance is listed on the Service Registry Instances page.
-
Verify that the state of the new Service Registry instance is shown as Ready.
After you create a Service Registry instance, you can upload schema or API content to the instance. The following examples show how to upload a simple Apache Avro schema file for serializing and deserializing Kafka messages in client applications, and how to upload the Petstore sample API from an HTTPS URL.
Note
|
Uploading an artifact from an HTTP URL is not supported for security reasons. |
-
You’ve created a Service Registry instance and the instance is in Ready state.
-
On the Service Registry Instances page of the web console, select the Service Registry instance that you want to upload the artifact to.
-
Click Upload artifact and complete the form to define the artifact details:
-
Group: Enter an optional unique group name such as
my-org
to organize the artifact in a named collection. Each group contains a logically related set of schemas or API designs, typically managed by a single entity, belonging to a particular application or organization.NoteSpecifying a group is optional when using the web console, and a default
group is automatically created. -
ID: Enter an optional unique ID for this artifact such as
my-ID
. If you do not specify a unique artifact ID, Service Registry generates one automatically as a UUID. -
Type: Use the default Auto-Detect setting to automatically detect the artifact type, or select the artifact type from the list, for example, Avro Schema or OpenAPI.
-
Artifact: Specify the artifact location using either of the following options:
-
From file: Click Browse, and select a file, or drag and drop a file. Alternatively, enter the file contents in the text box. For example, copy and paste the following simple Avro schema:
{ "type": "record", "namespace": "com.example", "name": "FullName", "fields": [ { "name": "first", "type": "string" }, { "name": "last", "type": "string" } ] }
-
From URL: Enter a valid and accessible HTTPS URL, and click Fetch. For example:
https://petstore3.swagger.io/api/v3/openapi.json
.
-
-
-
Click Upload to complete the operation and display the new artifact details:
-
Overview tab:
-
Version metadata: Displays details such as the artifact name, artifact ID, global ID, content ID, labels, properties, and so on.
-
Content rules: Displays artifact content rules that you can enable and configure. You can configure a Validity rule or Compatibility rule by enabling the rule and then selecting the appropriate rule configuration from the list. For details on supported rules, see Supported Service Registry content and rules.
-
-
Documentation tab: (OpenAPI or AsyncAPI only): Displays automatically-generated REST API documentation.
-
Content tab: Displays a read-only view of the full artifact content.
You can now use this schema or API artifact with your client applications.
-
-
You can click Upload new version to add a new artifact version.
-
You can click Delete to delete an artifact as needed.
ImportantDeleting an artifact deletes the artifact and all of its versions, and cannot be undone. -
To show the list of artifacts on the Artifacts tab, click the instance-name breadcrumb.
-
Verify that the new artifact is listed on the Artifacts tab.
To connect your applications or services to a Service Registry instance in the web console, you must copy and save the Service Registry instance URL, create a service account, and copy and save the generated credentials. You’ll use these details later when you configure your application for Service Registry.
-
You’ve created a Service Registry instance and the instance is in Ready state.
-
On the Service Registry Instances page of the web console, for the instance that you want to connect to, select the options icon (three vertical dots), and click Connection.
-
Depending on the client libraries that you want to use, choose the API for your needs:
-
Core Registry API is the most powerful API and works with Apicurio client libraries.
-
Schema Registry compatibility API provides compatibility with the Confluent Schema Registry API.
-
CNCF Schema Registry API provides compatibility with the CNCF specification.
-
-
On the Connection page, copy the Core Registry API URL, or one of the other API URLs if you are using a different client, to a secure location. You’ll use this server endpoint to connect to this Service Registry instance.
The remainder of this section describes how to create a service account and copy the generated credentials. If you want to use the credentials of an existing service account, you can skip to the next section.
-
Under Service Accounts, click Create service account to generate the credentials that you can use to connect applications to Service Registry and Kafka instances.
-
Copy the generated Client ID and Client secret to a secure location.
ImportantThe generated credentials are displayed only one time. Ensure that you’ve successfully and securely saved the copied credentials before closing the credentials window. -
After you save the generated credentials to a secure location, select the confirmation check box in the credentials window and close the window.
-
For the Authentication method, copy the OAuth Token endpoint URL to a secure location. You’ll use this endpoint with your service account credentials to authenticate the connection to this Service Registry instance.
NoteHTTP Basic authentication is also available for tools and libraries that don’t support OAuth, but OAuth is recommended whenever possible. With HTTP Basic, you use only the service account credentials to authenticate the connection to the Service Registry instance. You’ll use the service account information that you saved to configure your applications to connect to your Service Registry instances later when you’re ready.
For example, if you plan to use kcat to interact with your Kafka instance and deserialize Avro messages using Service Registry, you’ll use this information to set your Service Registry URL in the client environment variables.
To review your service account information, reset your credentials, or delete the service account, use the left navigation menu to go to the Service Accounts page.
-
Verify that the Service Registry instance URL is saved to a secure location.
-
Verify that the client credentials are saved to a secure location.
-
Verify that your service account was successfully created on the Service Accounts page.
After you create a service account for applications to connect to a Service Registry instance, you must also set the appropriate level of access for the new account on the Access tab of the Service Registry instance. Service Registry uses role-based access to enable you to manage how other user accounts and service accounts can interact with the Service Registry instance that you create.
-
You’ve created a Service Registry instance and the instance is in Ready state.
-
You’ve created a service account that you want to allow to access the running Service Registry instance.
-
On the Service Registry Instances page of the web console, click the name of the Service Registry instance that you want the service account to access.
-
Click the Access tab to view the accounts and roles already assigned for this instance.
-
Click Grant access to assign a role to the service account.
-
In the Account field, select or enter the service account name that you want to assign the role to.
-
Select the Role that you want to assign to the account, for example, Manager for write access to this instance.
-
Click Save to finish.
-
Verify that the new role for the service account is listed on the Access page of the Service Registry instance.