Skip to content
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

Merged

Conversation

marcobebway
Copy link
Contributor

@marcobebway marcobebway commented Aug 13, 2018

Confirm these statements before you submit your pull request:

  • I have read and submitted the required Contributor Licence Agreements.
  • This pull request follows the contributing guidelines, recommended Git workflow, and templates.
  • I have tested my changes.
  • I have updated the relevant documentation.

Description

Changes proposed in this pull request:

  • add event-gateway component inside kyma
  • add event-gateway entry to the CODEOWNERS file
  • add event-gateway entry to the orchestrator.Jenkins file

Issue link
#405


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.
Copy link
Contributor

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`.

@klaudiagrz
Copy link
Contributor

What is the relation of this PR to #166 ?

@marcobebway
Copy link
Contributor Author

@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 WIP).

@klaudiagrz
Copy link
Contributor

Ok, thanks for explanation :)


reqURL, err := url.ParseRequestURI(eventsTargetURL)
if err != nil {
fmt.Println(err)
Copy link

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

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

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 {
Copy link
Contributor

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).

Copy link
Contributor Author

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.

* add event-gateway component inside kyma
* add event-gateway entry to the CODEOWNERS file
* add event-gateway entry to the orchestrator.Jenkins file
}

// SendEvent sends the incoming request to the Sender
func SendEvent(req *api.SendEventParameters, traceHeaders *map[string]string) (*api.SendEventResponse, error) {
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@marcobebway
Copy link
Contributor Author

marcobebway commented Aug 14, 2018

@akgalwas Refactoring will be considered separately not in this pull request.

@marcobebway marcobebway mentioned this pull request Aug 14, 2018
2 tasks
Copy link
Contributor

@clebs clebs left a 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.

@ghost ghost self-requested a review August 16, 2018 06:31
@marcobebway
Copy link
Contributor Author

@a-thaler, @derberg, @pbochynski, @PK85 please review.

Copy link

@derberg derberg left a 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

@marcobebway
Copy link
Contributor Author

marcobebway commented Aug 16, 2018

@derberg the documentation is here: components/event-gateway/README.md.

Copy link

@derberg derberg left a 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?

@marcobebway
Copy link
Contributor Author

marcobebway commented Aug 16, 2018

Yes @derberg, we will provide product documentation when we create a new chart and release it to Kyma.

@marcobebway marcobebway merged commit e7332eb into kyma-project:master Aug 17, 2018
@marcobebway marcobebway deleted the add-event-gateway-component branch September 26, 2018 19:04
@marcobebway marcobebway restored the add-event-gateway-component branch September 26, 2018 19:04
@marcobebway marcobebway deleted the add-event-gateway-component branch September 26, 2018 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants