Automatic Service Ingestion
Aside from adding components manually via UI, importing from 3rd-party providers, or managing via API, FireHydrant also provides a service ingestion process to automate synchronizing your Service Catalog.
After you set up service ingestion as described below, FireHydrant will search for and ingest updates to your YAML file every hour. You can also manually force an update.
Prerequisites
FireHydrant currently supports two methods of automatic service ingestion:
- Reading a YAML file from your repository to ingest new services automatically. To do this, you must first have GitHub integration with FireHydrant configured.
- Via API. If done via API, you will need:
- An API Key
- An external system or mechanism that will make API calls to FireHydrant with service catalog data in the appropriate format
via Repository YAML
To get started:
- Click on Catalog in the navigation at the top and then go to Catalog settings on the left.
- Click + Create catalog setting to add service ingestion details.
- On this page, fill in details about the new ingestion mechanism:
- Name - A name for this ingestion
- Description - A description, if desired
- Provider - Choose GitHub here. The other option is API Only, which you can learn about here.
- Format - The format of the YAML file. At this time, FireHydrant supports Backstage, effx, and Opslevel formats.
- Once you've picked GitHub as the provider, an additional section, Targets, will appear below with the following fields for each target:
- Type - Either GitHub or GitHubScan. Choose GitHub if you want to read a single YAML file from a single repository or GitHubScan if you want to read a YAML file from multiple repositories. Usually, Backstage users will use GitHub, while Opslevel users will use GitHubScan.
- Repository/Repositories (GitHub and GitHubScan) - The repository (for GitHub) or repositories (GitHubScan) from which to read the YAML file(s).
- Reference (GitHub only) - The name of a specific branch or SHA of a commit from which to read the YAML file.
- Path (GitHub and GitHubScan) - The file path within the repository/repositories for the YAML.
- If necessary, add more targets and repeat step #4 above.
- Click "Create setting."
After you configure these settings, FireHydrant ingests your services according to the YAMLs you've specified. After completing the process, you can view your ingested services from the Services subpage in the FireHydrant UI.
via API
FireHydrant has a robust API through which most operations within FireHydrant are possible. This method enables you to make webhook calls to an endpoint that accepts body data in the same formats as above.
To reiterate, there are two prerequisites:
- You need an API key to make API calls to FireHydrant
- This method relies on an external system that will make API calls to FireHydrant to send catalog data
If the above prerequisites are met, then you can configure this with the following steps:
- Click on Catalog in the navigation at the top and then go to Catalog settings on the left.
- Click + Create catalog setting to add service ingestion details.
- On this page, fill in the following details:
- Name - A name for this ingestion
- Description - A description, if desired
- Provider - Choose "API Only" here. The other option is GitHub, which was covered in the previous section.
- Format - The data format that will be sent to FireHydrant. At this time, FireHydrant supports Backstage, effx, and Opslevel formats.
- Click Create setting.
- Next, you are returned to the Catalog settings page. The catalog you just added will appear in the list on this page - click on it to return to this catalog setting's page, where you can see the API endpoint for posting your data. Copy this API endpoint.
- Make API requests to this endpoint at recurring intervals to keep the FireHydrant catalog up-to-date. You can base your cURL request for service ingestion on the following example. Note that this example uses a Backstage Component definition. To send OpsLevel or effx formats, change your request format accordingly.
curl --location --request POST 'https://api.firehydrant.io/v1/catalogs/<CATALOG ID>/ingest' \
--header 'Authorization: Bearer <YOUR BEARER TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"encoding": "application/json",
"data": {
"apiVersion": "backstage.io/v1alpha1",
"kind": "Component",
"metadata": {
"namespace": "Spongebob",
"name": "Component Service",
"description": "I am a Backstage service component",
"annotations": {
"pagerduty.com/service-id": "EXAMPLE",
"backstage.io/source-location": "url:https://github.com/octocat/Hello-World"
},
"labels": {
"third-party": "true"
}
},
"spec": {
"type": "service",
"lifecycle": "experimental",
"owner": "team-name",
"system": "whats-a-system",
"links": [
{
"url": "https://admin.example-org.com/",
"title": "Admin Dashboard",
"icon": "dashboard"
}
]
}
}
}'
Editing or updating service details
Any service details defined in the .yaml
file or sent in via API will be controlled via those means. This is to maintain a source of truth for your Service Catalog. Fields you can edit from within the FireHydrant UI contain information specific to FireHydrant behavior and cannot be defined externally in the .yaml
file or in the API request body.
Updated 10 months ago