From 625eed084035fec830778e524638ef9b95fd913d Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Sat, 5 Oct 2019 17:59:34 +0300 Subject: [PATCH] Enforce blue/green when using kubernetes networking Use blue/green with ten iterations and warn that progressive traffic shifting and HTTP headers routing are not compatible with Kubernetes L4 networking. --- pkg/controller/scheduler.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/controller/scheduler.go b/pkg/controller/scheduler.go index 7d9b909c..8fec79c0 100644 --- a/pkg/controller/scheduler.go +++ b/pkg/controller/scheduler.go @@ -325,6 +325,19 @@ func (c *Controller) advanceCanary(name string, namespace string, skipLivenessCh } } + // use blue/green strategy for kubernetes provider + if provider == "kubernetes" { + if len(cd.Spec.CanaryAnalysis.Match) > 0 { + c.recordEventWarningf(cd, "A/B testing is not supported when using the kubernetes provider") + cd.Spec.CanaryAnalysis.Match = nil + } + if cd.Spec.CanaryAnalysis.Iterations < 1 { + c.recordEventWarningf(cd, "Progressive traffic is not supported when using the kubernetes provider") + c.recordEventWarningf(cd, "Setting canaryAnalysis.iterations: 10") + cd.Spec.CanaryAnalysis.Iterations = 10 + } + } + // strategy: A/B testing if len(cd.Spec.CanaryAnalysis.Match) > 0 && cd.Spec.CanaryAnalysis.Iterations > 0 { // route traffic to canary and increment iterations