Skip to content

Commit

Permalink
fix all ports hostname
Browse files Browse the repository at this point in the history
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
  • Loading branch information
lukidzi committed Nov 29, 2024
1 parent 8e4d47d commit a69942b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,11 @@ var _ = Describe("MeshPassthrough", func() {
Port: pointer.To[uint32](80),
Protocol: api.ProtocolType("http"),
},
{
Type: api.MatchType("Domain"),
Value: "anotherexample.com",
Protocol: api.ProtocolType("http"),
},
{
Type: api.MatchType("Domain"),
Value: "example2.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ resources:
lbPolicy: CLUSTER_PROVIDED
name: meshpassthrough_*.example.com_*
type: ORIGINAL_DST
- name: meshpassthrough_anotherexample.com_*
resource:
'@type': type.googleapis.com/envoy.config.cluster.v3.Cluster
altStatName: meshpassthrough_anotherexample_com__
connectTimeout: 5s
lbPolicy: CLUSTER_PROVIDED
name: meshpassthrough_anotherexample.com_*
type: ORIGINAL_DST
- name: meshpassthrough_example1.com_80
resource:
'@type': type.googleapis.com/envoy.config.cluster.v3.Cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ resources:
routeConfig:
name: meshpassthrough_http_*
virtualHosts:
- domains:
- anotherexample.com
- anotherexample.com:*
name: anotherexample.com
routes:
- match:
prefix: /
route:
cluster: meshpassthrough_anotherexample.com_*
- domains:
- '*.example.com'
name: '*.example.com'
Expand Down Expand Up @@ -173,6 +182,15 @@ resources:
routeConfig:
name: meshpassthrough_http_*
virtualHosts:
- domains:
- anotherexample.com
- anotherexample.com:*
name: anotherexample.com
routes:
- match:
prefix: /
route:
cluster: meshpassthrough_anotherexample.com_*
- domains:
- '*.example.com'
name: '*.example.com'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ func (c FilterChainConfigurer) addFilterChainConfiguration(listener *envoy_liste
if c.Port != 0 && route.MatchType == IPV6 {
domains = append(domains, fmt.Sprintf("[%s]", route.Value), fmt.Sprintf("[%s]:%d", route.Value, c.Port))
}
if c.Port == 0 && route.MatchType == Domain {
// we want to match all domains
domains = append(domains, fmt.Sprintf("%s:*", route.Value))
}

clusterName := ClusterName(route.Value, c.Protocol, c.Port)
routeBuilder.Configure(xds_routes.VirtualHost(xds_virtual_hosts.NewVirtualHostBuilder(c.APIVersion, route.Value).
Configure(
Expand Down

0 comments on commit a69942b

Please sign in to comment.