TykTechnologies / tyk-operator

Tyk Operator for Kubernetes
https://tyk.io
Mozilla Public License 2.0
197 stars 38 forks source link

wh: configure webhooks to catch events that occur at API level #63

Closed asoorm closed 3 years ago

asoorm commented 3 years ago

Create a webhook custom resource which can CRUD webhooks in a similar manner to API Definitions & Security Policies.

{
    "_id" : ObjectId("5f7c71617250af90cf5861c5"),
    "org_id" : "5d67b96d767e02015ea84a6f",
    "name" : "foo",
    "method" : "GET",
    "target_path" : "https://webhook.site/12cc63fd-f890-4fda-b05d-c444881f2795",
    "template_path" : "",
    "header_map" : {},
    "event_timeout" : NumberLong(0)
}

Webhooks should be targetable by namespace / name rather than having to select the webhook to fire using the mongo id 5f7c71617250af90cf5861c5.

  "hook_references": [
    {
      "event_name": "AuthFailure",
      "event_timeout": 60,
      "hook": {
        "method": "GET",
        "api_model": {},
        "header_map": {},
        "template_path": "",
        "name": "foo",
        "target_path": "https://webhook.site/12cc63fd-f890-4fda-b05d-c444881f2795",
        "org_id": "5d67b96d767e02015ea84a6f",
        "id": "5f7c71617250af90cf5861c5",
        "event_timeout": 0
      }
    }
  ]

Why is the webhook object is copied into the API Definition object. If a webhook obj changes, does this get transposed to API Definitions also, or does it leave the API Definition in an inconsistent state? Is it possible to configure webhooks in the API Definition without having created a webhook? What fields in the webhook are mandatory?

sedkis commented 3 years ago

Needs:

https://github.com/TykTechnologies/tyk-operator/pull/70 to implement above checked.

gernest commented 3 years ago

Closing this for now as we removed webhook support