Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

HTTPTarget arbitrary CE support#1397

Merged
odacremolbap merged 2 commits into
triggermesh:mainfrom
odacremolbap:task/support-arbitrary-cloudevents-http-target
Apr 26, 2023
Merged

HTTPTarget arbitrary CE support#1397
odacremolbap merged 2 commits into
triggermesh:mainfrom
odacremolbap:task/support-arbitrary-cloudevents-http-target

Conversation

@odacremolbap

Copy link
Copy Markdown
Member

HTTPTarget needs to be provided a io.triggermesh.http.request event type to work. We have had users trying to use it with arbitrary CloudEvents payloads expecting the target to fulfill a request to an external endpoint that uses de CloudEvent data as the body.

This PR adds support for that scenario.

@odacremolbap odacremolbap self-assigned this Apr 25, 2023
@odacremolbap odacremolbap requested a review from a team April 25, 2023 13:59

@tzununbekov tzununbekov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the component's CRD and lifecycle to reflect that it works with both predefined io.triggermesh.http.request and arbitrary event formats:

diff --git a/config/301-httptarget.yaml b/config/301-httptarget.yaml
index 39029db3..5086d1f8 100644
--- a/config/301-httptarget.yaml
+++ b/config/301-httptarget.yaml
@@ -26,7 +26,8 @@ metadata:
         {
           "type": "io.triggermesh.http.request",
           "schema": "https://raw.githubusercontent.com/triggermesh/triggermesh/main/schemas/io.triggermesh.http.request.json"
-        }
+        },
+        { "type": "*" }
       ]
     registry.knative.dev/eventTypes: |
       [
diff --git a/pkg/apis/targets/v1alpha1/http_lifecycle.go b/pkg/apis/targets/v1alpha1/http_lifecycle.go
index 4c3aa76d..b705e498 100644
--- a/pkg/apis/targets/v1alpha1/http_lifecycle.go
+++ b/pkg/apis/targets/v1alpha1/http_lifecycle.go
@@ -72,6 +72,7 @@ func (t *HTTPTarget) Validate(ctx context.Context) *apis.FieldError {
 func (*HTTPTarget) AcceptedEventTypes() []string {
        return []string{
                EventTypeHTTPTargetRequest,
+               EventTypeWildcard,
        }
 }

@odacremolbap odacremolbap merged commit 33026a0 into triggermesh:main Apr 26, 2023
@odacremolbap odacremolbap deleted the task/support-arbitrary-cloudevents-http-target branch May 5, 2023 07:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants