|
1 | | -# knative-flow-tagging |
2 | | -Extension to the Knative queue-proxy for flow tagging |
| 1 | +# PoliFlow Enforcer |
3 | 2 |
|
| 3 | +Extension to the Knative queue-proxy for enforcing rules defined by the PoliFlow Extractor. |
4 | 4 |
|
5 | 5 | ## Instructions |
6 | 6 |
|
7 | | -Knative Services must have the following metadata annotation to work with this plugin: |
| 7 | +The image can be built using the `build.sh` Bash script. |
| 8 | +However, before building, it is necessary to set the `KO_DOCKER_REPO` variable to the desired container registry to which the image will be pushed to. |
| 9 | + |
| 10 | +Then, the Kubernetes cluster where Knative Services protected by the Enforcer also needs some configurations. |
| 11 | +These can be automatically set by running the `patch.sh` script. |
| 12 | +Note, however, that the script will only run successfully if Knative is already installed in the cluster. |
| 13 | +Moreover, the script will also need a small modification to set the correct container registry (to the same set with `KO_DOCKER_REPO` in the `build.sh` script). |
| 14 | + |
| 15 | +Regarding the Enforcer usage, Knative Services must have the following metadata annotations to work with this plugin: |
8 | 16 | ```yaml |
9 | 17 | spec: |
10 | 18 | template: |
11 | 19 | metadata: |
12 | 20 | annotations: |
13 | 21 | qpoption.knative.dev/flow-activate: enable |
| 22 | + qpoption.knative.dev/flow-config-allowed_json_flows: | |
| 23 | + <extracted allowed paths> |
| 24 | + qpoption.knative.dev/flow-config-type: event |
14 | 25 | ``` |
15 | 26 |
|
16 | | -Moreover, the workflow created using SonataFlow must allow the response headers to be sent as request headers in state transitions. To achieve that, the workflows must use this version of the `incubator-kie-kogito-runtimes` (not merged yet, as of 28 of July, 2025): https://github.com/apache/incubator-kie-kogito-runtimes/pull/3939. |
17 | | -After applying this modification, the Knative functions within the workflow must also set the `returnHeaders` query parameter to `true`, like the following example: |
18 | | -```yaml |
19 | | -functions: |
20 | | - - name: authorization |
21 | | - type: custom |
22 | | - operation: knative:services.v1.serving.knative.dev/authorization?method=POST&failOnStatusError=false&returnHeaders=true |
23 | | -``` |
| 27 | +The plugin is activated for any service that has the annotation `qpoption.knative.dev/flow-activate` set to `enable`. |
| 28 | +Then, the allowed paths extracted by the PoliFlow Enforcer must be set (in JSON) as the value ot the `qpoption.knative.dev/flow-config-allowed_json_flows` annotation. |
| 29 | +Finally, `qpoption.knative.dev/flow-config-type` is an optional annotation that can be used to set the type of protected Knative Service. |
| 30 | +It accepts the values `function` (default) and `event`, used to define BaaS services (such as databases, that are called through callbacks within the workflow). |
0 commit comments