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

feat(kuma-cp): implement MeshTimeout policy #5364

Merged
merged 28 commits into from Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ebcb5b9
feat(kuma-cp): implement MeshTimeout policy
Automaat Nov 23, 2022
82d67f4
feat(kuma-cp): timeout implementation for gateways
Automaat Dec 2, 2022
ea2b863
Merge branch 'master' into feat/mesh_timeout
Automaat Dec 2, 2022
be4772c
feat(kuma-cp): code review
Automaat Dec 5, 2022
8d344b4
Merge branch 'master' into feat/mesh_timeout
Automaat Dec 5, 2022
e4f10eb
feat(kuma-cp): fixed check
Automaat Dec 5, 2022
bb88e97
fix(kuma-cp): added test for gateway
Automaat Dec 5, 2022
fcb09fb
feat(kuma-cp): updated timeout MADR
Automaat Dec 6, 2022
249ce0e
Merge branch 'master' into feat/mesh_timeout
Automaat Dec 6, 2022
a9d5312
Merge branch 'master' into feat/mesh_timeout
Automaat Dec 7, 2022
cbb5cee
feat(kuma-cp): fixed e2e tests
Automaat Dec 7, 2022
7b02a66
Merge branch 'master' into feat/mesh_timeout
Automaat Dec 7, 2022
841e0c6
Merge branch 'master' into feat/mesh_timeout
Automaat Dec 7, 2022
2ea7612
Merge branch 'master' into feat/mesh_timeout
Automaat Dec 8, 2022
9890ee6
Merge branch 'master' into feat/mesh_timeout
Automaat Dec 8, 2022
f80af9b
Merge branch 'master' into feat/mesh_timeout
Automaat Dec 9, 2022
a0cad38
Merge branch 'master' into feat/mesh_timeout
Automaat Dec 9, 2022
d16721b
feat(kuma-cp): code review
Automaat Dec 12, 2022
f030595
Merge branch 'master' into feat/mesh_timeout
Automaat Dec 12, 2022
a6abbdc
feat(kuma-cp): fix naming
Automaat Dec 12, 2022
4b1b40c
feat(kuma-cp): changed e2e test namespace
Automaat Dec 12, 2022
79c1823
Merge branch 'master' into feat/mesh_timeout
Automaat Dec 12, 2022
47e8a11
feat(kuma-cp): fix check
Automaat Dec 12, 2022
93265c2
Merge branch 'master' into feat/mesh_timeout
Automaat Dec 12, 2022
e64f875
feat(kuma-cp): fix e2e tests
Automaat Dec 12, 2022
3d29196
Merge branch 'master' into feat/mesh_timeout
Automaat Dec 13, 2022
33938a5
feat(kuma-cp): code review
Automaat Dec 13, 2022
abd8ec2
Merge branch 'master' into feat/mesh_timeout
Automaat Dec 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/guides/e2e-test-tips.md
Expand Up @@ -97,6 +97,20 @@ Running `make test/e2e/debug` can intentionally leave resources if test fails. C
make k3d/stop/all && docker stop $(docker ps -aq) # omit $ for fish
```

### Tests failing because of disk pressure

From time to time when running tests your docker environment can run out of space. You will see k8s events like this:
```
Warning FailedScheduling 63s (x1 over 2m15s) default-scheduler 0/1 nodes are available:
1 node(s) had taint {node.kubernetes.io/disk-pressure:}, that the pod didn't tolerate.
```

To fix this issue you need to clean up your docker environment:

```bash
docker system prune --volumes --all
```

### Integration with direnv

[direnv](https://direnv.net/) is a useful tool that can populate environment variables in your shell as you change directories.
Expand Down
8 changes: 4 additions & 4 deletions docs/madr/decisions/010-timeout-policy.md
Expand Up @@ -100,11 +100,12 @@ In this policy same limitations applies as in `MeshAccessLog` [policy](https://g
```yaml
from:
- targetRef:
kind: Mesh|MeshSubset|MeshService|MeshServiceSubset
kind: Mesh
name: ...
```

Matching on MeshGatewayRoute and MeshHTTPRoute does not make sense (there is no route that a request originates from).
Since timeouts are mostly configured on clusters and listeners there and we have single inbound in most cases we can only
configure `Mesh` kind in from section.

#### To level

Expand Down Expand Up @@ -239,11 +240,10 @@ spec:
targetRef:
kind: MeshGatewayRoute
name: default-gateway-route
from:
to:
- targetRef:
kind: MeshService
name: backend
mesh: consume
default:
idleTimeout: 30m
http:
Expand Down
Expand Up @@ -37,9 +37,6 @@ func validateFrom(from []From) validators.ValidationError {
verr.AddErrorAt(path.Field("targetRef"), matcher_validators.ValidateTargetRef(fromItem.GetTargetRef(), &matcher_validators.ValidateTargetRefOpts{
SupportedKinds: []common_api.TargetRefKind{
common_api.Mesh,
common_api.MeshSubset,
common_api.MeshService,
common_api.MeshServiceSubset,
},
}))

Expand All @@ -57,6 +54,7 @@ func validateTo(to []To) validators.ValidationError {
SupportedKinds: []common_api.TargetRefKind{
common_api.Mesh,
common_api.MeshService,
common_api.MeshGatewayRoute,
},
}))

Expand Down
@@ -0,0 +1,9 @@
connectTimeout: 10s
name: localhost:8080
typedExtensionProtocolOptions:
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
'@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
commonHttpProtocolOptions:
idleTimeout: 3600s
maxConnectionDuration: 600s
maxStreamDuration: 600s
@@ -0,0 +1,33 @@
address:
socketAddress:
address: 127.0.0.1
portValue: 80
enableReusePort: false
filterChains:
- filters:
- name: envoy.filters.network.http_connection_manager
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
httpFilters:
- name: envoy.filters.http.router
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
routeConfig:
name: inbound:backend
requestHeadersToRemove:
- x-kuma-tags
validateClusters: false
virtualHosts:
- domains:
- '*'
name: backend
routes:
- match:
prefix: /
route:
cluster: backend
timeout: 5s
statPrefix: "inbound_127_0_0_1_80"
streamIdleTimeout: 1s
name: inbound:127.0.0.1:80
trafficDirection: INBOUND
@@ -0,0 +1,2 @@
connectTimeout: 10s
name: second-service
@@ -0,0 +1,14 @@
address:
socketAddress:
address: 127.0.0.1
portValue: 10002
filterChains:
- filters:
- name: envoy.filters.network.tcp_proxy
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
cluster: backend
idleTimeout: 30s
statPrefix: "127_0_0_1_10002"
name: outbound:127.0.0.1:10002
trafficDirection: OUTBOUND
@@ -0,0 +1,17 @@
connectTimeout: 10s
edsClusterConfig:
edsConfig:
ads: {}
resourceApiVersion: V3
name: backend-26cb64fa4e85e7b7
perConnectionBufferLimitBytes: 32768
type: EDS
typedExtensionProtocolOptions:
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
'@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
commonHttpProtocolOptions:
idleTimeout: 3600s
maxConnectionDuration: 600s
maxStreamDuration: 600s
explicitHttpConfig:
httpProtocolOptions: {}
@@ -0,0 +1,56 @@
address:
socketAddress:
address: 192.168.0.1
portValue: 8080
enableReusePort: true
filterChains:
- filters:
- name: envoy.filters.network.http_connection_manager
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
commonHttpProtocolOptions:
headersWithUnderscoresAction: REJECT_REQUEST
idleTimeout: 300s
http2ProtocolOptions:
allowConnect: true
initialConnectionWindowSize: 1048576
initialStreamWindowSize: 65536
maxConcurrentStreams: 100
httpFilters:
- name: envoy.filters.http.local_ratelimit
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.local_ratelimit.v3.LocalRateLimit
statPrefix: rate_limit
- name: gzip-compress
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.compressor.v3.Compressor
compressorLibrary:
name: gzip
typedConfig:
'@type': type.googleapis.com/envoy.extensions.compression.gzip.compressor.v3.Gzip
responseDirectionConfig:
disableOnEtagHeader: true
- name: envoy.filters.http.router
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
mergeSlashes: true
normalizePath: true
pathWithEscapedSlashesAction: UNESCAPE_AND_REDIRECT
rds:
configSource:
ads: {}
resourceApiVersion: V3
routeConfigName: sample-gateway:HTTP:8080
requestHeadersTimeout: 0.500s
serverName: Kuma Gateway
statPrefix: sample-gateway
streamIdleTimeout: 1s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.listener.tls_inspector.v3.TlsInspector
name: sample-gateway:HTTP:8080
perConnectionBufferLimitBytes: 32768
trafficDirection: INBOUND
@@ -0,0 +1,22 @@
name: sample-gateway:HTTP:8080
requestHeadersToRemove:
- x-kuma-tags
validateClusters: false
virtualHosts:
- domains:
- '*'
name: '*'
routes:
- match:
path: /
route:
timeout: 5s
weightedClusters:
clusters:
- name: backend-26cb64fa4e85e7b7
requestHeadersToAdd:
- header:
key: x-kuma-tags
value: '&kuma.io/service=sample-gateway&'
weight: 1
totalWeight: 1
@@ -0,0 +1,9 @@
connectTimeout: 10s
name: other-service
typedExtensionProtocolOptions:
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
'@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
commonHttpProtocolOptions:
idleTimeout: 3600s
maxConnectionDuration: 600s
maxStreamDuration: 600s
@@ -0,0 +1,34 @@
address:
socketAddress:
address: 127.0.0.1
portValue: 10001
filterChains:
- filters:
- name: envoy.filters.network.http_connection_manager
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
httpFilters:
- name: envoy.filters.http.router
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
routeConfig:
name: outbound:backend
requestHeadersToAdd:
- header:
key: x-kuma-tags
value: '&kuma.io/service=web&'
validateClusters: false
virtualHosts:
- domains:
- '*'
name: backend
routes:
- match:
prefix: /
route:
cluster: backend
timeout: 5s
statPrefix: "outbound_127_0_0_1_10001"
streamIdleTimeout: 1s
name: outbound:127.0.0.1:10001
trafficDirection: OUTBOUND
@@ -0,0 +1,9 @@
connectTimeout: 10s
name: other-service
typedExtensionProtocolOptions:
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
'@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
commonHttpProtocolOptions:
idleTimeout: 3600s
maxConnectionDuration: 0s
maxStreamDuration: 0s
@@ -0,0 +1,34 @@
address:
socketAddress:
address: 127.0.0.1
portValue: 10001
filterChains:
- filters:
- name: envoy.filters.network.http_connection_manager
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
httpFilters:
- name: envoy.filters.http.router
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
routeConfig:
name: outbound:backend
requestHeadersToAdd:
- header:
key: x-kuma-tags
value: '&kuma.io/service=web&'
validateClusters: false
virtualHosts:
- domains:
- '*'
name: backend
routes:
- match:
prefix: /
route:
cluster: backend
timeout: 15s
statPrefix: "outbound_127_0_0_1_10001"
streamIdleTimeout: 1800s
name: outbound:127.0.0.1:10001
trafficDirection: OUTBOUND