Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of mesh: ensure route configs are named uniquely per port into release/1.17.x #19324

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (b *Builder) buildDestination(
if destination.Explicit != nil {
routeName = lb.listener.Name
} else {
routeName = DestinationResourceID(cpr.ParentRef.Ref)
routeName = DestinationResourceID(cpr.ParentRef.Ref, cpr.ParentRef.Port)
}

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func DestinationStatPrefix(serviceRef *pbresource.Reference, portName, datacente
}

func DestinationListenerName(destinationRef *pbresource.Reference, portName string, address string, port uint32) string {
name := fmt.Sprintf("%s:%s:%s", DestinationResourceID(destinationRef), portName, address)
name := fmt.Sprintf("%s:%s", DestinationResourceID(destinationRef, portName), address)
if port != 0 {
return fmt.Sprintf("%s:%d", name, port)
}
Expand All @@ -39,8 +39,8 @@ func DestinationListenerName(destinationRef *pbresource.Reference, portName stri

// DestinationResourceID returns a string representation that uniquely identifies the
// upstream in a canonical but human readable way.
func DestinationResourceID(destinationRef *pbresource.Reference) string {
func DestinationResourceID(destinationRef *pbresource.Reference, port string) string {
tenancyPrefix := fmt.Sprintf("%s/%s/%s", destinationRef.Tenancy.Partition,
destinationRef.Tenancy.PeerName, destinationRef.Tenancy.Namespace)
return fmt.Sprintf("%s/%s", tenancyPrefix, destinationRef.Name)
return fmt.Sprintf("%s/%s:%s", tenancyPrefix, destinationRef.Name, port)
}
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
{
"l7": {
"route": {
"name": "default/local/default/api-app"
"name": "default/local/default/api-app:http"
},
"statPrefix": "upstream."
},
Expand All @@ -265,7 +265,7 @@
{
"l7": {
"route": {
"name": "default/local/default/api-app2"
"name": "default/local/default/api-app2:http"
},
"statPrefix": "upstream."
},
Expand Down Expand Up @@ -325,18 +325,18 @@
}
],
"routes": {
"default/local/default/api-app": {
"default/local/default/api-app2:http": {
"virtualHosts": [
{
"domains": [
"*"
],
"name": "default/local/default/api-app",
"name": "default/local/default/api-app2:http",
"routeRules": [
{
"destination": {
"cluster": {
"name": "http.api-app.default.dc1.internal.foo.consul"
"name": "http.api-app2.default.dc1.internal.foo.consul"
}
},
"match": {
Expand All @@ -349,18 +349,18 @@
}
]
},
"default/local/default/api-app2": {
"default/local/default/api-app:http": {
"virtualHosts": [
{
"domains": [
"*"
],
"name": "default/local/default/api-app2",
"name": "default/local/default/api-app:http",
"routeRules": [
{
"destination": {
"cluster": {
"name": "http.api-app2.default.dc1.internal.foo.consul"
"name": "http.api-app.default.dc1.internal.foo.consul"
}
},
"match": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
{
"l7": {
"route": {
"name": "default/local/default/api-app"
"name": "default/local/default/api-app:http"
},
"statPrefix": "upstream."
},
Expand Down Expand Up @@ -181,13 +181,13 @@
}
],
"routes": {
"default/local/default/api-app": {
"default/local/default/api-app:http": {
"virtualHosts": [
{
"domains": [
"*"
],
"name": "default/local/default/api-app",
"name": "default/local/default/api-app:http",
"routeRules": [
{
"destination": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
{
"l7": {
"route": {
"name": "default/local/default/api-app"
"name": "default/local/default/api-app:http"
},
"statPrefix": "upstream."
},
Expand Down Expand Up @@ -181,13 +181,13 @@
}
],
"routes": {
"default/local/default/api-app": {
"default/local/default/api-app:http": {
"virtualHosts": [
{
"domains": [
"*"
],
"name": "default/local/default/api-app",
"name": "default/local/default/api-app:http",
"routeRules": [
{
"destination": {
Expand Down
Loading