Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Runtime Conditions backend plugin

The backend half of the [Runtime Conditions Backstage plugin](https://github.com/runtimeconditions/backstage-plugin).

A Runtime Conditions Profile lists what a workload needs at runtime, for example a database or a queue. Platform adapters set up those needs in each environment. This plugin gives the adapters one place to report what they set up: which resources fulfill which condition, in which environment. The frontend plugin, [@runtimeconditions/plugin-runtime-conditions](https://www.npmjs.com/package/@runtimeconditions/plugin-runtime-conditions), then shows those resources on the Component's **Runtime Conditions** tab.

You only need this plugin if adapters will report fulfillments. The frontend plugin works without it and then shows no fulfillments.

## Install

```sh
yarn --cwd packages/backend add @runtimeconditions/plugin-runtime-conditions-backend
```

In `packages/backend/src/index.ts`:

```ts
backend.add(import('@runtimeconditions/plugin-runtime-conditions-backend'));
```

## API

The plugin adds two routes under `/api/runtime-conditions`:

| Route | What it does |
| --- | --- |
| `POST /fulfillments` | An adapter reports the resources that fulfill one condition in one environment. A report is added and never replaces an earlier one. |
| `GET /fulfillments` | Lists the reports. Filter with `?profileName=` and `?condition=`. |

A report looks like this:

```json
{
"profileName": "orders-api",
"condition": "orders-database",
"environment": "production",
"resources": [
{ "kind": "database", "provider": "aws-rds", "reference": "arn:aws:rds:us-east-1:123456789012:db:orders" }
]
}
```

The full request and response shapes are in the [fulfillment API docs](https://github.com/runtimeconditions/backstage-plugin/blob/main/docs/fulfillment-api.md). Every [GitHub release](https://github.com/runtimeconditions/backstage-plugin/releases) also has the generated `openapi.yaml`.

## Good to know

Reports are kept in memory for now, so they are lost when the backend restarts. Adapters should report again after a restart. Storing them durably is tracked in [issue #26](https://github.com/runtimeconditions/backstage-plugin/issues/26).

## License

MIT
8 changes: 8 additions & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"name": "@runtimeconditions/plugin-runtime-conditions-backend",
"version": "0.1.0",
"description": "Backstage backend plugin for Runtime Conditions. Platform adapters report here which resources fulfill a workload's conditions, and the frontend plugin shows them.",
"keywords": [
"backstage",
"backstage-plugin",
"backstage-backend-plugin",
"runtime-conditions",
"platform-engineering"
],
"license": "MIT",
"repository": {
"type": "git",
Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"name": "@runtimeconditions/plugin-runtime-conditions",
"version": "0.1.0",
"description": "Backstage plugin that shows a Component's Runtime Conditions Profiles: what the workload needs at runtime, in each cluster, and which resources fulfill each need.",
"keywords": [
"backstage",
"backstage-plugin",
"runtime-conditions",
"platform-engineering"
],
"license": "MIT",
"repository": {
"type": "git",
Expand Down
Loading