Discover and govern APIs with Service Catalog
Service Catalog allows you to find and centrally view all APIs from these integrations and map them to a Service Catalog service. First, authorize the integrations in Service Catalog for AWS API Gateway, GitHub, and SwaggerHub. Then, create a Service Catalog service and map resources from the integrations to the service. Finally, add a service documentation scorecard to your service to govern API documentation standards.
Prerequisites
Kong Konnect
This is a Konnect tutorial and requires a Konnect personal access token.
-
Create a new personal access token by opening the Konnect PAT page and selecting Generate Token.
-
Export your token to an environment variable:
export KONNECT_TOKEN='YOUR_KONNECT_PAT'
Copied! -
Run the quickstart script to automatically provision a Control Plane and Data Plane, and configure your environment:
curl -Ls https://get.konghq.com/quickstart | bash -s -- -k $KONNECT_TOKEN --deck-output
Copied!This sets up a Konnect Control Plane named
quickstart
, provisions a local Data Plane, and prints out the following environment variable exports:export DECK_KONNECT_TOKEN=$KONNECT_TOKEN export DECK_KONNECT_CONTROL_PLANE_NAME=quickstart export KONNECT_CONTROL_PLANE_URL=https://us.api.konghq.com export KONNECT_PROXY_URL='http://localhost:8000'
Copied!Copy and paste these into your terminal to configure your session.
Kong Gateway running
This tutorial requires Kong Gateway Enterprise. If you don’t have Kong Gateway set up yet, you can use the quickstart script with an enterprise license to get an instance of Kong Gateway running almost instantly.
-
Export your license to an environment variable:
export KONG_LICENSE_DATA='LICENSE-CONTENTS-GO-HERE'
Copied! -
Run the quickstart script:
curl -Ls https://get.konghq.com/quickstart | bash -s -- -e KONG_LICENSE_DATA
Copied!Once Kong Gateway is ready, you will see the following message:
Kong Gateway Ready
decK v1.43+
decK is a CLI tool for managing Kong Gateway declaratively with state files. To complete this tutorial, install decK version 1.43 or later.
This guide uses deck gateway apply
, which directly applies entity configuration to your Gateway instance.
We recommend upgrading your decK installation to take advantage of this tool.
You can check your current decK version with deck version
.
Konnect roles
To configure Service Catalog integrations, services, and scorecards, you need the following roles in Konnect:
- Integration Admin
- Scorecard Admin
- Service Admin
AWS API Gateway
You need a REST API in AWS API Gateway to ingest and a correctly configured IAM role for this integration. You can name your AWS API Gateway API whatever you’d like. In this tutorial, we’ll refer to your AWS API Gateway API as aws-api
.
You can follow the setup instructions in the UI wizard when you add the AWS API Gateway instance or do the following:
SwaggerHub
You must have a SwaggerHub API key to authenticate your SwaggerHub account with Konnect.
Additionally, you’ll need an API version in SwaggerHub to pull into Konnect as a resource. You can name your SwaggerHub API version whatever you’d like. In this tutorial, we’ll refer to your SwaggerHub API version as swaggerhub-api
.
GitHub
To integrate GitHub with Service Catalog, you need the following:
- Sufficient permissions in GitHub to authorize third-party applications and install the Konnect GitHub App
- A GitHub organization
- A repository that you want to pull in to Konnect. You can grant access to either all repositories or selected repositories during the authorization process. You can name your GitHub repository whatever you’d like. In this tutorial, we’ll refer to your GitHub repository as
github-repo
.
The Konnect app can be managed in your GitHub account under Applications > GitHub Apps.
Configure the AWS API Gateway, GitHub, and SwaggerHub integrations
In this tutorial, we’ll be discovering APIs and API specs from AWS API Gateway, GitHub, and SwaggerHub in Service Catalog. Service Catalog allows you to find and centrally view all APIs from these integrations and map them to a Service Catalog service.
Before you can discover APIs in Service Catalog, you must configure the third-party integrations.
Configure the AWS API Gateway integration
- In the Konnect sidebar, click Service Catalog.
- In the Service Catalog sidebar, click Integrations.
- Click AWS API Gateway.
- Click Add AWS API Gateway instance.
- From the AWS region dropdown, select “US East (Ohio)”. If you’re using a different region, select your region from the dropdown.
- In the IAM role ARN field, enter the IAM role you configured for Service Catalog.
- In the Display name field, enter
aws-api-gateway-test
. - In the Instance name field, enter
aws-api-gateway-test
. - Click Save.
Configure the GitHub integration
- In the Konnect sidebar, click Service Catalog.
- In the Service Catalog sidebar, click Integrations.
- Click GitHub.
- Click Add GitHub Instance.
- Click Authorize in GitHub. This will take you to GitHub, where you can grant Konnect access to either All Repositories or Select repositories.
- In the Display name field, enter
GitHub-test
. - In the Instance name field, enter
github-test
. - Click Save.
The Konnect application can be managed from GitHub as a GitHub Application.
Configure the SwaggerHub integration
- In the Konnect sidebar, click Service Catalog.
- In the Service Catalog sidebar, click Integrations.
- Click Add SwaggerHub Instance.
- In the SwaggerHub API Key field, enter your SwaggerHub API key. For example:
04403e83-1a66-4366-9f08-7cecaba73e20
. - In the Display name field, enter
SwaggerHub-test
. - In the Instance name field, enter
swaggerhub-test
. - Click Save.
Create a Service Catalog service and map the API resources
Now that your integrations are configured, you can create a Service Catalog service to map the ingested APIs.
In this tutorial, we’ll refer to your ingested resources like the following:
- AWS API Gateway API:
aws-api
- GitHub repository:
github-repo
- SwaggerHub API version:
swaggerhub-api
- In the Konnect sidebar, click Service Catalog.
- Click New service.
- In the Display Name field, enter
APIs
. - In the Name field, enter
apis
. - Click Create.
- Click Map Resources.
- Select
swaggerhub-api
. - Select
aws-api
. - Select
github-repo
. - Click Map 3 Resources.
Your integration APIs are now discoverable from one Service Catalog service.
Govern the APIs with scorecards
Now that you’ve discovered and mapped the APIs to a Service Catalog service, you can govern the service documentation of these ingested APIs with a scorecard. The built-in service documentation scorecard will alert you when your APIs don’t adhere to API documentation best practices.
- In the Konnect sidebar, click Service Catalog.
- In the Service Catalog sidebar, click Scorecards.
- Click New scorecard.
- From the Scorecard template dropdown menu, select “Service Documentation”.
- In the Services settings, select Custom selection.
- In the Custom selection dropdown menu, select “APIs”.
- Click Create.
- Click the Criteria tab.
You’ll see the score for your service, how many APIs have documentation, specs, and are passing the linting rulesets.