Skip to content

Commit

Permalink
Merge pull request #336 from weaveworks/appmesh-router-fix
Browse files Browse the repository at this point in the history
Generate unique names for App Mesh virtual routers and routes
  • Loading branch information
stefanprodan committed Oct 14, 2019
2 parents 780f3d2 + 9982dc9 commit 1f34c65
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/router/appmesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ func (ar *AppMeshRouter) reconcileVirtualService(canary *flaggerv1.Canary, name
primaryVirtualNode := fmt.Sprintf("%s-primary", targetName)
protocol := getProtocol(canary)

routerName := targetName
if canaryWeight > 0 {
routerName = fmt.Sprintf("%s-canary", targetName)
}
// App Mesh supports only URI prefix
routePrefix := "/"
if len(canary.Spec.Service.Match) > 0 &&
Expand All @@ -176,7 +180,7 @@ func (ar *AppMeshRouter) reconcileVirtualService(canary *flaggerv1.Canary, name
vsSpec := appmeshv1.VirtualServiceSpec{
MeshName: canary.Spec.Service.MeshName,
VirtualRouter: &appmeshv1.VirtualRouter{
Name: fmt.Sprintf("%s-router", targetName),
Name: routerName,
Listeners: []appmeshv1.Listener{
{
PortMapping: appmeshv1.PortMapping{
Expand All @@ -188,7 +192,7 @@ func (ar *AppMeshRouter) reconcileVirtualService(canary *flaggerv1.Canary, name
},
Routes: []appmeshv1.Route{
{
Name: fmt.Sprintf("%s-route", targetName),
Name: routerName,
Http: &appmeshv1.HttpRoute{
Match: appmeshv1.HttpRouteMatch{
Prefix: routePrefix,
Expand Down

0 comments on commit 1f34c65

Please sign in to comment.