Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions internal/xds/translator/testdata/in/xds-ir/empty-hostnames.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "http-route"
http:
- name: "first-listener"
address: "0.0.0.0"
port: 10080
routes:
- name: "first-route"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove whitespace.

destinations:
- host: "1.2.3.4"
port: 50000
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- commonLbConfig:
localityWeightedLbConfig: {}
connectTimeout: 5s
dnsLookupFamily: V4_ONLY
loadAssignment:
clusterName: cluster_first-route
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: 1.2.3.4
portValue: 50000
loadBalancingWeight: 1
locality: {}
name: cluster_first-route
outlierDetection: {}
type: STATIC
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- address:
socketAddress:
address: 0.0.0.0
portValue: 10080
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
rds:
configSource:
apiConfigSource:
apiType: GRPC
grpcServices:
- envoyGrpc:
clusterName: xds_cluster
setNodeOnFirstMessageOnly: true
transportApiVersion: V3
resourceApiVersion: V3
routeConfigName: route_first-listener
statPrefix: http
name: listener_first-listener_10080
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- name: route_first-listener
virtualHosts:
- domains:
- '*'
name: route_first-listener
routes:
- match:
prefix: /
route:
cluster: cluster_first-route
4 changes: 4 additions & 0 deletions internal/xds/translator/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ func Translate(ir *ir.Xds) (*types.ResourceVersionTable, error) {
Domains: httpListener.Hostnames,
}

if len(vHost.Domains) == 0 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afaik this shouldnt be needed here, the Gateway API translator should have set this to * while creating the IR

if len(h.Hostnames) == 0 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like Validate is not called today, will raise a PR once #216 is in to call Validate before performing a Store

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raised #276

vHost.Domains = []string{"*"}
}

for _, httpRoute := range httpListener.Routes {
// 1:1 between IR HTTPRoute and xDS config.route.v3.Route
xdsRoute, err := buildXdsRoute(httpRoute)
Expand Down
3 changes: 3 additions & 0 deletions internal/xds/translator/translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ func TestTranslate(t *testing.T) {
{
name: "http-route",
},
{
name: "empty-hostnames",
},
}

for _, tc := range testCases {
Expand Down