From 61f8aea7d853f3c444aa2783cd32c10e0995a1fa Mon Sep 17 00:00:00 2001 From: Andrew Jenkins Date: Tue, 24 Sep 2019 17:14:40 -0600 Subject: [PATCH] add Traffic Mirroring to Blue/Green deployments Traffic mirroring for blue/green will mirror traffic for the entire canary analysis phase of the blue/green deployment. --- pkg/controller/scheduler.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/controller/scheduler.go b/pkg/controller/scheduler.go index 0cc0f9c9..e4f95b3a 100644 --- a/pkg/controller/scheduler.go +++ b/pkg/controller/scheduler.go @@ -373,6 +373,15 @@ func (c *Controller) advanceCanary(name string, namespace string, skipLivenessCh if cd.Spec.CanaryAnalysis.Iterations > 0 { // increment iterations if cd.Spec.CanaryAnalysis.Iterations > cd.Status.Iterations { + // If in "mirror" mode, mirror requests during the entire B/G canary test + if provider != "kubernetes" && + cd.Spec.CanaryAnalysis.Mirror == true && mirrored == false { + if err := meshRouter.SetRoutes(cd, 100, 0, true); err != nil { + c.recordEventWarningf(cd, "%v", err) + } + c.logger.With("canary", fmt.Sprintf("%s.%s", name, namespace)). + Infof("Enabling mirroring for Blue/Green") + } if err := c.deployer.SetStatusIterations(cd, cd.Status.Iterations+1); err != nil { c.recordEventWarningf(cd, "%v", err) return