Refactor ADC config to use AI rate limiting for /api route

This commit is contained in:
d.viti
2025-10-07 15:01:22 +02:00
parent 8f5e4f2776
commit e156b7c7a1
4 changed files with 245 additions and 84 deletions

164
diff.yaml Normal file
View File

@@ -0,0 +1,164 @@
- resourceType: route
type: update
resourceId: 300352210d490360aa898cc92cc1ebd72eaaa51a
resourceName: apache-route
oldValue:
uris:
- /*
name: apache-route
plugins:
redirect:
http_to_https: true
priority: 1
vars:
- - uri
- ~~
- ^(?!/api)
newValue:
name: apache-route
hosts:
- commandware.it
uris:
- /*
priority: 1
vars:
- - uri
- ~~
- ^(?!/api)
plugins:
redirect:
http_to_https: true
diff:
- kind: 'N'
path:
- hosts
rhs:
- commandware.it
parentId: d67f707ab99345fbe8bf7e21a73b7c0136ad5a27
- resourceType: route
type: update
resourceId: 1704231ea22866bfc59bf5bc58efb578c6e4cb1a
resourceName: nginx-api-route
oldValue:
uris:
- /api
- /api/*
name: nginx-api-route
plugins:
ai-rate-limiting:
limit: 100
limit_strategy: total_tokens
rejected_code: 429
time_window: 60
redirect:
http_to_https: true
priority: 10
newValue:
name: nginx-api-route
hosts:
- commandware.it
uris:
- /api
- /api/*
priority: 10
plugins:
redirect:
http_to_https: true
ai-rate-limiting:
limit: 100
time_window: 60
rejected_code: 429
limit_strategy: total_tokens
diff:
- kind: 'N'
path:
- hosts
rhs:
- commandware.it
parentId: c87a0166e1c37ecfd013d6e5db2dbec88b710939
- resourceType: service
type: update
resourceId: d67f707ab99345fbe8bf7e21a73b7c0136ad5a27
resourceName: apache-service
oldValue:
name: apache-service
upstream:
name: apache-upstream
type: roundrobin
hash_on: vars
nodes:
- host: apache-service.api7ee.svc.cluster.local
port: 80
weight: 100
priority: 0
scheme: http
retry_timeout: 0
pass_host: pass
strip_path_prefix: true
newValue:
name: apache-service
upstream:
name: apache-upstream
type: roundrobin
nodes:
- host: apache-service.api7ee.svc.cluster.local
port: 80
weight: 100
priority: 0
scheme: http
pass_host: pass
strip_path_prefix: true
diff:
- kind: D
path:
- upstream
- hash_on
lhs: vars
- kind: D
path:
- upstream
- retry_timeout
lhs: 0
- resourceType: service
type: update
resourceId: c87a0166e1c37ecfd013d6e5db2dbec88b710939
resourceName: nginx-api-service
oldValue:
name: nginx-api-service
upstream:
name: nginx-upstream
type: roundrobin
hash_on: vars
nodes:
- host: nginx-service.api7ee.svc.cluster.local
port: 80
weight: 100
priority: 0
scheme: http
retry_timeout: 0
pass_host: pass
strip_path_prefix: true
newValue:
name: nginx-api-service
upstream:
name: nginx-upstream
type: roundrobin
nodes:
- host: nginx-service.api7ee.svc.cluster.local
port: 80
weight: 100
priority: 0
scheme: http
pass_host: pass
strip_path_prefix: true
diff:
- kind: D
path:
- upstream
- hash_on
lhs: vars
- kind: D
path:
- upstream
- retry_timeout
lhs: 0