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

update policy list #1374

Merged
merged 1 commit into from
Aug 26, 2022
Merged

update policy list #1374

merged 1 commit into from
Aug 26, 2022

Conversation

eguzki
Copy link
Member

@eguzki eguzki commented Aug 25, 2022

how to generate policy file

Run apicast

$ cat <<EOF >config.json
{
   "services": [
      {
         "proxy": {
             "hosts": ["one"],
             "proxy_rules": [],
             "api_backend": "https://echo-api.3scale.net",
             "policy_chain": []
         }
      }
   ]
}
EOF

$ docker run -ti --name apicast --rm -v $PWD/config.json:/opt/app/config.json:ro --env THREESCALE_CONFIG_FILE=/opt/app/config.json --env APICAST_LOG_LEVEL=debug --env APICAST_CONFIGURATION_LOADER=lazy --env APICAST_CONFIGURATION_CACHE=0 --env THREESCALE_DEPLOYMENT_ENV=staging --env BACKEND_ENDPOINT_OVERRIDE=http://127.0.0.1:3000 --env APICAST_WORKERS=1 quay.io/3scale/apicast:latest

Fetch policies

$ APICAST_IP=$(docker inspect apicast | yq e -P '.[0].NetworkSettings.Networks.bridge.IPAddress' -)
$ curl -v -H "Host: one" http://${APICAST_IP}:8090/policies -o policies.latest.json
# pretty print and fix string encoding issues
$ cat policies.latest.json | jq '.' > policies.latest.p.json

@eguzki eguzki requested a review from a team as a code owner August 25, 2022 16:32
Copy link
Contributor

@mayorova mayorova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

"upstream": [
{
"name": "Upstream",
"summary": "Allows to modify the upstream URL of the request based on its path.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"summary": "Allows to modify the upstream URL of the request based on its path.",
"summary": "This policy allows you to modify the upstream URL of the request based on its path.",

"name": "Upstream",
"summary": "Allows to modify the upstream URL of the request based on its path.",
"description": [
"This policy allows to modify the upstream URL (scheme, host and port) of the request based on its path. ",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"This policy allows to modify the upstream URL (scheme, host and port) of the request based on its path. ",
"This policy allows you to modify the upstream URL (scheme, host, and port) of the request based on its path. ",

"properties": {
"url": {
"type": "string",
"description": "New URL in case of match"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "New URL in case of match"
"description": "The new URL in case of a match."

},
"regex": {
"type": "string",
"description": "Regular expression to be matched"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "Regular expression to be matched"
"description": "The regular expression to be matched."

],
"type": "object"
},
"description": "List of rules to be applied",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "List of rules to be applied",
"description": "The list of rules to be applied.",

],
"type": "string"
},
"description": "Array of HTTP methods this rule must be applied to. If left blank it will be applied to all HTTP methods",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "Array of HTTP methods this rule must be applied to. If left blank it will be applied to all HTTP methods",
"description": "An array of HTTP methods this rule must be applied to. If left blank it will be applied to all HTTP methods.",

"type": "string"
},
"template": {
"description": "Template in which the matched args are replaced",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "Template in which the matched args are replaced",
"description": "Template in which the matched arguments are replaced.",

],
"upstream_mtls": [
{
"summary": "Certificates to be used with the upstream API",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"summary": "Certificates to be used with the upstream API",
"summary": "Certificates to be used with the upstream API.",

"upstream_mtls": [
{
"summary": "Certificates to be used with the upstream API",
"description": "With this policy a new TLS connection with the upstream API will be used with the certificates set in the config",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "With this policy a new TLS connection with the upstream API will be used with the certificates set in the config",
"description": "This policy uses a new TLS connection with the upstream API and the certificates set in the configurations.",

"type": "string"
}
},
"description": "Built-in Upstream MTLS APIcast policy",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "Built-in Upstream MTLS APIcast policy",
"description": "Built-in Upstream MTLS APIcast policy.",

"custom_metrics": [
{
"name": "Custom Metrics",
"summary": "Custom metrics on Nginx post actions ",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"summary": "Custom metrics on Nginx post actions ",
"summary": "Custom metrics on Nginx post actions.",

"name": "Custom Metrics",
"summary": "Custom metrics on Nginx post actions ",
"description": [
"With this policy, on post_actions the Authrep call will report any new ",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"With this policy, on post_actions the Authrep call will report any new ",
"With this policy, on post_actions the AuthRep call will report any new ",

"!=",
"matches"
],
"description": "Operation to apply. The matches op supports PCRE (Perl compatible regular expressions)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "Operation to apply. The matches op supports PCRE (Perl compatible regular expressions)",
"description": "Operation to apply. The matches operation supports PCRE (Perl compatible regular expressions).",

"custom_metrics_rule": {
"properties": {
"increment": {
"description": "How many hits should be incremented, liquid value ",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this description is trying to say. Is it: This metric determines how many hits should be incremented using the liquid value?

@eguzki
Copy link
Member Author

eguzki commented Aug 26, 2022

@dfennessy Thanks for the review. Those files are auto-generated and thus, we cannot change them. I will take your suggestions and apply them to the source files in another PR. thanks!

{
"summary": "Controls logging.",
"description": [
"Controls logging. It allows to enable and disable access logs per ",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Controls logging. It allows to enable and disable access logs per ",
"Controls logging allows you to enable and disable access logs per ",

"summary": "Controls logging.",
"description": [
"Controls logging. It allows to enable and disable access logs per ",
"service. Also it allows to have a custom access logs format per service"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"service. Also it allows to have a custom access logs format per service"
"service. Also it allows to have a custom access logs format per service."

"!=",
"matches"
],
"description": "Match operation to compare match field with the provided value",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "Match operation to compare match field with the provided value",
"description": "Match operation to compare match field with the provided value.",

],
"upstream_connection": [
{
"summary": "Allows to configure several options for the connections to the upstream",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"summary": "Allows to configure several options for the connections to the upstream",
"summary": "Allows you to configure several options for the connections to the upstream.",

"upstream_connection": [
{
"summary": "Allows to configure several options for the connections to the upstream",
"description": "Allows to configure several options for the connections to the upstream",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "Allows to configure several options for the connections to the upstream",
"description": "Allows you to configure several options for the connections to the upstream.",

"properties": {
"send_timeout": {
"exclusiveMinimum": 0,
"description": "Timeout between two successive write operations (in seconds).",
Copy link
Contributor

@dfennessy dfennessy Aug 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "Timeout between two successive write operations (in seconds).",
"description": "This is the timeout in seconds between two successive write operations.",

},
"connect_timeout": {
"type": "integer",
"description": "Timeout for establishing a connection (in seconds)."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "Timeout for establishing a connection (in seconds)."
"description": "This is the timeout in seconds for establishing a connection."

},
"read_timeout": {
"exclusiveMinimum": 0,
"description": "Timeout between two successive read operations (in seconds).",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "Timeout between two successive read operations (in seconds).",
"description": "The timeout in seconds between two successive read operations.",

],
"tls": [
{
"summary": "Configure TLS termination certificates",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"summary": "Configure TLS termination certificates",
"summary": "Configure TLS termination certificates.",

@dfennessy
Copy link
Contributor

dfennessy commented Aug 26, 2022

Some suggestions added. This is one I'll have to come back to due to the sheer size of the files, however I hope the suggestions I've made are on the right track. The suggestions are around readability and punctuation.

@dfennessy
Copy link
Contributor

@dfennessy Thanks for the review. Those files are auto-generated and thus, we cannot change them. I will take your suggestions and apply them to the source files in another PR. thanks!

AH! I've just seen this now. Will I await the other PR and continue the suggestions there?

@eguzki
Copy link
Member Author

eguzki commented Aug 26, 2022

@dfennessy Thanks for the review. Those files are auto-generated and thus, we cannot change them. I will take your suggestions and apply them to the source files in another PR. thanks!

AH! I've just seen this now. Will I await the other PR and continue the suggestions there?

wait for another PR, thanks

@eguzki eguzki merged commit 45b1756 into master Aug 26, 2022
@eguzki eguzki deleted the update-policy-list branch August 26, 2022 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants