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 plugin manager for sources #857

Merged
merged 5 commits into from
Dec 1, 2022
Merged

Conversation

mszostok
Copy link
Collaborator

@mszostok mszostok commented Nov 21, 2022

Description

Changes proposed in this pull request:

  • Add plugin manager for sources
  • Update contrib doc and provide an easy way to develop Botkube core plugins
  • Support serving source via fake plugin HTTP server
  • Add e2e tests

Related issue(s)

@mszostok mszostok added the enhancement New feature or request label Nov 21, 2022
@mszostok mszostok requested a review from a team November 21, 2022 23:19
@mszostok mszostok requested a review from PrasadG193 as a code owner November 21, 2022 23:19
@mszostok mszostok marked this pull request as draft November 21, 2022 23:19
@mszostok mszostok removed the request for review from huseyinbabal November 21, 2022 23:19
@mszostok mszostok force-pushed the plugin-mgmt branch 3 times, most recently from 3ad94b1 to 4695584 Compare November 22, 2022 19:01
@mszostok mszostok changed the title Add simplified plugin manager for executors Add plugin manager for executors Nov 23, 2022
@mszostok mszostok force-pushed the plugin-mgmt branch 2 times, most recently from d1a7f8a to aefe8fb Compare November 23, 2022 17:06
@mszostok mszostok changed the title Add plugin manager for executors Add plugin manager for sources Nov 23, 2022
@@ -1,4 +1,4 @@
package e2e
package fake
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I cannot put the fake pkg inside e2e as then logs streaming for test doesn't work because of this issue: golang/go#46959

@mszostok mszostok marked this pull request as ready for review November 30, 2022 14:33
Comment on lines +148 to +150
> **Note**
> If Botkube runs inside the k3d cluster, export the `PLUGIN_SERVER_HOST=http://host.k3d.internal` environment variable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
> **Note**
> If Botkube runs inside the k3d cluster, export the `PLUGIN_SERVER_HOST=http://host.k3d.internal` environment variable.
> **Note**
> If Botkube runs inside the k3d cluster, export the `PLUGIN_SERVER_HOST=http://host.k3d.internal` environment variable.

Copy link

@josefkarasek josefkarasek left a comment

Choose a reason for hiding this comment

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

lgtm 👍

)

// CMWatcher implements Botkube source plugin.
type CMWatcher struct{}

Choose a reason for hiding this comment

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

Code style consistency - type block above combined with single line declaration.

Copy link
Collaborator Author

@mszostok mszostok Nov 30, 2022

Choose a reason for hiding this comment

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

Actually, I use the type block to "group" related entities, so the code block above is about types related to the configuration. This one is about the "service" that implements the source plugin functionality, so it's close to its methods.

Are you OK with such approach?

// As a result our key is e.g. ['source-name1;source-name2']
startProcesses := map[string]struct{}{}

startPlugin := func(bindSources []string) error {

Choose a reason for hiding this comment

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

Isn't this function complex enough to be named / defined separately?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, you are right. I changed it to become a dedicated method on this struct 👍

In the next PR, I will change it even more to make it more straight forward when it comes to the responsibilities. Because I see that it is to complex to maintain and test all those pieces together.

@mszostok mszostok merged commit ead3dd6 into kubeshop:main Dec 1, 2022
@mszostok mszostok deleted the plugin-mgmt branch December 1, 2022 08:36
@mszostok
Copy link
Collaborator Author

mszostok commented Dec 1, 2022

Hi @josefkarasek!

Thanks for your review 🙇
I addressed the feedback and also merge the PR as it was a dependency for my second PR. You were also assigned there 🙂 so we will be able to follow up there with some changes that you will see as required. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants