From 197e987d5fc18f594772a0f2d865b5808f49b8fe Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Fri, 1 Mar 2019 13:09:27 +0200 Subject: [PATCH] Avoid mesh gateway duplicates --- pkg/controller/router.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/controller/router.go b/pkg/controller/router.go index 6d07ff49..13eeeab2 100644 --- a/pkg/controller/router.go +++ b/pkg/controller/router.go @@ -167,7 +167,17 @@ func (c *CanaryRouter) syncVirtualService(cd *flaggerv1.Canary) error { targetName := cd.Spec.TargetRef.Name primaryName := fmt.Sprintf("%s-primary", targetName) hosts := append(cd.Spec.Service.Hosts, targetName) - gateways := append(cd.Spec.Service.Gateways, "mesh") + gateways := cd.Spec.Service.Gateways + var hasMeshGateway bool + for _, g := range gateways { + if g == "mesh" { + hasMeshGateway = true + } + } + if !hasMeshGateway { + gateways = append(gateways, "mesh") + } + route := []istiov1alpha3.DestinationWeight{ { Destination: istiov1alpha3.Destination{