Skip to content

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

@redbaron

Description

@redbaron

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions