knative-extensions / backstage-plugins

Knative plugins for Backstage.
Apache License 2.0
3 stars 17 forks source link

Show subscriptions to event types in Backstage #24

Closed aliok closed 5 months ago

aliok commented 5 months ago

Changes

(see release note below for more details)

Backend:

Plugin:

Fixes #20

Release Note

Knative event mesh plugin will now show the subscribers of the event types.

It will show this relation if the subscriber is already registered in the Backstage catalog.

Limitations:
- Only the subscriptions via Brokers and Triggers are supported.
- Finding consumers via CloudEvents SQL is not supported yet. See https://github.com/knative-extensions/backstage-plugins/issues/26.
- Relation will only show if the component registered can be matched using the [`backstage.io/kubernetes-id ` label](https://backstage.io/docs/features/kubernetes/configuration#common-backstageiokubernetes-id-label). 
- Finding consumers via [label selectors](https://backstage.io/docs/features/kubernetes/configuration#label-selector-query-annotation) is not supported yet. See https://github.com/knative-extensions/backstage-plugins/issues/30.
- [`backstage.io/kubernetes-namespace` annotation](https://backstage.io/docs/features/kubernetes/configuration#common-backstageiokubernetes-id-label) is currently ignored. See https://github.com/knative-extensions/backstage-plugins/issues/29.
- When trying to match the consumers of eventTypes on Backstage side, pagination is not handled yet. See https://github.com/knative-extensions/backstage-plugins/issues/28.
knative-prow[bot] commented 5 months ago

@aliok: The label(s) kind/<kind> cannot be applied, because the repository doesn't have them.

In response to [this](https://github.com/knative-extensions/backstage-plugins/pull/24): > > > > ># Changes > > > >- Show subscriptions to event types in Backstage (see release note below for more) >- Diagram: https://gist.github.com/aliok/45d80cb82822142dd6a978c9cc44e12e >- WIP PR created for early feedback: > - My efforts to use the subscriber information in the Backstage plugin failed as entity providers cannot create the `ApiConsumedBy` relationship from the API entity side. It needs to be set on the `Component` entity side. This entity cannot be reached in a provider. > - There are missing tests for the backend. Similarly, there are some linting issues. > > >/kind > > >Fixes # > > > >**Release Note** > > >```release-note >Knative event mesh plugin will now show the subscribers of the event types. > >It will show this relation if the subscriber is already registered in the Backstage catalog. >Only the subscriptions via Brokers and Triggers are supported. CloudEvents SQL is not supported yet. >``` > >**Docs** > > >```docs > >``` > Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
pierDipi commented 5 months ago

There are linting errors

pierDipi commented 5 months ago

LGTM

aliok commented 5 months ago

Screenshots for this setup:

Components

Already registered on Backstage:

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: payment-processor
  annotations:
    backstage.io/kubernetes-id: payment-processor
spec:
  lifecycle: production
  owner: guests
  type: service
---
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: payment-event-generator-source
  annotations:
    backstage.io/kubernetes-id: payment-event-generator-source
spec:
  lifecycle: production
  owner: guests
  type: service
---
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: fraud-detector
  annotations:
    backstage.io/kubernetes-id: fraud-detector
spec:
  lifecycle: production
  owner: guests
  type: service
---
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: fraud-logger
  annotations:
    backstage.io/kubernetes-id: fraud-logger
spec:
  lifecycle: production
  owner: guests
  type: service
---
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: all-events-logger
  annotations:
    backstage.io/kubernetes-id: all-events-logger
spec:
  lifecycle: production
  owner: guests
  type: service

Screenshot 2024-02-07 at 11 20 50

Event types

Screenshot 2024-02-07 at 11 21 03

Event type detail view

Screenshot 2024-02-07 at 11 21 32

all-events-logger component graph

Screenshot 2024-02-07 at 11 22 19

knative-prow[bot] commented 5 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aliok, pierDipi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/knative-extensions/backstage-plugins/blob/main/OWNERS)~~ [aliok,pierDipi] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment