Skip to content

Commit

Permalink
Changed the name generated for each transport match to be more inline
Browse files Browse the repository at this point in the history
with other names used in other places in xDS.

Signed-off-by: Lior Okman <lior.okman@sap.com>
  • Loading branch information
liorokman committed Mar 8, 2024
1 parent 865d62b commit 3b746f6
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 17 deletions.
9 changes: 4 additions & 5 deletions internal/xds/translator/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ func buildXdsCluster(args *xdsClusterArgs) *clusterv3.Cluster {

for i, ds := range args.settings {
if ds.TLS != nil {
// for upstreamTLS , a fixed sni can be used. use auto_sni otherwise
// https://www.envoyproxy.io/docs/envoy/latest/faq/configuration/sni#faq-how-to-setup-sni:~:text=For%20clusters%2C%20a,for%20trust%20anchor.
socket, err := buildXdsUpstreamTLSSocketWthCert(ds.TLS)
if err != nil {
// TODO: Log something here
Expand All @@ -90,11 +88,12 @@ func buildXdsCluster(args *xdsClusterArgs) *clusterv3.Cluster {
if args.proxyProtocol != nil {
socket = buildProxyProtocolSocket(args.proxyProtocol, socket)
}
matchName := fmt.Sprintf("%s/tls/%d", args.name, i)
cluster.TransportSocketMatches = append(cluster.TransportSocketMatches, &clusterv3.Cluster_TransportSocketMatch{
Name: fmt.Sprintf("destination-tls-config-%d", i),
Name: matchName,
Match: &structpb.Struct{
Fields: map[string]*structpb.Value{
"matcher-index": structpb.NewStringValue(fmt.Sprintf("tls-%d", i)),
"name": structpb.NewStringValue(matchName),
},
},
TransportSocket: socket,
Expand Down Expand Up @@ -351,7 +350,7 @@ func buildXdsClusterLoadAssignment(clusterName string, destSettings []*ir.Destin
FilterMetadata: map[string]*structpb.Struct{
"envoy.transport_socket_match": {
Fields: map[string]*structpb.Value{
"matcher-index": structpb.NewStringValue(fmt.Sprintf("tls-%d", i)),
"name": structpb.NewStringValue(fmt.Sprintf("%s/tls/%d", clusterName, i)),
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
perConnectionBufferLimitBytes: 32768
transportSocketMatches:
- match:
matcher-index: tls-0
name: destination-tls-config-0
name: httproute/envoy-gateway/httproute-btls/rule/0/tls/0
name: httproute/envoy-gateway/httproute-btls/rule/0/tls/0
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
metadata:
filterMetadata:
envoy.transport_socket_match:
matcher-index: tls-0
name: httproute/envoy-gateway/httproute-btls/rule/0/tls/0
loadBalancingWeight: 1
locality:
region: httproute/envoy-gateway/httproute-btls/rule/0/backend/0
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
perConnectionBufferLimitBytes: 32768
transportSocketMatches:
- match:
matcher-index: tls-0
name: destination-tls-config-0
name: httproute/envoy-gateway/httproute-btls/rule/0/tls/0
name: httproute/envoy-gateway/httproute-btls/rule/0/tls/0
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand All @@ -30,8 +30,8 @@
resourceApiVersion: V3
sni: bar.example.com
- match:
matcher-index: tls-1
name: destination-tls-config-1
name: httproute/envoy-gateway/httproute-btls/rule/0/tls/1
name: httproute/envoy-gateway/httproute-btls/rule/0/tls/1
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
metadata:
filterMetadata:
envoy.transport_socket_match:
matcher-index: tls-0
name: httproute/envoy-gateway/httproute-btls/rule/0/tls/0
loadBalancingWeight: 1
locality:
region: httproute/envoy-gateway/httproute-btls/rule/0/backend/0
Expand All @@ -24,7 +24,7 @@
metadata:
filterMetadata:
envoy.transport_socket_match:
matcher-index: tls-1
name: httproute/envoy-gateway/httproute-btls/rule/0/tls/1
loadBalancingWeight: 1
locality:
region: httproute/envoy-gateway/httproute-btls/rule/0/backend/1
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
perConnectionBufferLimitBytes: 32768
transportSocketMatches:
- match:
matcher-index: tls-0
name: destination-tls-config-0
name: httproute/envoy-gateway/httproute-btls/rule/0/tls/0
name: httproute/envoy-gateway/httproute-btls/rule/0/tls/0
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
metadata:
filterMetadata:
envoy.transport_socket_match:
matcher-index: tls-0
name: httproute/envoy-gateway/httproute-btls/rule/0/tls/0
loadBalancingWeight: 1
locality:
region: httproute/envoy-gateway/httproute-btls/rule/0/backend/0

0 comments on commit 3b746f6

Please sign in to comment.