Skip to content

Commit 27a770f

Browse files
authored
Merge branch 'main' into backend_tls
2 parents 7755982 + cc8a86e commit 27a770f

9 files changed

Lines changed: 402 additions & 14 deletions

File tree

test/config/gatewayclass.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,23 @@ spec:
9292
kubernetes:
9393
envoyDeployment:
9494
replicas: 2
95+
---
96+
kind: GatewayClass
97+
apiVersion: gateway.networking.k8s.io/v1
98+
metadata:
99+
name: merge-gateways
100+
spec:
101+
controllerName: gateway.envoyproxy.io/gatewayclass-controller
102+
parametersRef:
103+
group: gateway.envoyproxy.io
104+
kind: EnvoyProxy
105+
name: merge-gateways-config
106+
namespace: envoy-gateway-system
107+
---
108+
apiVersion: gateway.envoyproxy.io/v1alpha1
109+
kind: EnvoyProxy
110+
metadata:
111+
name: merge-gateways-config
112+
namespace: envoy-gateway-system
113+
spec:
114+
mergeGateways: true
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Copyright Envoy Gateway Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
// The full text of the Apache license is available in the LICENSE file at
4+
// the root of the repo.
5+
6+
//go:build e2e
7+
// +build e2e
8+
9+
package mergegateways
10+
11+
import (
12+
"flag"
13+
"testing"
14+
15+
"github.com/stretchr/testify/require"
16+
"sigs.k8s.io/controller-runtime/pkg/client"
17+
"sigs.k8s.io/controller-runtime/pkg/client/config"
18+
gwapiv1 "sigs.k8s.io/gateway-api/apis/v1"
19+
gwapiv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
20+
"sigs.k8s.io/gateway-api/conformance/utils/flags"
21+
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
22+
"sigs.k8s.io/gateway-api/conformance/utils/suite"
23+
24+
egv1a1 "github.com/envoyproxy/gateway/api/v1alpha1"
25+
"github.com/envoyproxy/gateway/test/e2e"
26+
"github.com/envoyproxy/gateway/test/e2e/tests"
27+
)
28+
29+
func TestMergeGateways(t *testing.T) {
30+
flag.Parse()
31+
32+
cfg, err := config.GetConfig()
33+
require.NoError(t, err)
34+
35+
c, err := client.New(cfg, client.Options{})
36+
require.NoError(t, err)
37+
require.NoError(t, gwapiv1a2.AddToScheme(c.Scheme()))
38+
require.NoError(t, gwapiv1.AddToScheme(c.Scheme()))
39+
require.NoError(t, egv1a1.AddToScheme(c.Scheme()))
40+
41+
if flags.RunTest != nil && *flags.RunTest != "" {
42+
t.Logf("Running E2E test %s with %s GatewayClass\n cleanup: %t\n debug: %t",
43+
*flags.RunTest, *flags.GatewayClassName, *flags.CleanupBaseResources, *flags.ShowDebug)
44+
} else {
45+
t.Logf("Running E2E tests with %s GatewayClass\n cleanup: %t\n debug: %t",
46+
*flags.GatewayClassName, *flags.CleanupBaseResources, *flags.ShowDebug)
47+
}
48+
49+
cSuite := suite.New(suite.Options{
50+
Client: c,
51+
GatewayClassName: *flags.GatewayClassName,
52+
Debug: *flags.ShowDebug,
53+
CleanupBaseResources: *flags.CleanupBaseResources,
54+
RunTest: *flags.RunTest,
55+
})
56+
57+
// Setting up the necessary arguments for the suite instead of calling Suite.Setup method again,
58+
// since this test suite reuse the base resources of previous test suite.
59+
cSuite.Applier.FS = e2e.Manifests
60+
cSuite.Applier.GatewayClass = *flags.GatewayClassName
61+
cSuite.ControllerName = kubernetes.GWCMustHaveAcceptedConditionTrue(t,
62+
cSuite.Client, cSuite.TimeoutConfig, cSuite.GatewayClassName)
63+
64+
t.Logf("Running %d MergeGateways tests", len(tests.MergeGatewaysTests))
65+
cSuite.Run(t, tests.MergeGatewaysTests)
66+
}
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
apiVersion: gateway.networking.k8s.io/v1
2+
kind: Gateway
3+
metadata:
4+
name: merged-gateway-1
5+
namespace: gateway-conformance-infra
6+
spec:
7+
gatewayClassName: merge-gateways
8+
listeners:
9+
- allowedRoutes:
10+
namespaces:
11+
from: Same
12+
name: http1
13+
port: 8080
14+
protocol: HTTP
15+
---
16+
apiVersion: gateway.networking.k8s.io/v1
17+
kind: Gateway
18+
metadata:
19+
name: merged-gateway-2
20+
namespace: gateway-conformance-infra
21+
spec:
22+
gatewayClassName: merge-gateways
23+
listeners:
24+
- allowedRoutes:
25+
namespaces:
26+
from: Same
27+
name: http2
28+
port: 8081
29+
protocol: HTTP
30+
---
31+
apiVersion: gateway.networking.k8s.io/v1
32+
kind: Gateway
33+
metadata:
34+
name: merged-gateway-3
35+
namespace: gateway-conformance-infra
36+
spec:
37+
gatewayClassName: merge-gateways
38+
listeners:
39+
- allowedRoutes:
40+
namespaces:
41+
from: Same
42+
name: http3
43+
port: 8082
44+
protocol: HTTP
45+
---
46+
apiVersion: gateway.networking.k8s.io/v1
47+
kind: Gateway
48+
metadata:
49+
name: merged-gateway-4
50+
namespace: gateway-conformance-infra
51+
spec:
52+
gatewayClassName: merge-gateways
53+
listeners:
54+
- allowedRoutes:
55+
namespaces:
56+
from: Same
57+
name: http3
58+
port: 8082
59+
protocol: HTTP
60+
---
61+
apiVersion: gateway.networking.k8s.io/v1
62+
kind: HTTPRoute
63+
metadata:
64+
name: merged-gateway-route-1
65+
namespace: gateway-conformance-infra
66+
spec:
67+
parentRefs:
68+
- name: merged-gateway-1
69+
hostnames:
70+
- "www.example1.com"
71+
rules:
72+
- backendRefs:
73+
- group: ""
74+
kind: Service
75+
name: infra-backend-v1
76+
port: 8080
77+
weight: 1
78+
matches:
79+
- path:
80+
type: PathPrefix
81+
value: /merge1
82+
---
83+
apiVersion: gateway.networking.k8s.io/v1
84+
kind: HTTPRoute
85+
metadata:
86+
name: merged-gateway-route-2
87+
namespace: gateway-conformance-infra
88+
spec:
89+
parentRefs:
90+
- name: merged-gateway-2
91+
hostnames:
92+
- "www.example2.com"
93+
rules:
94+
- backendRefs:
95+
- group: ""
96+
kind: Service
97+
name: infra-backend-v2
98+
port: 8080
99+
weight: 1
100+
matches:
101+
- path:
102+
type: PathPrefix
103+
value: /merge2
104+
---
105+
apiVersion: gateway.networking.k8s.io/v1
106+
kind: HTTPRoute
107+
metadata:
108+
name: merged-gateway-route-3
109+
namespace: gateway-conformance-infra
110+
spec:
111+
parentRefs:
112+
- name: merged-gateway-3
113+
hostnames:
114+
- "www.example3.com"
115+
rules:
116+
- backendRefs:
117+
- group: ""
118+
kind: Service
119+
name: infra-backend-v3
120+
port: 8080
121+
weight: 1
122+
matches:
123+
- path:
124+
type: PathPrefix
125+
value: /merge3
126+
---
127+
apiVersion: gateway.networking.k8s.io/v1
128+
kind: HTTPRoute
129+
metadata:
130+
name: merged-gateway-route-4
131+
namespace: gateway-conformance-infra
132+
spec:
133+
parentRefs:
134+
- name: merged-gateway-4
135+
hostnames:
136+
- "www.example4.com"
137+
rules:
138+
- backendRefs:
139+
- group: ""
140+
kind: Service
141+
name: infra-backend-v3
142+
port: 8080
143+
weight: 1
144+
matches:
145+
- path:
146+
type: PathPrefix
147+
value: /merge4

