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 intoApr 26, 2023
Merged
Conversation
tzununbekov
suggested changes
Apr 25, 2023
tzununbekov
left a comment
Member
There was a problem hiding this comment.
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,
}
}
tzununbekov
approved these changes
Apr 26, 2023
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HTTPTargetneeds to be provided aio.triggermesh.http.requestevent 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.