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

Plugins #5025

Closed
alexec opened this issue Feb 4, 2021 · 13 comments
Closed

Plugins #5025

alexec opened this issue Feb 4, 2021 · 13 comments
Labels

Comments

@alexec
Copy link
Contributor

alexec commented Feb 4, 2021

It would be good to have a system of plugins that do the following:

  • Allow new template types to be easily introduced without impacting core controller code, e.g. HTTP template (HTTP template #795)
  • Tap into the workflow lifecycle, e.g. Workflow lifecycle hook plugin #4355
  • Integrate with third party tools like Kafka.
  • Write notification plugins.

Additionally, the ability for users to create plugis would allow us to grow the ecosystem.

Golang Plugin

Golang provides a plugin system, but it very constrained as to how you build and package them:

  • Your plugin must be compiled against the same version of Golang
  • Your plugin must be compiled against the same version of Argo.
  • Plugins do not work with Darwin.
  • Must be built using CGO_ENABLED=1

This means effectively plugins must be built in the same source code repo.

However, if we provide a way to package your plugin, they are obviously the fastest and most powerful to write plugins.

HashiCorp Go Plugins

Golang provides an RPC library. HashCorp has formalized this into a way to write bi-directional plugins.

References

Tekton Custom Job:

Problems with Golang plugins:

https://www.reddit.com/r/golang/comments/b6h8qq/is_anyone_actually_using_go_plugins/

@alexec alexec added the type/feature Feature request label Feb 4, 2021
@Bobgy
Copy link
Contributor

Bobgy commented Feb 5, 2021

I'd hope plugins can evolve as independently as possible.

Did you ever consider REST/gRPC plugins? It might share some of the issues you mentioned with http templates, but now it's clear they will talk to a single configured trusted server, so some problems like auth and user permissions no longer apply.

@alexec
Copy link
Contributor Author

alexec commented Feb 5, 2021

Do you mean this?

https://github.com/hashicorp/go-plugin

@Bobgy
Copy link
Contributor

Bobgy commented Feb 5, 2021

I was only thinking about the problem architecturally and I didn't know hashicorp/go-plugin before.
But, that sounds like a great match!

Any packages (including transitive dependencies) outside of the standard library that are used by both the plugin and the program must have their versions match exactly.

(referenced from the reddit link)

The limitation on golang plugin seems unacceptable as a plugin purpose.

EDIT: note, please keep in mind I have limited experience on microservice systems with my own experience. Just talking about my current thoughts and they can be wrong.

@alexec alexec linked a pull request Feb 5, 2021 that will close this issue
@alexec
Copy link
Contributor Author

alexec commented Feb 5, 2021

Golang Plugin (GP) vs HashiCorp Plugin (HP)

Aside: I think we should consider supporting both.

Build

  • GP must be built using the same tooling as this binary. Effectively, you must provide a build harness for users to use, and likely build their plugins for them as part of your build. You must build and package with glibc, and CGO_ENABALED=, this is much easier with multi-platform Docker builds.
  • HP can happily be built however as they are just binaries.

HP wins by a huge margin.

Performance

  • GP is in process.

GP wins.

Language

I believe that HP can be written in non-go.

HP wins.

Boilerplate

  • GP has minimal boiler-plate. It is POGO (plain-old Go objects)

GP wins.

Callback

Callbacks are trivial in GP. Not sure about HP.

GP wins.

@Bobgy
Copy link
Contributor

Bobgy commented Feb 6, 2021

So, talking about use-cases, it seems GP can be a good fit for first party maintained optional plugins.

@alexec
Copy link
Contributor Author

alexec commented Feb 7, 2021

I think we can and should build an RPC (or JSON RPC) plugin as a Go plugins.

@alexec
Copy link
Contributor Author

alexec commented Feb 8, 2021

I'm really happy with my PoC. You can build your plugins as a Golang plugin. One of the Golang plugins will proxy requests via JSON-RPC. You can add a sidecar to the workflow-controller that services the RPC requests, so the deployment of the plugin is trivial.

I think JSON-RPC will work for most use cases, but you can always write a Golang plugin if you want.

@alexec
Copy link
Contributor Author

alexec commented Feb 10, 2021

@therealnb
Copy link

Use case:
We have X tasks to perform on Y endpoints in Z servers. We would like to use a step for each to take advantage of retry policy, alerting and other workflow goodies. XYZ can be 100s in a big system. Each step is a rest operation and completes quickly.

Problem:
If there are no failures most of the time is taken in creating the containers. This can take many minutes to do 100 posts. Further more, the first steps are a pause and the last resume, so the workflow duration is down time for this maintenance task.

Solution:
We can combine steps, but we lost the 'workflow goodies'. It would be better if we had a way for quick execution. One of

Ability for a step to run a small python script in another context (workflow-manager, or dedicated).
An exec step which runs on a previously created daemon.
The main reason not to share containers is collisions in file names. This isn't a problem if we aren't creating temporary files and if we are we can use the pod name to name the files.

@alexec alexec mentioned this issue Feb 12, 2021
@Bobgy
Copy link
Contributor

Bobgy commented Feb 13, 2021

@therealnb do you think #795 work for your use-case?

You can configure steps that send a request to your own server, and your server will be able to do whatever things you want.

A limitation could be that this is not suitable for steps that take some time to execute.

@alexec alexec linked a pull request Feb 16, 2021 that will close this issue
@alexec alexec changed the title Plugins Plugin Templates Feb 25, 2021
@alexec alexec changed the title Plugin Templates Plugins Feb 25, 2021
@alexec
Copy link
Contributor Author

alexec commented Feb 25, 2021

I'm closing this issue in favor for #5201 and #4355 which are more narrowly defined (but would have closely relati impl)

@alexec alexec closed this as completed Feb 25, 2021
@therealnb
Copy link

That's fine. #795 would help in our case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants