From 8d1cc83405226ce257448e901855c1d1522cd814 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Wed, 19 Jun 2019 12:01:02 +0300 Subject: [PATCH] Add a no-operation router To be used for Kubernetes blue/green deployments (no service mesh or ingress controller) --- pkg/router/nop.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 pkg/router/nop.go diff --git a/pkg/router/nop.go b/pkg/router/nop.go new file mode 100644 index 00000000..66f1d812 --- /dev/null +++ b/pkg/router/nop.go @@ -0,0 +1,24 @@ +package router + +import ( + flaggerv1 "github.com/weaveworks/flagger/pkg/apis/flagger/v1alpha3" +) + +// NopRouter no-operation router +type NopRouter struct { +} + +func (*NopRouter) Reconcile(canary *flaggerv1.Canary) error { + return nil +} + +func (*NopRouter) SetRoutes(canary *flaggerv1.Canary, primaryWeight int, canaryWeight int) error { + return nil +} + +func (*NopRouter) GetRoutes(canary *flaggerv1.Canary) (primaryWeight int, canaryWeight int, err error) { + if canary.Status.Iterations > 0 { + return 0, 100, nil + } + return 100, 0, nil +}