Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yuval-k committed Nov 27, 2024
1 parent 5dbaa8e commit 32e65a7
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
8 changes: 8 additions & 0 deletions projects/gateway2/translator/gateway_translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ var _ = DescribeTable("Basic GatewayTranslator Tests",
Name: "example-gateway",
},
}),
FEntry("Proxy with no routes", translatorTestCase{
inputFile: "edge-cases/no_route.yaml",
outputFile: "no_route.yaml",
gwNN: types.NamespacedName{
Namespace: "default",
Name: "example-gateway",
},
}),
)

var _ = DescribeTable("Route Delegation translator",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#$ Used in:
#$ - site-src/guides/http-routing.md
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: example-gateway
spec:
gatewayClassName: example-gateway-class
listeners:
- name: http
protocol: HTTP
port: 80
14 changes: 14 additions & 0 deletions projects/gateway2/translator/testutils/outputs/no_route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
metadata:
labels:
created_by: gloo-kube-gateway-api
gateway_namespace: default
name: default-example-gateway
namespace: gloo-system
listeners:
- aggregateListener:
httpFilterChains:
- matcher: {}
httpResources: {}
bindAddress: '::'
bindPort: 8080
name: http
43 changes: 43 additions & 0 deletions projects/gloo/pkg/translator/translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3928,6 +3928,49 @@ var _ = Describe("Translator", func() {
})
})

Context("Aggregate Listeners", func() {

FIt("should translate empty aggragate listener", func() {

proxy = &v1.Proxy{
Metadata: &core.Metadata{
Name: "test",
Namespace: "gloo-system",
},
Listeners: []*v1.Listener{
{
BindAddress: "::",
BindPort: 8080,
Name: "http",
ListenerType: &v1.Listener_AggregateListener{
AggregateListener: &v1.AggregateListener{
HttpResources: &v1.AggregateListener_HttpResources{},
HttpFilterChains: []*v1.AggregateListener_HttpFilterChain{
{
Matcher: &v1.Matcher{},
},
},
},
},
},
},
}
snap, errs, report := translator.Translate(params, proxy)
Expect(errs.Validate()).NotTo(HaveOccurred())
Expect(snap).NotTo(BeNil())
Expect(report).To(Equal(validationutils.MakeReport(proxy)))

Expect(snap.GetResources(types.ListenerTypeV3).Items).To(BeEmpty())
// NOTE: the below assertions should be correct, but not:
// see: https://github.com/solo-io/solo-projects/issues/7328
// Expect(snap.GetResources(types.ListenerTypeV3).Items).To(HaveKey("http"))
//
// lis := snap.GetResources(types.ListenerTypeV3).Items["http"].ResourceProto().(*listenerv3.Listener)
// Expect(lis).NotTo(BeNil())

})

})
Context("Custom filters", func() {
It("http", func() {
hybridListener := proxy.Listeners[2]
Expand Down

0 comments on commit 32e65a7

Please sign in to comment.