test/e2e/tests/eg_upgrade.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ import (
2424
"sigs.k8s.io/gateway-api/conformance/utils/suite"
2525
)
2626

27+
func init() {
28+
UpgradeTests = append(UpgradeTests, EGUpgradeTest)
29+
}
30+
2731
var EGUpgradeTest = suite.ConformanceTest{
2832
ShortName: "EGUpgrade",
2933
Description: "Upgrading from the last eg version should not lead to failures",

test/e2e/tests/envoy_shutdown.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,22 @@ import (
1616
"testing"
1717
"time"
1818

19-
"github.com/envoyproxy/gateway/api/v1alpha1"
20-
2119
"fortio.org/fortio/periodic"
22-
23-
"github.com/envoyproxy/gateway/internal/gatewayapi"
24-
"github.com/envoyproxy/gateway/internal/infrastructure/kubernetes/proxy"
25-
2620
appsv1 "k8s.io/api/apps/v1"
2721
corev1 "k8s.io/api/core/v1"
2822
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
2923
"k8s.io/apimachinery/pkg/labels"
3024
"k8s.io/apimachinery/pkg/types"
3125
"k8s.io/apimachinery/pkg/util/wait"
32-
3326
"sigs.k8s.io/controller-runtime/pkg/client"
3427
"sigs.k8s.io/gateway-api/conformance/utils/config"
3528
"sigs.k8s.io/gateway-api/conformance/utils/http"
3629
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
3730
"sigs.k8s.io/gateway-api/conformance/utils/suite"
31+
32+
"github.com/envoyproxy/gateway/api/v1alpha1"
33+
"github.com/envoyproxy/gateway/internal/gatewayapi"
34+
"github.com/envoyproxy/gateway/internal/infrastructure/kubernetes/proxy"
3835
)
3936

4037
func init() {

0 commit comments

Comments
 (0)