-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up TODOs and improve instructions (#18)
* Clean up TODOs and improve instructions Signed-off-by: Ali Ok <[email protected]> * Move instructions to the NPM package readme Signed-off-by: Ali Ok <[email protected]> * Fix the tests Signed-off-by: Ali Ok <[email protected]> --------- Signed-off-by: Ali Ok <[email protected]>
- Loading branch information
Showing
13 changed files
with
122 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,6 @@ rules: | |
resources: | ||
- brokers | ||
- eventtypes | ||
# TODO: - triggers | ||
verbs: | ||
- get | ||
- list | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,99 @@ | ||
# knative-event-mesh | ||
# Knative Event Mesh plugin | ||
|
||
Welcome to the knative-event-mesh backend plugin! | ||
The Event Mesh plugin is a Backstage plugin that allows you to view and manage Knative Eventing resources. | ||
|
||
_This plugin was created through the Backstage CLI_ | ||
The Backstage plugin talks to a special backend that runs in the Kubernetes cluster and communicates with the Kubernetes | ||
API server. | ||
|
||
## Getting started | ||
## Installation | ||
|
||
Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn | ||
start` in the root directory, and then navigating to [/knative-event-mesh](http://localhost:3000/knative-event-mesh). | ||
Install the backend and the relevant configuration in the Kubernetes cluster | ||
|
||
You can also serve the plugin in isolation by running `yarn start` in the plugin directory. | ||
This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads. | ||
It is only meant for local development, and the setup for it can be found inside the [/dev](/dev) directory. | ||
```bash | ||
kubectl apply -f https://github.com/knative-extensions/backstage-plugins/releases/download/v0.1.0/eventmesh.yaml | ||
``` | ||
|
||
In your Backstage directory, run the following command to install the plugin: | ||
|
||
```bash | ||
yarn workspace backend add @knative-extensions/plugin-knative-event-mesh-backend | ||
``` | ||
|
||
## Configuration | ||
|
||
> **NOTE**: The backend needs to be accessible from the Backstage instance. If you are running the backend without | ||
> exposing it, you can use `kubectl port-forward` to forward the port of the backend service to your local machine. | ||
> ```bash | ||
> kubectl port-forward -n knative-eventing svc/eventmesh-backend 8080:8080 | ||
> ``` | ||
The plugin needs to be configured to talk to the backend. It can be configured in the `app-config.yaml` file of the | ||
Backstage instance and allows configuration of one or multiple providers. | ||
Use a `knativeEventMesh` marker to start configuring the `app-config.yaml` file of Backstage: | ||
```yaml | ||
catalog: | ||
providers: | ||
knativeEventMesh: | ||
dev: | ||
baseUrl: 'http://localhost:8080' # URL of the backend installed in the cluster | ||
schedule: # optional; same options as in TaskScheduleDefinition | ||
# supports cron, ISO duration, "human duration" as used in code | ||
frequency: { minutes: 1 } | ||
# supports ISO duration, "human duration" as used in code | ||
timeout: { minutes: 1 } | ||
``` | ||
Configure the scheduler for the entity provider. Add the following code to `packages/backend/src/plugins/catalog.ts` | ||
file: | ||
In file `packages/backend/src/plugins/catalog.ts`: | ||
```ts | ||
import {KnativeEventMeshProvider} from '@knative-extensions/plugin-knative-event-mesh-backend'; | ||
export default async function createPlugin( | ||
env:PluginEnvironment, | ||
):Promise<Router> { | ||
const builder = await CatalogBuilder.create(env); | ||
/* ... other processors and/or providers ... */ | ||
// ADD THIS | ||
builder.addEntityProvider( | ||
KnativeEventMeshProvider.fromConfig(env.config, { | ||
logger: env.logger, | ||
scheduler: env.scheduler, | ||
}), | ||
); | ||
/* ... other processors and/or providers ... */ | ||
const {processingEngine, router} = await builder.build(); | ||
await processingEngine.start(); | ||
return router; | ||
} | ||
``` | ||
> **NOTE**: If you have made any changes to the schedule in the `app-config.yaml` file, then restart to apply the | ||
> changes. | ||
## Troubleshooting | ||
When you start your Backstage application, you can see some log lines as follows: | ||
```text | ||
[1] 2024-01-04T09:38:08.707Z knative-event-mesh-backend info Found 1 knative event mesh provider configs with ids: dev type=plugin | ||
``` | ||
## Usage | ||
The plugin will register a few entities in the Backstage catalog. | ||
Screenshots: | ||
- ![Event Mesh plugin](./event-mesh-plugin-components-view.png) | ||
- ![Event Mesh plugin](./event-mesh-plugin-apis-view.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.