Skip to content

Commit eb66d27

Browse files
authored
chore: make e2e use less resources (envoyproxy#1190)
**Description** Previously, all the end-to-end tests didn't configure Envoy container's resource requests. By default, it would use `cpu: 100m` & `memory: 512Mi`, and the more we add tests, the more the memory it would use hence the tests might get stuck in the middle. Signed-off-by: Takeshi Yoneda <[email protected]>
1 parent e767da5 commit eb66d27

File tree

11 files changed

+133
-2
lines changed

11 files changed

+133
-2
lines changed

examples/basic/basic.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ spec:
2121
- name: http
2222
protocol: HTTP
2323
port: 80
24+
infrastructure:
25+
parametersRef:
26+
group: gateway.envoyproxy.io
27+
kind: EnvoyProxy
28+
name: envoy-ai-gateway-basic
2429
---
2530
# By default, Envoy Gateway sets the buffer limit to 32kiB which is not sufficient for AI workloads.
2631
# This ClientTrafficPolicy sets the buffer limit to 50MiB as an example.
@@ -130,3 +135,18 @@ spec:
130135
port: 80
131136
targetPort: 8080
132137
type: ClusterIP
138+
---
139+
apiVersion: gateway.envoyproxy.io/v1alpha1
140+
kind: EnvoyProxy
141+
metadata:
142+
name: envoy-ai-gateway-basic
143+
namespace: default
144+
spec:
145+
provider:
146+
type: Kubernetes
147+
kubernetes:
148+
envoyDeployment:
149+
container:
150+
# Note: this is to clear the large default memory/cpu requirements for local tests.
151+
# In production, you should set these to values that make sense for your environment.
152+
resources: {}

examples/provider_fallback/base.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ spec:
2121
- name: http
2222
protocol: HTTP
2323
port: 80
24+
infrastructure:
25+
parametersRef:
26+
group: gateway.envoyproxy.io
27+
kind: EnvoyProxy
28+
name: provider-fallback
2429
---
2530
apiVersion: aigateway.envoyproxy.io/v1alpha1
2631
kind: AIGatewayRoute
@@ -186,3 +191,18 @@ spec:
186191
port: 443
187192
targetPort: 8080
188193
type: ClusterIP
194+
---
195+
apiVersion: gateway.envoyproxy.io/v1alpha1
196+
kind: EnvoyProxy
197+
metadata:
198+
name: provider-fallback
199+
namespace: default
200+
spec:
201+
provider:
202+
type: Kubernetes
203+
kubernetes:
204+
envoyDeployment:
205+
container:
206+
# Note: this is to clear the large default memory/cpu requirements for local tests.
207+
# In production, you should set these to values that make sense for your environment.
208+
resources: {}

examples/token_ratelimit/token_ratelimit.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ spec:
2121
- name: http
2222
protocol: HTTP
2323
port: 80
24+
infrastructure:
25+
parametersRef:
26+
group: gateway.envoyproxy.io
27+
kind: EnvoyProxy
28+
name: envoy-ai-gateway-token-ratelimit
2429
---
2530
apiVersion: aigateway.envoyproxy.io/v1alpha1
2631
kind: AIGatewayRoute
@@ -213,3 +218,18 @@ spec:
213218
port: 80
214219
targetPort: 8080
215220
type: ClusterIP
221+
---
222+
apiVersion: gateway.envoyproxy.io/v1alpha1
223+
kind: EnvoyProxy
224+
metadata:
225+
name: envoy-ai-gateway-token-ratelimit
226+
namespace: default
227+
spec:
228+
provider:
229+
type: Kubernetes
230+
kubernetes:
231+
envoyDeployment:
232+
container:
233+
# Note: this is to clear the large default memory/cpu requirements for local tests.
234+
# In production, you should set these to values that make sense for your environment.
235+
resources: {}

tests/e2e/basic_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ func Test_Examples_Basic(t *testing.T) {
2525
const manifestDir = "../../examples/basic"
2626
const manifest = manifestDir + "/basic.yaml"
2727
require.NoError(t, e2elib.KubectlApplyManifest(t.Context(), manifest))
28+
t.Cleanup(func() {
29+
_ = e2elib.KubectlDeleteManifest(t.Context(), manifest)
30+
})
2831

2932
const egSelector = "gateway.envoyproxy.io/owning-gateway-name=envoy-ai-gateway-basic"
3033
e2elib.RequireWaitForGatewayPodReady(t, egSelector)

tests/e2e/provider_fallback_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ func Test_Examples_ProviderFallback(t *testing.T) {
2626
const baseManifest = "../../examples/provider_fallback/base.yaml"
2727
const fallbackManifest = "../../examples/provider_fallback/fallback.yaml"
2828
const egSelector = "gateway.envoyproxy.io/owning-gateway-name=provider-fallback"
29-
// Delete the fallback configuration if it exists so that multiple runs of this test do not conflict.
30-
_ = e2elib.KubectlDeleteManifest(t.Context(), fallbackManifest)
3129

3230
// This requires the following environment variables to be set:
3331
// - TEST_AWS_ACCESS_KEY_ID
@@ -47,6 +45,10 @@ func Test_Examples_ProviderFallback(t *testing.T) {
4745
replaced = strings.ReplaceAll(replaced, "AWS_SECRET_ACCESS_KEY", cmp.Or(awsSecretAccessKey, "dummy-aws-secret-access-key"))
4846
require.NoError(t, e2elib.KubectlApplyManifestStdin(t.Context(), replaced))
4947
e2elib.RequireWaitForGatewayPodReady(t, egSelector)
48+
t.Cleanup(func() {
49+
_ = e2elib.KubectlDeleteManifest(t.Context(), baseManifest)
50+
_ = e2elib.KubectlDeleteManifest(t.Context(), fallbackManifest)
51+
})
5052

5153
const body = `{"model": "us.meta.llama3-2-1b-instruct-v1:0","messages": [{"role": "user", "content": "Say this is a test!"}],"temperature": 0.7}`
5254

tests/e2e/testdata/otel_tracing_console.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,25 @@ spec:
2727
- name: http
2828
protocol: HTTP
2929
port: 80
30+
infrastructure:
31+
parametersRef:
32+
group: gateway.envoyproxy.io
33+
kind: EnvoyProxy
34+
name: envoy-ai-gateway-otel-test
35+
---
36+
apiVersion: gateway.envoyproxy.io/v1alpha1
37+
kind: EnvoyProxy
38+
metadata:
39+
name: envoy-ai-gateway-otel-test
40+
namespace: otel-test-namespace
41+
spec:
42+
provider:
43+
type: Kubernetes
44+
kubernetes:
45+
envoyDeployment:
46+
container:
47+
# Clear the default memory/cpu requirements for local tests.
48+
resources: {}
3049
---
3150
apiVersion: gateway.envoyproxy.io/v1alpha1
3251
kind: Backend

tests/e2e/testdata/testupstream.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,25 @@ spec:
2121
- name: http
2222
protocol: HTTP
2323
port: 80
24+
infrastructure:
25+
parametersRef:
26+
group: gateway.envoyproxy.io
27+
kind: EnvoyProxy
28+
name: translation-testupstream
29+
---
30+
apiVersion: gateway.envoyproxy.io/v1alpha1
31+
kind: EnvoyProxy
32+
metadata:
33+
name: translation-testupstream
34+
namespace: default
35+
spec:
36+
provider:
37+
type: Kubernetes
38+
kubernetes:
39+
envoyDeployment:
40+
container:
41+
# Clear the default memory/cpu requirements for local tests.
42+
resources: {}
2443
---
2544
apiVersion: aigateway.envoyproxy.io/v1alpha1
2645
kind: AIGatewayRoute

tests/e2e/testdata/traffic_splitting_fallback.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,25 @@ spec:
2121
- name: http
2222
protocol: HTTP
2323
port: 80
24+
infrastructure:
25+
parametersRef:
26+
group: gateway.envoyproxy.io
27+
kind: EnvoyProxy
28+
name: traffic-splitting-fallback
29+
---
30+
apiVersion: gateway.envoyproxy.io/v1alpha1
31+
kind: EnvoyProxy
32+
metadata:
33+
name: traffic-splitting-fallback
34+
namespace: default
35+
spec:
36+
provider:
37+
type: Kubernetes
38+
kubernetes:
39+
envoyDeployment:
40+
container:
41+
# Clear the default memory/cpu requirements for local tests.
42+
resources: {}
2443
---
2544
apiVersion: aigateway.envoyproxy.io/v1alpha1
2645
kind: AIGatewayRoute

tests/e2e/testupstream_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ import (
2626
func TestWithTestUpstream(t *testing.T) {
2727
const manifest = "testdata/testupstream.yaml"
2828
require.NoError(t, e2elib.KubectlApplyManifest(t.Context(), manifest))
29+
t.Cleanup(func() {
30+
_ = e2elib.KubectlDeleteManifest(t.Context(), manifest)
31+
})
2932

3033
const egSelector = "gateway.envoyproxy.io/owning-gateway-name=translation-testupstream"
3134
e2elib.RequireWaitForGatewayPodReady(t, egSelector)

tests/e2e/token_ratelimit_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ const userIDMetricsLabel = "user_id"
3131
func Test_Examples_TokenRateLimit(t *testing.T) {
3232
const manifest = "../../examples/token_ratelimit/token_ratelimit.yaml"
3333
require.NoError(t, e2elib.KubectlApplyManifest(t.Context(), manifest))
34+
t.Cleanup(func() {
35+
_ = e2elib.KubectlDeleteManifest(t.Context(), manifest)
36+
})
3437

3538
const egSelector = "gateway.envoyproxy.io/owning-gateway-name=envoy-ai-gateway-token-ratelimit"
3639
e2elib.RequireWaitForGatewayPodReady(t, egSelector)

0 commit comments

Comments
 (0)