Skip to content

Commit

Permalink
Merge 2d4958c into backport/nd/fix-expose-paths/rapidly-rich-opossum
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-github-team-consul-core authored Oct 17, 2023
2 parents 880529c + 2d4958c commit d187d27
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (b *ListenerBuilder) addExposePathsRouter(exposePath *pbmesh.ExposePath) *L
if b.listener == nil {
return b
}
destinationName := exposePathDestinationName(exposePath)
destinationName := exposePathRouteName(exposePath)

var l7Protocol pbproxystate.L7Protocol

Expand Down Expand Up @@ -88,7 +88,7 @@ func (b *ListenerBuilder) addExposePathsRouter(exposePath *pbmesh.ExposePath) *L
}

func (b *Builder) addExposePathsRoute(exposePath *pbmesh.ExposePath, clusterName string) *Builder {
routeName := exposePathDestinationName(exposePath)
routeName := exposePathRouteName(exposePath)
routeRule := &pbproxystate.RouteRule{
Match: &pbproxystate.RouteMatch{
PathMatch: &pbproxystate.PathMatch{
Expand Down Expand Up @@ -132,9 +132,10 @@ func exposePathListenerName(exposePath *pbmesh.ExposePath) string {
return listenerName
}

func exposePathDestinationName(exposePath *pbmesh.ExposePath) string {
// The destination of the expose path is to the local port.
return fmt.Sprintf("exposed_path_destination_%s%d", exposePathName(exposePath), exposePath.LocalPathPort)
func exposePathRouteName(exposePath *pbmesh.ExposePath) string {
// The path could be empty, so the unique name for this exposed path is the path and listener port.
pathPort := fmt.Sprintf("%s%d", exposePathName(exposePath), exposePath.ListenerPort)
return fmt.Sprintf("exposed_path_route_%s", pathPort)
}

func exposePathClusterName(exposePath *pbmesh.ExposePath) string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@
{
"l7": {
"route": {
"name": "exposed_path_destination_health9090"
"name": "exposed_path_route_health1234"
},
"statPrefix": "exposed_path_destination_health9090",
"statPrefix": "exposed_path_route_health1234",
"staticRoute": true
}
}
Expand All @@ -134,23 +134,23 @@
"l7": {
"protocol": "L7_PROTOCOL_HTTP2",
"route": {
"name": "exposed_path_destination_GetHealth9091"
"name": "exposed_path_route_GetHealth1235"
},
"statPrefix": "exposed_path_destination_GetHealth9091",
"statPrefix": "exposed_path_route_GetHealth1235",
"staticRoute": true
}
}
]
}
],
"routes": {
"exposed_path_destination_GetHealth9091": {
"exposed_path_route_GetHealth1235": {
"virtualHosts": [
{
"domains": [
"*"
],
"name": "exposed_path_destination_GetHealth9091",
"name": "exposed_path_route_GetHealth1235",
"routeRules": [
{
"destination": {
Expand All @@ -168,13 +168,13 @@
}
]
},
"exposed_path_destination_health9090": {
"exposed_path_route_health1234": {
"virtualHosts": [
{
"domains": [
"*"
],
"name": "exposed_path_destination_health9090",
"name": "exposed_path_route_health1234",
"routeRules": [
{
"destination": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@
{
"l7": {
"route": {
"name": "exposed_path_destination_health9090"
"name": "exposed_path_route_health1234"
},
"statPrefix": "exposed_path_destination_health9090",
"statPrefix": "exposed_path_route_health1234",
"staticRoute": true
}
}
Expand All @@ -196,23 +196,23 @@
"l7": {
"protocol": "L7_PROTOCOL_HTTP2",
"route": {
"name": "exposed_path_destination_GetHealth9091"
"name": "exposed_path_route_GetHealth1235"
},
"statPrefix": "exposed_path_destination_GetHealth9091",
"statPrefix": "exposed_path_route_GetHealth1235",
"staticRoute": true
}
}
]
}
],
"routes": {
"exposed_path_destination_GetHealth9091": {
"exposed_path_route_GetHealth1235": {
"virtualHosts": [
{
"domains": [
"*"
],
"name": "exposed_path_destination_GetHealth9091",
"name": "exposed_path_route_GetHealth1235",
"routeRules": [
{
"destination": {
Expand All @@ -230,13 +230,13 @@
}
]
},
"exposed_path_destination_health9090": {
"exposed_path_route_health1234": {
"virtualHosts": [
{
"domains": [
"*"
],
"name": "exposed_path_destination_health9090",
"name": "exposed_path_route_health1234",
"routeRules": [
{
"destination": {
Expand Down

0 comments on commit d187d27

Please sign in to comment.