-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 docs for dynamic_metadata feature in opa-envoy-plugin #6389
Add docs for dynamic_metadata feature in opa-envoy-plugin #6389
Conversation
✅ Deploy Preview for openpolicyagent ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good @tjons. Some comments inline.
docs/content/envoy-primer.md
Outdated
@@ -101,13 +101,14 @@ With the input value above, the answer is: | |||
## Example Policy with Additional Controls | |||
|
|||
The `allow` variable in the above policy returns a `boolean` decision to indicate whether a request should be allowed or not. | |||
If you want, you can also control the HTTP status sent to the upstream or downstream client, along with the response body, and the response headers. To do that, you can write rules like the ones below to fill in values for variables with the following types: | |||
If you want, you can also control the HTTP status sent to the upstream or downstream client, along with the response body, and the response headers. You can also set `DynamicMetadata` in the `CheckResponse`. To do that, you can write rules like the ones below to fill in values for variables with the following types: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about something like
If you want, you can also control the HTTP status sent to the upstream or downstream client, along with the response body, the response headers. Response metadata can also be set for consumption by the next Envoy filter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good suggestion
docs/content/envoy-primer.md
Outdated
|
||
* `headers` is an object whose keys are strings and values are strings. In case the request is denied, the object represents the HTTP response headers to be sent to the downstream client. If the request is allowed, the object represents additional request headers to be sent to the upstream. | ||
* `response_headers_to_add` is an object whose keys are strings and values are strings. It defines the HTTP response headers to be sent to the downstream client when a request is allowed. | ||
* `request_headers_to_remove` is an array of strings which describes the HTTP headers to remove from the original request before dispatching it to the upstream when a request is allowed. | ||
* `body` is a string which represents the response body data sent to the downstream client when a request is denied. | ||
* `status_code` is a number which represents the HTTP response status code sent to the downstream client when a request is denied. | ||
* `dynamic_metadata` is an object whose keys are strings and values can be strings, objects, or numbers. It will set the `DynamicMetadata` in the `CheckResponse` returned by the `opa-envoy-plugin` and can be consumed elsewhere in the envoy filter chain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool, strings, numbers, objects or arrays
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forgot about arrays 😵💫
docs/content/envoy-primer.md
Outdated
@@ -207,6 +210,7 @@ When Envoy receives a policy decision, it expects a JSON object with the followi | |||
* `request_headers_to_remove` (optional): is an array of string header names | |||
* `http_status` (optional): a number representing the HTTP status code | |||
* `body` (optional): the response body | |||
* `dynamic_metadata` (optional): an object to be added to the `CheckResponse`'s `DynamicMetadata` field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an object representing dynamic metadata to be consumed by the next Envoy filter.
bbe7e26
to
185b186
Compare
@ashutosh-narkar thanks for the review! updated accordingly... let me know if you are ready for me to squash commits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: tjons <[email protected]>
Signed-off-by: tjons <[email protected]>
185b186
to
d6b6f3b
Compare
Merge after open-policy-agent/opa-envoy-plugin#479. |
Why the changes in this PR are needed?
Corresponding docs changes for open-policy-agent/opa-envoy-plugin#479
What are the changes in this PR?
Add
dynamic_metadata
as a supportedresult
keyword in theopa-envoy-plugin
docs, and provide a small example.Notes to assist PR review:
see open-policy-agent/opa-envoy-plugin#479 for implementation.
Further comments:
N/A