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 support for HTTP events a.k.a. webhooks #636

Open
redbaron opened this issue Jul 29, 2024 · 3 comments
Open

Add support for HTTP events a.k.a. webhooks #636

redbaron opened this issue Jul 29, 2024 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@redbaron
Copy link

shell-operator is great tool to run small (or large) script snippets in response to events. Current event list is:

  • kubernetes watches
  • scheduled execution (cron)

I propose to add support for HTTP request events. Hooks can declare interest in HTTP request and will be called when matched request arrives. With this change binding context will have new key with HTTP request details (url, body, headers) and hook can optionally produce HTTP response by writing JSON into special path.

Upon startup hooks declare interest in certain incoming requests with jqFilter (for instance they can match on body or URL) similar to how they now subscribe to kubernetes watches. Config should also declare whether shell-operator waits for hook to produce response or preconfigured response can be returned immediately.

There are other projects in this space, like https://github.com/adnanh/webhook, but they lack k8s integration shell-operator provides and frankly don't look as ergonomic as shell-operator.

@raabdullaev raabdullaev added the help wanted Extra attention is needed label Aug 7, 2024
@raabdullaev
Copy link

@redbaron excellent idea! Are you ready to implement it by yourself?

@redbaron
Copy link
Author

redbaron commented Aug 7, 2024

Looking at webhooks implementation I can see that handler is not added to queue . I'd prefer for HTTP event sources to be queued , is t OK with you?

If queued and hook is configured to provide direct response, what would be behaviour on timeout? remove hook from queue? what if it is already running?

@raabdullaev
Copy link

@redbaron
timeout and queue - ok
what if it is already running - wait

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants