filter: pb definition for squash filter (#353)
Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com>pull/363/head
parent
1c338d35f3
commit
fa914b487f
10 changed files with 155 additions and 0 deletions
@ -0,0 +1,48 @@ |
||||
syntax = "proto3"; |
||||
|
||||
package envoy.api.v2.filter.http; |
||||
|
||||
import "google/protobuf/duration.proto"; |
||||
import "google/protobuf/struct.proto"; |
||||
import "validate/validate.proto"; |
||||
|
||||
// [#protodoc-title: Squash] |
||||
// Squash :ref:`configuration overview <config_http_filters_squash>`. |
||||
|
||||
// [#proto-status: experimental] |
||||
message Squash { |
||||
// The name of the cluster that hosts the Squash server. |
||||
string cluster = 1 [(validate.rules).string.min_bytes = 1]; |
||||
|
||||
// When the filter requests the Squash server to create a DebugAttachment, it will use this |
||||
// structure as template for the body of the request. It can contain reference to environment |
||||
// variables in the form of '{{ ENV_VAR_NAME }}'. These can be used to provide the Squash server |
||||
// with more information to find the process to attach the debugger to. For example, in a |
||||
// Istio/k8s environment, this will contain information on the pod: |
||||
// |
||||
// .. code-block:: json |
||||
// |
||||
// { |
||||
// "spec": { |
||||
// "attachment": { |
||||
// "pod": "{{ POD_NAME }}", |
||||
// "namespace": "{{ POD_NAMESPACE }}" |
||||
// }, |
||||
// "match_request": true |
||||
// } |
||||
// } |
||||
// |
||||
// (where POD_NAME, POD_NAMESPACE are configured in the pod via the Downward API) |
||||
google.protobuf.Struct attachment_template = 2; |
||||
|
||||
// The timeout for individual requests sent to the Squash cluster. Defaults to 1 second. |
||||
google.protobuf.Duration request_timeout = 3; |
||||
|
||||
// The total timeout Squash will delay a request and wait for it to be attached. Defaults to 60 |
||||
// seconds. |
||||
google.protobuf.Duration attachment_timeout = 4; |
||||
|
||||
// Amount of time to poll for the status of the attachment object in the Squash server |
||||
// (to check if has been attached). Defaults to 1 second. |
||||
google.protobuf.Duration attachment_poll_period = 5; |
||||
} |
@ -0,0 +1,56 @@ |
||||
.. _config_http_filters_squash_v1: |
||||
|
||||
Squash |
||||
====== |
||||
|
||||
Squash :ref:`configuration overview <config_http_filters_squash>`. |
||||
|
||||
.. code-block:: json |
||||
|
||||
{ |
||||
"name": "squash", |
||||
"config": { |
||||
"cluster": "...", |
||||
"attachment_template": "{...}", |
||||
"attachment_timeout_ms": "...", |
||||
"attachment_poll_period_ms": "...", |
||||
"request_timeout_ms": "..." |
||||
} |
||||
} |
||||
|
||||
cluster |
||||
*(required, object)* The name of the cluster that hosts the Squash server. |
||||
|
||||
attachment_template |
||||
*(required, object)* When the filter requests the Squash server to create a DebugAttachment, it |
||||
will use this structure as template for the body of the request. It can contain reference to |
||||
environment variables in the form of '{{ ENV_VAR_NAME }}'. These can be used to provide the Squash |
||||
server with more information to find the process to attach the debugger to. For example, in a |
||||
Istio/k8s environment, this will contain information on the pod: |
||||
|
||||
.. code-block:: json |
||||
|
||||
{ |
||||
"spec": { |
||||
"attachment": { |
||||
"pod": "{{ POD_NAME }}", |
||||
"namespace": "{{ POD_NAMESPACE }}" |
||||
}, |
||||
"match_request": true |
||||
} |
||||
} |
||||
|
||||
(where POD_NAME, POD_NAMESPACE are configured in the pod via the Downward API) |
||||
|
||||
request_timeout_ms |
||||
*(required, integer)* The timeout for individual requests sent to the Squash cluster. Defaults to |
||||
1 second. |
||||
|
||||
attachment_timeout_ms |
||||
*(required, integer)* The total timeout Squash will delay a request and wait for it to be |
||||
attached. Defaults to 60 seconds. |
||||
|
||||
attachment_poll_period_ms |
||||
*(required, integer)* Amount of time to poll for the status of the attachment object in the Squash |
||||
server (to check if has been attached). Defaults to 1 second. |
||||
|
@ -0,0 +1,40 @@ |
||||
.. _config_http_filters_squash: |
||||
|
||||
Squash |
||||
====== |
||||
|
||||
Squash is an HTTP filter which enables Envoy to integrate with Squash microservices debugger. |
||||
Code: https://github.com/solo-io/squash, API Docs: https://squash.solo.io/ |
||||
|
||||
Overview |
||||
-------- |
||||
|
||||
The main use case for this filter is in a service mesh, where Envoy is deployed as a sidecar. |
||||
Once a request marked for debugging enters the mesh, the Squash Envoy filter reports its 'location' |
||||
in the cluster to the Squash server - as there is a 1-1 mapping between Envoy sidecars and |
||||
application containers, the Squash server can find and attach a debugger to the application container. |
||||
The Squash filter also holds the request until a debugger is attached (or a timeout occurs). This |
||||
enables developers (via Squash) to attach a native debugger to the container that will handle the |
||||
request, before the request arrive to the application code, without any changes to the cluster. |
||||
|
||||
Configuration |
||||
------------- |
||||
|
||||
* :ref:`v1 API reference <config_http_filters_squash_v1>` |
||||
* :ref:`v2 API reference <envoy_api_msg_filter.http.Squash>` |
||||
|
||||
How it works |
||||
------------ |
||||
|
||||
When the Squash filter encounters a request containing the header 'x-squash-debug' it will: |
||||
|
||||
1. Delay the incoming request. |
||||
2. Contact the Squash server and request the creation of a DebugAttachment |
||||
|
||||
- On the Squash server side, Squash will attempt to attach a debugger to the application Envoy |
||||
proxies to. On success, it changes the state of the DebugAttachment |
||||
to attached. |
||||
|
||||
3. Wait until the Squash server updates the DebugAttachment object's state to attached (or |
||||
error state) |
||||
4. Resume the incoming request |
Loading…
Reference in new issue