-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show subscriptions to event types in Backstage #24
Show subscriptions to event types in Backstage #24
Conversation
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
@aliok: The label(s) In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
// TODO: we don't handle the CESQL yet | ||
if trigger.Spec.Filter != nil && len(trigger.Spec.Filter.Attributes) > 0 { | ||
// check if "type" attribute is present | ||
if subscribedEventType, ok := trigger.Spec.Filter.Attributes["type"]; ok { | ||
// it can be present but empty | ||
// in that case, we assume the trigger is subscribed to all event types | ||
if subscribedEventType != eventingv1.TriggerAnyFilter { | ||
// if type is present and not empty, that means the trigger is subscribed to a specific event type | ||
return []string{subscribedEventType} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/knative/eventing/blob/main/pkg/eventfilter/subscriptionsapi/
https://github.com/knative/eventing/blob/main/pkg/eventfilter/attributes/
subscriptionsapi.NewAllFilter(...)
attributes.NewFilter()
Example:
# trigger filter
random: foo
# Event type spec
spec:
attributes:
random:
type: string
e := cloudevents.NewEvent()
e.SetExtension("random", <random-string>)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
7702ca0
to
810cf78
Compare
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
There are linting errors |
LGTM |
Signed-off-by: Ali Ok <[email protected]>
Signed-off-by: Ali Ok <[email protected]>
775c64a
to
182c98a
Compare
Signed-off-by: Ali Ok <[email protected]>
Screenshots for this setup:
ComponentsAlready 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 Event typesEvent type detail view
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[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:
Approvers can indicate their approval by writing |
Changes
(see release note below for more details)
Backend:
Plugin:
Show subscriptions to event types in Backstage
Entity providers cannot create the
ApiConsumedBy
relationship from the API entity side. Created aprocessor
for that reason.Diagram: https://gist.github.com/aliok/45d80cb82822142dd6a978c9cc44e12e
Fixes #20
Release Note