Catalog Backend Module for GCP
This is an extension module to the plugin-catalog-backend plugin, providing extensions targeted at GCP.
Getting started
You will have to add the provider in the catalog initialization code of your
backend. They are not installed by default, therefore you have to add a
dependency on @backtostage/plugin-catalog-backend-module-gcp
to your backend
package.
# From your Backstage root directory
yarn add --cwd packages/backend @backtostage/plugin-catalog-backend-module-gcp
Cloud SQL - GoogleSQLDatabaseEntityProvider
And then add the entity provider to your catalog builder:
import { GoogleSQLDatabaseEntityProvider } from '@backtostage/plugin-catalog-backend-module-gcp'
export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
const builder = await CatalogBuilder.create(env);
builder.addEntityProvider(
GoogleSQLDatabaseEntityProvider.fromConfig({
config: env.config,
logger: env.logger,
// optional: alternatively, use scheduler with schedule defined in app-config.yaml
schedule: env.scheduler.createScheduledTaskRunner({
frequency: { minutes: 30 },
timeout: { minutes: 3 },
}),
// optional: alternatively, use schedule
scheduler: env.scheduler,
}),
);
// ..
}
Configuration
To use this provider, you'll need a Google Service Account.
Once generated, store the path to this file in the GOOGLE_APPLICATION_CREDENTIALS
environment variable.
You can find more details about this in the official docs
Then you can add a gcp
config to the catalog providers configuration:
catalog:
providers:
gcp:
# the project id need to be the GCP Project where your Resources are present
- project: my-gcp-project-id
ownerLabel: team # string
componentLabel: app # string
cloudsql:
resourceType: SQL # string
schedule: # optional; same options as in TaskScheduleDefinition
# supports cron, ISO duration, "human duration" as used in code
frequency: { minutes: 30 }
# supports ISO duration, "human duration" as used in code
timeout: { minutes: 3 }
This provider supports multiple projects using different configurations.
-
project
(required): Project ID of the project for which to list Cloud SQL instances. -
ownerLabel
(optional):- Default:
owner
. - The provider will look for user defined labels to find the Resource Owner.
- You can provide the label name where the owner name is present, if the label isn't present the owner will be set
unknown
.
- Default:
-
componentLabel
(optional):- Default:
component
. - The provider will look for user defined labels to find the Resource dependencyOf.
- You can provide the label name where the component name is present, if the label isn't present
dependencyOf
will be skipped.
- Default:
-
cloudsql
(optional):-
resourceType
(optional):- Default:
CloudSQL
. - The provider will set the
type
based in this information.
- Default:
-
-
schedule
(optional):-
frequency
: How often you want the task to run. The system does its best to avoid overlapping invocations. -
timeout
: The maximum amount of time that a single task invocation can take. -
initialDelay
(optional): The amount of time that should pass before the first invocation happens. -
scope
(optional):'global'
or'local'
. Sets the scope of concurrency control.
-