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

Act system #451

Merged
merged 50 commits into from
Mar 1, 2024
Merged

Act system #451

merged 50 commits into from
Mar 1, 2024

Conversation

mostafa
Copy link
Member

@mostafa mostafa commented Feb 24, 2024

Ticket(s)

Description

This giant PR adds the very first version of the Act system that was proposed in this proposal. The old way of signaling was static and only supported a single signal: terminate. The new system supports more signals, adds proper policies that can be easily controlled by the users and the actions are executed in sync and async mode.

The Act system consists of these components:

  1. Act Registry: takes care of registering signals, policies and actions. It also applies policies to signals to produce outputs for actions and runs actions using those outputs.
  2. Signals: plugins' hooks can return signal(s) as part of their request/response. These signals tell GatewayD what to do.
  3. Policies: signals pass through predefined policies that will decide whether GatewayD should react to the signal or not.
  4. Actions: actions run in sync or async mode and perform a function. Sync actions are used to control traffic (passthrough, terminate, etc.) and other parts of the system, and async actions can other things (log, publish a message to Kafka, etc.).
  5. Plugin Registry: after running a hook on each plugin, the signals are extracted and the policies are applied to those signals. The output of those policy evaluations are returned to the caller, which knows how to run action and use its results.

And the code spans over two projects:

  1. GatewayD: all the above components of the Act system are in GatewayD.
  2. SDK: types and helper functions for creating and exporting signals are in the SDK.

Breaking changes

The old way of terminating requests don't work anymore, as it was refactored in #442 and all the plugins are updated to pick up the changes.

Related PRs

N/A

Development Checklist

  • I have added a descriptive title to this PR.
  • I have squashed related commits together.
  • I have rebased my branch on top of the latest main branch.
  • I have performed a self-review of my own code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added docstring(s) to my code.
  • I have made corresponding changes to the documentation (docs).
  • I have added tests for my changes.
  • I have signed all the commits.

Legal Checklist

@mostafa mostafa marked this pull request as ready for review March 1, 2024 17:28
@mostafa mostafa assigned mostafa and unassigned mostafa Mar 1, 2024
@mostafa mostafa marked this pull request as draft March 1, 2024 17:30
@mostafa mostafa marked this pull request as ready for review March 1, 2024 22:53
@mostafa mostafa merged commit 6ccf9b7 into main Mar 1, 2024
3 of 4 checks passed
@mostafa mostafa deleted the act-system branch March 1, 2024 23:05
@mostafa mostafa linked an issue Mar 1, 2024 that may be closed by this pull request
6 tasks
@mostafa mostafa added this to the v0.9.x milestone Mar 1, 2024
@mostafa mostafa mentioned this pull request Mar 2, 2024
smnmna99 pushed a commit that referenced this pull request Mar 13, 2024
This giant PR adds the very first version of the Act system that was proposed in [this proposal](gatewayd-io/proposals#5). The old way of signaling was static and only supported a single signal: `terminate`. The new system support more signals, adds proper policies that can be easily controlled by the users and the actions are executed in sync and async mode.

The Act system consists of these components:
1. **Act Registry**: takes care of registering signals, policies and actions. It also applies policies to signals to produce outputs for actions and runs actions using those outputs.
2. **Signals**: plugins' hooks can return signal(s) as part of their request/response. These signals tell GatewayD what to do.
3. **Policies**: signals pass through predefined policies that will decide whether GatewayD should react to the signal or not.
4. **Actions**: actions run in sync or async mode and perform a function. Sync actions are used to control traffic (passthrough, terminate, etc.) and other parts of the system, and async actions can other things (log, publish a message to Kafka, etc.).
5. **Plugin Registry**: after running a hook on each plugin, the signals are extracted and the policies are applied to those signals. The output of those policy evaluations are returned to the caller, which knows how to run action and use its results.

And the code spans over two projects:
1. **GatewayD**: all the above components of the Act system are in GatewayD.
2. **SDK**: types and helper functions for creating and exporting signals are in the SDK.

### Breaking changes 
The old way of terminating requests don't work anymore, as it was refactored in #442 and all the plugins are updated to pick up the changes.
@mostafa mostafa self-assigned this Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Update to Go 1.22 Refactor termination policy
1 participant