-
Notifications
You must be signed in to change notification settings - Fork 408
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
Add Event-Gateway component #182
Add Event-Gateway component #182
Conversation
components/event-gateway/README.md
Outdated
|
||
The Event-Gateway has the following parameters: | ||
- **externalAPIPort** - This port exposes the Event-Gateway API to an external solution. The default port is `8081`. | ||
- **eventsTargetURL** - A URL to which you proxy the incoming Events. The default URL is http://localhost:9000. |
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.
The default URL is `http://localhost:9000`.
What is the relation of this PR to #166 ? |
a211ae5
to
27167a3
Compare
@klaudiagrz I split the PR #166 into two PRs:
Please note that, first we need to merge this PR #182, and then we will work on PR #166 (which is now labeled as |
Ok, thanks for explanation :) |
|
||
reqURL, err := url.ParseRequestURI(eventsTargetURL) | ||
if err != nil { | ||
fmt.Println(err) |
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.
If "err != nil" an error should be returned.
"reqUrl" could be nil
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.
This is a code copy from the gateway
component.
However, this is fixed because it is minor.
@@ -0,0 +1,53 @@ | |||
package apperrors |
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.
Type apperrors was intruduced but it is referenced in apperrors_test.go
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.
Done.
"github.com/kyma-project/kyma/components/event-gateway/internal/events/api" | ||
) | ||
|
||
type configurationData struct { |
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.
I'm not certain what is the purpose of using pointer here, I think it adds some complexity. In main.go "&" operator is used to pass string's pointer to bus.Init. In bus.Init configurationData members are set but in AddSource * operator is used to dereference the pointer. I think bus.Init and configurationData could use string instead of *string (passing by value is more natural here).
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.
This is a code copy from the gateway
component.
Refactoring will be considered separately not in this pull request.
27167a3
to
743212e
Compare
* add event-gateway component inside kyma * add event-gateway entry to the CODEOWNERS file * add event-gateway entry to the orchestrator.Jenkins file
743212e
to
3f57fa1
Compare
} | ||
|
||
// SendEvent sends the incoming request to the Sender | ||
func SendEvent(req *api.SendEventParameters, traceHeaders *map[string]string) (*api.SendEventResponse, error) { |
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.
I would propose to refactor this function a bit. I would extract the following operations into separate functions : creating http request, unmarshaling correct response, unmarshalling error response. Such a change would make SentEvent shorter and easier to read. What do you think?
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.
This is a code copy from the gateway
component.
Refactoring will be considered separately not in this pull request.
sourceEnvironment string | ||
} | ||
|
||
var conf *configurationData |
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.
I would avoid global variables. Consider declaring struct (e.g. EventBus) with configuration and eventTargetURL properties. Init function would be a factory method and return the struct (or an interface if you would like to mock it). What do you think?
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.
This is a code copy from the gateway
component.
Refactoring will be considered separately not in this pull request.
@akgalwas Refactoring will be considered separately not in this pull request. |
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.
Only comment: Remember to add a new job into the kyma seedjob.
@a-thaler, @derberg, @pbochynski, @PK85 please review. |
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.
I couldn't find any documentation and it is not clear what this new component is all about
@derberg the documentation is here: |
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.
@marcobebway no this is not product documentation, this is a README of the component. Or are you planning to provide documentation the same time you create a new chart and release it to Kyma?
Yes @derberg, we will provide product documentation when we create a new chart and release it to Kyma. |
Confirm these statements before you submit your pull request:
Description
Changes proposed in this pull request:
Issue link
#405