From a6d86f2e817437313007db44d45db24757c2d13f Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Sun, 22 Sep 2019 00:48:42 +0300 Subject: [PATCH] Skip mesh routers for B/G when provider is kubernetes --- pkg/controller/scheduler.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/pkg/controller/scheduler.go b/pkg/controller/scheduler.go index 7a184c74..230eb9d0 100644 --- a/pkg/controller/scheduler.go +++ b/pkg/controller/scheduler.go @@ -377,12 +377,14 @@ func (c *Controller) advanceCanary(name string, namespace string, skipLivenessCh // route all traffic to canary - max iterations reached if cd.Spec.CanaryAnalysis.Iterations == cd.Status.Iterations { - c.recordEventInfof(cd, "Routing all traffic to canary") - if err := meshRouter.SetRoutes(cd, 0, 100); err != nil { - c.recordEventWarningf(cd, "%v", err) - return + if provider != "kubernetes" { + c.recordEventInfof(cd, "Routing all traffic to canary") + if err := meshRouter.SetRoutes(cd, 0, 100); err != nil { + c.recordEventWarningf(cd, "%v", err) + return + } + c.recorder.SetWeight(cd, 0, 100) } - c.recorder.SetWeight(cd, 0, 100) // increment iterations if err := c.deployer.SetStatusIterations(cd, cd.Status.Iterations+1); err != nil { @@ -411,11 +413,14 @@ func (c *Controller) advanceCanary(name string, namespace string, skipLivenessCh // route all traffic to primary if cd.Spec.CanaryAnalysis.Iterations < cd.Status.Iterations { - if err := meshRouter.SetRoutes(cd, 100, 0); err != nil { - c.recordEventWarningf(cd, "%v", err) - return + if provider != "kubernetes" { + c.recordEventInfof(cd, "Routing all traffic to primary") + if err := meshRouter.SetRoutes(cd, 100, 0); err != nil { + c.recordEventWarningf(cd, "%v", err) + return + } + c.recorder.SetWeight(cd, 100, 0) } - c.recorder.SetWeight(cd, 100, 0) // update status phase if err := c.deployer.SetStatusPhase(cd, flaggerv1.CanaryPhaseFinalising); err != nil { @@ -423,7 +428,6 @@ func (c *Controller) advanceCanary(name string, namespace string, skipLivenessCh return } - c.recordEventInfof(cd, "Routing all traffic to primary") return }