mirror of
https://github.com/fluxcd/flagger.git
synced 2026-04-15 06:57:34 +00:00
Add a no-operation router
To be used for Kubernetes blue/green deployments (no service mesh or ingress controller)
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user